Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5503

basic_proxy_auth_header in THttpClient.py needs to be a byte string

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Duplicate
    • None
    • None
    • Python - Library
    • None

    Description

      Please be gentle I'm really new and am trying to follow the guidelines best I can.

       

      https://github.com/apache/thrift/blob/febc5121ea425d92623512367d7e365c13be31c4/lib/py/src/transport/THttpClient.py#L99

       

      In this line 

       

       

      ap = "%s:%s" % (urllib.parse.unquote(proxy.username),                     urllib.parse.unquote(proxy.password))        
      
      cr = base64.b64encode(ap).strip() 

       

       

      ap returns a string, but b64encode needs bytes and returns bytes. I don't know if this is a change

       

      the fix is pretty trivial:

       

              ap = ("%s:%s" % (urllib.parse.unquote(proxy.username),                        urllib.parse.unquote(proxy.password))).encode("UTF-8")
              cr = base64.standard_b64encode(ap).strip().decode("UTF-8")

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            jondufault Jonahan Dufault
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: