File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,7 +103,9 @@ bool net_http_error(struct http_t *state);
103103 *
104104 * @return the response headers. The returned buffer is owned by the
105105 * caller of net_http_new; it is not freed by net_http_delete.
106- * If the status is not 20x and accept_error is false, it returns NULL.
106+ * On a transport error, NULL is returned unless accept_error is true.
107+ * Headers are returned for any response that was parsed successfully,
108+ * including HTTP error statuses such as 401 (needed for auth challenges).
107109 **/
108110struct string_list * net_http_headers (struct http_t * state );
109111struct string_list * net_http_headers_ex (struct http_t * state , bool accept_error );
Original file line number Diff line number Diff line change @@ -1804,13 +1804,15 @@ int net_http_status(struct http_t *state)
18041804 *
18051805 * @return the response headers. The returned buffer is owned by the
18061806 * caller of net_http_new; it is not freed by net_http_delete().
1807- * If the status is not 20x and accept_err is false, it returns NULL.
1807+ * On a transport error, NULL is returned unless accept_err is true.
1808+ * Headers are returned for any response that was parsed successfully,
1809+ * including HTTP error statuses such as 401 (needed for auth challenges).
18081810 **/
18091811struct string_list * net_http_headers_ex (struct http_t * state , bool accept_err )
18101812{
18111813 if (!state )
18121814 return NULL ;
1813- if (!accept_err && ! state -> err )
1815+ if (!accept_err && state -> err )
18141816 return NULL ;
18151817 return state -> response .headers ;
18161818}
You can’t perform that action at this time.
0 commit comments