[oe-commits] [bitbake] 04/04: wget: fix FusionForge workaround

git at git.openembedded.org git at git.openembedded.org
Sun Jul 30 15:24:51 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit bb70ae0c9aac5ec688026d23a64ac0cac1947187
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Sat Jul 29 18:23:33 2017 +0100

    wget: fix FusionForge workaround
    
    My previous assertion about FusionForge appears to have been wrong, or
    FusionForge has changed behaviour, or both.
    
    FusionForge now mandates that downloads have the Accept header set, despite that
    header being optional, and returns a 406 Not Acceptable error if it isn't set.
    As we were pretending that 406 was actually 405 (Moved) and tried to handle it as a
    redirect this results in an infinite loop until Python kills the recursion.
    
    Delete the handling of 406 as 405, and pass Accept: */* in the headers.
    
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/fetch2/wget.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py
index 8ee9769..7c49c2b 100644
--- a/lib/bb/fetch2/wget.py
+++ b/lib/bb/fetch2/wget.py
@@ -283,11 +283,6 @@ class Wget(FetchMethod):
             """
             http_error_403 = http_error_405
 
-            """
-            Some servers (e.g. FusionForge) returns 406 Not Acceptable when they
-            actually mean 405 Method Not Allowed.
-            """
-            http_error_406 = http_error_405
 
         class FixedHTTPRedirectHandler(urllib.request.HTTPRedirectHandler):
             """
@@ -316,7 +311,9 @@ class Wget(FetchMethod):
             uri = ud.url.split(";")[0]
             r = urllib.request.Request(uri)
             r.get_method = lambda: "HEAD"
-
+            # Some servers (FusionForge, as used on Alioth) require that the
+            # optional Accept header is set.
+            r.add_header("Accept", "*/*")
             def add_basic_auth(login_str, request):
                 '''Adds Basic auth to http request, pass in login:password as string'''
                 import base64

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list