1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

http: Added proxy tunnel authentication message header value extraction

...following recent changes to Curl_base64_decode() rather than trying
to parse a header line for the authentication mechanisms which is CRLF
terminated and inline zero terminate it.
This commit is contained in:
Steve Holme 2013-11-02 11:18:39 +00:00
parent cdccb42267
commit 3b59696a93
3 changed files with 12 additions and 4 deletions

View File

@ -187,7 +187,7 @@ char *Curl_checkheaders(struct SessionHandle *data, const char *thisheader)
* case of allocation failure. Returns an empty string if the header value * case of allocation failure. Returns an empty string if the header value
* consists entirely of whitespace. * consists entirely of whitespace.
*/ */
static char *copy_header_value(const char *h) char *copy_header_value(const char *h)
{ {
const char *start; const char *start;
const char *end; const char *end;

View File

@ -35,11 +35,12 @@ extern const struct Curl_handler Curl_handler_http;
extern const struct Curl_handler Curl_handler_https; extern const struct Curl_handler Curl_handler_https;
#endif #endif
/* Header specific function */
bool Curl_compareheader(const char *headerline, /* line to check */ bool Curl_compareheader(const char *headerline, /* line to check */
const char *header, /* header keyword _with_ colon */ const char *header, /* header keyword _with_ colon */
const char *content); /* content string to find */ const char *content); /* content string to find */
char *Curl_checkheaders(struct SessionHandle *data, const char *thisheader); char *Curl_checkheaders(struct SessionHandle *data, const char *thisheader);
char *copy_header_value(const char *h);
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
/* /*

View File

@ -452,8 +452,15 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
(401 == k->httpcode)) || (401 == k->httpcode)) ||
(checkprefix("Proxy-authenticate:", line_start) && (checkprefix("Proxy-authenticate:", line_start) &&
(407 == k->httpcode))) { (407 == k->httpcode))) {
result = Curl_http_input_auth(conn, k->httpcode,
line_start); char *auth = copy_header_value(line_start);
if(!auth)
return CURLE_OUT_OF_MEMORY;
result = Curl_http_input_auth(conn, k->httpcode, auth);
Curl_safefree(auth);
if(result) if(result)
return result; return result;
} }