[issue27299] urllib does not splitport while putrequest realhost to HTTP headers

2016-06-18 Thread R. David Murray
R. David Murray added the comment: httplib (which is what you are actually calling in your example) does not interpret headers set with putheader. It is the application's responsibility to get the header contents correct. As Xiang said, this looks like a server side issue. -- nosy:

[issue27299] urllib does not splitport while putrequest realhost to HTTP headers

2016-06-12 Thread Xiang Zhang
Xiang Zhang added the comment: It's server side behaviour. Asking here may not get results. I think it's normal for the server to return error if it thinks the header is invalid. -- ___ Python tracker

[issue27299] urllib does not splitport while putrequest realhost to HTTP headers

2016-06-11 Thread gr zhang
gr zhang added the comment: Yes, I mean when set h.putheader('Host', "www.github.com:443") and the status code from httplib will be 405 while when set h.putheader('Host', "www.github.com") the code will be 200, this is confused to me. -- ___ Python

[issue27299] urllib does not splitport while putrequest realhost to HTTP headers

2016-06-11 Thread Xiang Zhang
Xiang Zhang added the comment: The standard[1] says the Host header is OK to include port. Why not use 'https://www.github.com'? [1] https://tools.ietf.org/html/rfc7230#section-5.4 -- nosy: +xiang.zhang ___ Python tracker

[issue27299] urllib does not splitport while putrequest realhost to HTTP headers

2016-06-11 Thread gr zhang
New submission from gr zhang: h.putheader('Host', "www.github.com:443") # this will make errcode 405, if urllib lib splitport first, and this will set Host ---> www.github.com and get 200 code. h.endheaders(None) errcode, errmsg, headers = h.getreply() print errcode -- comp