Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 72451 Details for
Bug 61845
[PATCH] --getbinpkg doesn't support $http_proxy
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
The corrected proposed patch...
proxy2.patch (text/plain), 3.21 KB, created by
André Luiz A. G. Carvalho
on 2005-11-08 06:01:16 UTC
(
hide
)
Description:
The corrected proposed patch...
Filename:
MIME Type:
Creator:
André Luiz A. G. Carvalho
Created:
2005-11-08 06:01:16 UTC
Size:
3.21 KB
patch
obsolete
>--- getbinpkg.py.beforeme 2005-09-27 18:54:17.000000000 -0300 >+++ getbinpkg.py 2005-11-08 11:56:09.000000000 -0200 >@@ -111,11 +111,26 @@ > ), > } > >+ port = None >+ proxy_host = os.environ.get("http_proxy") >+ if proxy_host: >+ # Do not send user/password here >+ address = protocol + "://" + host + address >+ hostport = string.split(proxy_host, ":") >+ if len(hostport) > 2: >+ raise ValueError, "Unable to interpret proxy:port from http_proxy." >+ elif len(hostport) == 2: >+ host = hostport[0] >+ port = hostport[1] >+ elif len(hostport) == 1: >+ host = hostport[0] >+ del hostport, proxy_host >+ > if not conn: > if protocol == "https": >- conn = httplib.HTTPSConnection(host) >+ conn = httplib.HTTPSConnection(host, port) > elif protocol == "http": >- conn = httplib.HTTPConnection(host) >+ conn = httplib.HTTPConnection(host, port) > elif protocol == "ftp": > passive = 1 > if(host[-1] == "*"): >@@ -181,7 +196,7 @@ > return None,int(str(e)[:4]),str(e) > > >-def make_http_request(conn, address, params={}, headers={}, dest=None): >+def make_http_request(conn, address, params={}, headers={}, dest=None, method="GET"): > """(conn,address,params,headers) --- uses the conn object to request > the data from address, performing Location forwarding and using the > optional params and headers.""" >@@ -192,7 +207,7 @@ > try: > if (rc != 0): > conn,ignore,ignore,ignore,ignore = create_conn(address) >- conn.request("GET", address, params, headers) >+ conn.request(method, address, params, headers) > except SystemExit, e: > raise > except Exception, e: >@@ -224,6 +239,8 @@ > dest.write(response.read()) > return "",0,"" > >+ if method != "GET": >+ return response,0,"" > return response.read(),0,"" > > >@@ -303,7 +320,7 @@ > > return listing > >-def file_get_metadata(baseurl,conn=None, chunk_size=3000): >+def file_get_metadata(baseurl,conn=None, chunk_size=3000, file_size=-1): > """(baseurl[,connection]) -- Takes a base url to connect to and read from. > URL should be in the for <proto>://<site>[:port]<path> > Connection is used for persistent connection instances.""" >@@ -316,8 +333,19 @@ > conn,protocol,address,params,headers = create_conn(baseurl, conn) > > if protocol in ["http","https"]: >- headers["Range"] = "bytes=-"+str(chunk_size) >- data,rc,msg = make_http_request(conn, address, params, headers) >+ if file_size==-1: >+ data,rc,msg = make_http_request(conn, address, params, headers, method="HEAD") >+ if data: >+ file_size = int(data.getheader("content-length")) >+ del data >+ # If it's still -1, we were unable to get file_size, fallback to old method >+ if file_size==-1: >+ headers["Range"] = "bytes=-"+str(chunk_size) >+ data,rc,msg = make_http_request(conn, address, params, headers) >+ else: >+ headers["Range"] = "bytes="+str(file_size-chunk_size)+"-" >+ data,rc,msg = make_http_request(conn, address, params, headers) >+ > elif protocol in ["ftp"]: > data,rc,msg = make_ftp_request(conn, address, -chunk_size) > else: >@@ -326,7 +354,7 @@ > if data: > xpaksize = xpak.decodeint(data[-8:-4]) > if (xpaksize+8) > chunk_size: >- myid = file_get_metadata(baseurl, conn, (xpaksize+8)) >+ myid = file_get_metadata(baseurl, conn, (xpaksize+8), file_size) > if not keepconnection: > conn.close() > return myid
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 61845
:
69378
| 72451