This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: urllib: open_https generates wrong Authorize header
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: akuchling Nosy List: akuchling, sries
Priority: normal Keywords:

Created on 2003-07-23 21:40 by sries, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Messages (2)
msg17311 - (view) Author: Steffen Ries (sries) Date: 2003-07-23 21:40
When opening an https page which requires
authentication, the "Authorization" header is created
incorrectly by open_https(). open_http() uses the
correct method.

The fix is a simple one line change:

*** /usr/local/lib/python2.2/urllib.py  Fri Oct  4
18:57:01 2002
--- urllib.py   Wed Jul 23 17:23:41 2003
***************
*** 364,370 ****
                  h.putheader('Content-length', '%d' %
len(data))
              else:
                  h.putrequest('GET', selector)
!             if auth: h.putheader('Authorization:
Basic %s' % auth)
              if realhost: h.putheader('Host', realhost)
              for args in self.addheaders:
apply(h.putheader, args)
              h.endheaders()
--- 364,370 ----
                  h.putheader('Content-length', '%d' %
len(data))
              else:
                  h.putrequest('GET', selector)
!             if auth: h.putheader('Authorization',
'Basic %s' % auth)
              if realhost: h.putheader('Host', realhost)
              for args in self.addheaders:
apply(h.putheader, args)
              h.endheaders()
msg17312 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2003-08-29 18:14
Logged In: YES 
user_id=11375

Good catch!  Applied to the CVS trunk and to the 2.3 maintenance 
branch.

Thanks for your bug report.

History
Date User Action Args
2022-04-10 16:10:11adminsetgithub: 38921
2003-07-23 21:40:53sriescreate