You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
urllib2 always sends header connection: close #60147
I have noticed that urllib2 will always send the 'connection: close' in the headers, looking at the code there is no way to override this from outside of the open method.
I am currently working with a server that kills connection upon reading the header, and content will not get served, or only a partial bit of the content gets served, I have tried with several other agents, all are able to download the full content served by the server.
I created a modified version without the 'connection: close' header and that solved the problem for me. I do not always have problems with that header, but I would like the ability to define my own headers, and since the connection: close header gets slapped inside an objects internal method, there is currently no other way I can bypass it.
Activity
sanxiago commentedon Sep 14, 2012
I have noticed that urllib2 will always send the 'connection: close' in the headers, looking at the code there is no way to override this from outside of the open method.
I am currently working with a server that kills connection upon reading the header, and content will not get served, or only a partial bit of the content gets served, I have tried with several other agents, all are able to download the full content served by the server.
I created a modified version without the 'connection: close' header and that solved the problem for me. I do not always have problems with that header, but I would like the ability to define my own headers, and since the connection: close header gets slapped inside an objects internal method, there is currently no other way I can bypass it.
bitdancer commentedon Sep 14, 2012
This is a duplicate of bpo-12849. I'm not sure that we support keep-alive using urllib. We do using httplib, if I understand correctly.