Opened 16 years ago
Closed 15 years ago
#326 closed defect (wontfix)
Invalid parsing of urls containing login credentials
Reported by: | awhitaker@… | Owned by: | cmlenz |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Build slave | Version: | 0.5.3 |
Keywords: | Cc: | osimons | |
Operating System: | Windows |
Description
It appears as though bitten-slave has trouble parsing URIs containing the "user:pass@" syntax. I've included a reproduction case as well as the call stack which will hopefully make it fairly easy to resolve.
bitten-slave https://user:pass@server/trac/project/builds
This command line generates the following call-stack:
D:\>bitten-slave https://user:pass@server/trac/project/builds Traceback (most recent call last):
File "C:\Python25\Scripts\bitten-slave-script.py", line 8, in <module>
load_entry_point('bitten==0.6dev-r559', 'console_scripts', 'bitten-slave')()
File "c:\python25\lib\site-packages\bitten-0.6dev_r559-py2.5.egg\bitten\slave.py", line 398, in main
exit_code = slave.run()
File "c:\python25\lib\site-packages\bitten-0.6dev_r559-py2.5.egg\bitten\slave.py", line 160, in run
job_done = self._create_build(url)
File "c:\python25\lib\site-packages\bitten-0.6dev_r559-py2.5.egg\bitten\slave.py", line 203, in _create_build
'Content-Type': 'application/x-bitten+xml'
File "c:\python25\lib\site-packages\bitten-0.6dev_r559-py2.5.egg\bitten\slave.py", line 137, in request
return self.opener.open(req)
File "C:\Python25\Lib\urllib2.py", line 374, in open
response = self._open(req, data)
File "C:\Python25\Lib\urllib2.py", line 392, in _open
'_open', req)
File "C:\Python25\Lib\urllib2.py", line 353, in _call_chain
result = func(*args)
File "C:\Python25\Lib\urllib2.py", line 1108, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "C:\Python25\Lib\urllib2.py", line 1057, in do_open
h = http_class(host) # will parse host:port
File "C:\Python25\Lib\httplib.py", line 1122, in init
HTTPConnection.init(self, host, port, strict)
File "C:\Python25\Lib\httplib.py", line 635, in init
self._set_hostport(host, port)
File "C:\Python25\Lib\httplib.py", line 647, in _set_hostport
raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
httplib.InvalidURL: nonnumeric port: 'pass@server'
Attachments (0)
Change History (2)
comment:1 Changed 15 years ago by osimons
- Cc osimons added
comment:2 Changed 15 years ago by osimons
- Milestone 0.6 deleted
- Resolution set to wontfix
- Status changed from new to closed
Nope, the URL can't be used by Python urllib2 and as perfectly good alternatives exists with -u and -p options, I don't think Bitten should add code to handle this. I'm closing this ticket as wontfix but please reopen if someone spots a reasonable way of doing this (and see value in supporting the syntax).
I don't think Python urllib2 or httplib are made to use that type of URL. They depend on separate auth classes ('handlers') that knows how to deal with each specific kind of authentication mechanism, and the input for this needs to come through the --user and --password arguments.
However, even if the slave managed to pass that URL along to the master, it still would not automatically use it unless the master was configured to enforce authentication on that URL - which is the topic of #208.