http: add HTTP_KEEP_ERROR option

We currently set curl's FAILONERROR option, which means that
any http failures are reported as curl errors, and the
http body content from the server is thrown away.

This patch introduces a new option to http_get_strbuf which
specifies that the body content from a failed http response
should be placed in the destination strbuf, where it can be
accessed by the caller.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2013-04-05 18:14:06 -04:00
committed by Junio C Hamano
parent 21ccebec0d
commit 6d052d78d7
2 changed files with 38 additions and 0 deletions

1
http.h
View File

@ -118,6 +118,7 @@ extern char *get_remote_object_url(const char *url, const char *hex,
/* Options for http_request_*() */
#define HTTP_NO_CACHE 1
#define HTTP_KEEP_ERROR 2
/* Return values for http_request_*() */
#define HTTP_OK 0