FreeBSD Bugzilla – Attachment 162043 Details for
Bug 194483
[PATCH] libfetch: Properly deal with multi-line proxy responses to CONNECT requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Revised patch
file_194483.txt (text/plain), 1.78 KB, created by
Dag-Erling Smørgrav
on 2015-10-14 15:54:33 UTC
(
hide
)
Description:
Revised patch
Filename:
MIME Type:
Creator:
Dag-Erling Smørgrav
Created:
2015-10-14 15:54:33 UTC
Size:
1.78 KB
patch
obsolete
>Index: http.c >=================================================================== >--- http.c (revision 289220) >+++ http.c (working copy) >@@ -1376,8 +1376,12 @@ > { > struct url *curl; > conn_t *conn; >+ hdr_t h; >+ http_headerbuf_t headerbuf; >+ const char *p; > int verbose; > int af, val; >+ int serrno; > > #ifdef INET6 > af = AF_UNSPEC; >@@ -1395,6 +1399,7 @@ > > curl = (purl != NULL) ? purl : URL; > >+ init_http_headerbuf(&headerbuf); > if ((conn = fetch_connect(curl->host, curl->port, af, verbose)) == NULL) > /* fetch_connect() has already set an error code */ > return (NULL); >@@ -1404,11 +1409,25 @@ > http_cmd(conn, "Host: %s:%d", > URL->host, URL->port); > http_cmd(conn, ""); >- if (http_get_reply(conn) != HTTP_OK) { >- fetch_close(conn); >- return (NULL); >+ if (http_get_reply(conn) != HTTP_OK) >+ goto ouch; >+ /* Read and discard the rest of the proxy response */ >+ if (fetch_getln(conn) < 0) { >+ fetch_syserr(); >+ goto ouch; > } >- http_get_reply(conn); >+ do { >+ switch ((h = http_next_header(conn, &headerbuf, &p))) { >+ case hdr_syserror: >+ fetch_syserr(); >+ goto ouch; >+ case hdr_error: >+ http_seterr(HTTP_PROTOCOL_ERROR); >+ goto ouch; >+ default: >+ /* ignore */ ; >+ } >+ } while (h < hdr_end); > } > if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 && > fetch_ssl(conn, URL, verbose) == -1) { >@@ -1416,13 +1435,20 @@ > /* grrr */ > errno = EAUTH; > fetch_syserr(); >- return (NULL); >+ goto ouch; > } > > val = 1; > setsockopt(conn->sd, IPPROTO_TCP, TCP_NOPUSH, &val, sizeof(val)); > >+ clean_http_headerbuf(&headerbuf); > return (conn); >+ouch: >+ serrno = errno; >+ clean_http_headerbuf(&headerbuf); >+ fetch_close(conn); >+ errno = serrno; >+ return (NULL); > } > > static struct url *
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 194483
:
148498
|
162043
|
162113
|
175412