Re: Urllib2: Only a partial page retrieved

2010-05-23 Thread hpsMouse
On 5月22日, 下午5时43分, Dragon Lord  wrote:
> The cutoff is allways at the same location: just after the label
> "Meeting date" and before the date itself. Could it be that something
> is interpreted as and eof command or something like that?
>
> example of the cutoff point with a bad page:
> Meeting Date: 
>
> example of the cutoff point with a good page:
> Meeting Date: 

I checked TCP packages, and found that the remote HTTP server send a
data package with flag "PUSH", causing the client to close connection.
That is exactly where the "Meeting Date: " appears.
This seems not to be a bug for python, because Qt and telnet both
failed in my test, so did the wget program...
Most browsers use keep-alive HTTP, so the connection won't be closed.
I think that's why a browser show the page correctly.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Urllib2: Only a partial page retrieved

2010-05-23 Thread hpsMouse
I know what the problem is.

Server checks client's locale setting to determine how the date should
be displayed. Python don't send locale information by default. So
server fails at that point.

If you add the following field in the HTTP request, the response will
be correct:
Accept-Language: en
-- 
http://mail.python.org/mailman/listinfo/python-list