FreeBSD Bugzilla – Attachment 201165 Details for
Bug 129431
freebsd-update(8) fetch fails because phttpget fails proxy auth
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
b64enc fix and use fetch API
phttp-change.diff (text/plain), 2.41 KB, created by
Gerald Aryeetey
on 2019-01-15 18:15:00 UTC
(
hide
)
Description:
b64enc fix and use fetch API
Filename:
MIME Type:
Creator:
Gerald Aryeetey
Created:
2019-01-15 18:15:00 UTC
Size:
2.41 KB
patch
obsolete
>diff --git a/usr.sbin/portsnap/phttpget/phttpget.c b/usr.sbin/portsnap/phttpget/phttpget.c >index 17935b12253..6e2ff7cd4b4 100644 >--- a/usr.sbin/portsnap/phttpget/phttpget.c >+++ b/usr.sbin/portsnap/phttpget/phttpget.c >@@ -45,12 +45,13 @@ __FBSDID("$FreeBSD$"); > #include <string.h> > #include <sysexits.h> > #include <unistd.h> >+#include <fetch.h> > >-static const char * env_HTTP_PROXY; >+static const char env_HTTP_PROXY[MAXHOSTNAMELEN+1]; > static char * env_HTTP_PROXY_AUTH; > static const char * env_HTTP_USER_AGENT; > static char * env_HTTP_TIMEOUT; >-static const char * proxyport; >+static const char proxyport[URL_SCHEMELEN+1]; > static char * proxyauth; > > static struct timeval timo = { 15, 0}; >@@ -106,7 +107,7 @@ b64enc(const char *ptext) > > /* Write 4 bytes */ > for (j = 0; j < 4; j++) { >- if (j <= ptlen + 1) >+ if (j <= ptlen) > pc[j] = base64[(t >> 18) & 0x3f]; > else > pc[j] = '='; >@@ -128,23 +129,7 @@ readenv(void) > char *proxy_auth_user = NULL; > char *proxy_auth_pass = NULL; > long http_timeout; >- >- env_HTTP_PROXY = getenv("HTTP_PROXY"); >- if (env_HTTP_PROXY == NULL) >- env_HTTP_PROXY = getenv("http_proxy"); >- if (env_HTTP_PROXY != NULL) { >- if (strncmp(env_HTTP_PROXY, "http://", 7) == 0) >- env_HTTP_PROXY += 7; >- p = strchr(env_HTTP_PROXY, '/'); >- if (p != NULL) >- *p = 0; >- p = strchr(env_HTTP_PROXY, ':'); >- if (p != NULL) { >- *p = 0; >- proxyport = p + 1; >- } else >- proxyport = "3128"; >- } >+ struct url *proxy_url = NULL; > > env_HTTP_PROXY_AUTH = getenv("HTTP_PROXY_AUTH"); > if ((env_HTTP_PROXY != NULL) && >@@ -161,6 +146,21 @@ readenv(void) > proxy_auth_pass = env_HTTP_PROXY_AUTH; > } > >+ p = getenv("HTTP_PROXY"); >+ if (p == NULL) >+ p = getenv("http_proxy"); >+ if(p != NULL) >+ proxy_url = fetchParseURL(p); >+ if (proxy_url != NULL) { >+ if (proxy_url->port == 0) >+ proxy_url->port = 3183; >+ sprintf(env_HTTP_PROXY, "%s", proxy_url->host); >+ sprintf(proxyport, "%d", proxy_url->port); >+ /* Overrides HTTP_PROXY_AUTH */ >+ proxy_auth_user = proxy_url->user; >+ proxy_auth_pass = proxy_url->pass; >+ } >+ > if ((proxy_auth_user != NULL) && (proxy_auth_pass != NULL)) { > asprintf(&proxy_auth_userpass, "%s:%s", > proxy_auth_user, proxy_auth_pass); >@@ -181,6 +181,9 @@ readenv(void) > } else > proxyauth = NULL; > >+ if (proxy_url != NULL) >+ fetchFreeURL(proxy_url); >+ > env_HTTP_USER_AGENT = getenv("HTTP_USER_AGENT"); > if (env_HTTP_USER_AGENT == NULL) > env_HTTP_USER_AGENT = "phttpget/0.1";
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 129431
:
91915
| 201165