Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code urlparse.urlparse(self.uri) has problem in twisted-13.10(windows x64) #2

Open
howie1013 opened this issue Nov 2, 2013 · 12 comments

Comments

@howie1013
Copy link

When I set the proxy with server.py and browse https://www.google.com, it outputs the 501 error.
I find the problem is causing by the below

    # when self.uri = www.google.com:443, 
    # parsed is ParseResult(scheme='www.google.com', netloc='', path='443', params='', query='', fragment='')
    parsed = urlparse.urlparse(self.uri) 

And I change the code to below, it runs without any problem.

    uri = self.uri if self.uri.startswith('https://') else 'https://' + self.uri
    parsed = urlparse.urlparse(uri)
@fmoo
Copy link
Owner

fmoo commented Nov 3, 2013

What browser are you using and how have you configured the proxy? I'd like to try to repro and see why the port is getting parsed into the path.

@fmoo
Copy link
Owner

fmoo commented Nov 3, 2013

Also, can you include the value of self.uri before your change? Is it just "www.google.com:443"?

@fmoo
Copy link
Owner

fmoo commented Nov 3, 2013

Or do you have twisted set up in some way to forward the outbound requests through another proxy?

@howie1013
Copy link
Author

I use chrome. I debug it and the value of self.uri is just "www.google.com:443"..

@fmoo
Copy link
Owner

fmoo commented Nov 5, 2013

What version of python are you running? I can't repro ParseResult(scheme='www.google.com', netloc='', path='443', params='', query='', fragment='') with 2.7.3

@fmoo
Copy link
Owner

fmoo commented Nov 5, 2013

I can repro this ParseResult(...) if I add a trailing ?, #, or whitespace after the domain in the CONNECT request. I suspect a \r is leaking through. Possibly a windows-specific thing.

When you debug, can you debug repr(self.uri) instead of self.uri? That will explicitly emit any unprintable characters.

@howie1013
Copy link
Author

What version of python are you running? I can't repro ParseResult(scheme='
www.google.com', netloc='', path='443', params='', query='', fragment='')with 2.7.3

2.7.5

@howie1013
Copy link
Author

When you debug, can you debug repr(self.uri) instead of self.uri? That
will explicitly emit any unprintable characters.

OK.Later I will give you the result.

@fmoo
Copy link
Owner

fmoo commented Nov 10, 2013

Ping. Any updates?

@howie1013
Copy link
Author

the repr(self.uri) is ('uri', "'clients4.google.com:443'")

@fmoo
Copy link
Owner

fmoo commented Nov 11, 2013

How is self.uri a tuple? Are you sure you did a log.msg(repr(self.uri)) in server.py in processConnectRequest()?

Passing a tuple to urlparse() throws AttributeError: 'tuple' object has no attribute 'find'

@howie1013
Copy link
Author

I use print('uri', repr(self.uri))
2013-11-11 PM2:36ÓÚ "Peter Ruibal" [email protected]дµÀ£º

How is self.uri a tuple? Are you sure you did a log.msg(repr(self.uri)) in
server.py in processConnectRequest()?

Passing a tuple to urlparse() throws AttributeError: 'tuple' object has
no attribute 'find'

¡ª
Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-28177458
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants