Created on 2016-06-12 04:10 by gr zhang, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Files |
|
|
|
File name |
Uploaded |
Description |
Edit |
urllib_part.py |
gr zhang,2016-06-12 04:10 |
|
|
Messages (5) |
|
|
msg268317 - (view) |
Author: gr zhang (gr zhang) |
Date: 2016-06-12 04:10 |
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 |
|
|
msg268318 - (view) |
Author: Xiang Zhang (xiang.zhang) *  |
Date: 2016-06-12 04:27 |
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 |
|
|
msg268326 - (view) |
Author: gr zhang (gr zhang) |
Date: 2016-06-12 05:07 |
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. |
|
|
msg268357 - (view) |
Author: Xiang Zhang (xiang.zhang) *  |
Date: 2016-06-12 10:07 |
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. |
|
|
msg268827 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2016-06-18 19:30 |
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. |
|
|
History |
|
|
|
Date |
User |
Action |
Args |
2022-04-11 14:58:32 |
admin |
set |
github: 71486 |
2016-06-18 19:30:11 |
r.david.murray |
set |
status: open -> closednosy: + r.david.murraymessages: + resolution: not a bugstage: resolved |
2016-06-12 10:07:08 |
xiang.zhang |
set |
messages: + |
2016-06-12 05:07:58 |
gr zhang |
set |
messages: + |
2016-06-12 04:27:37 |
xiang.zhang |
set |
nosy: + xiang.zhangmessages: + |
2016-06-12 04:10:49 |
gr zhang |
create |
|