[issue25539] python3 fail on parsing http header
Shin Dong-won added the comment: Yeah, this is server's fault and python does not have to deal with non-standard cases. I'll close this issue. Thanks! -- status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25539> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25539] python3 fail on parsing http header
Shin Dong-won added the comment: I had a mistake. That's not CRLF but just two '\n'. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25539> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25539] python3 fail on parsing http header
Shin Dong-won added the comment: I found that Python3 no more uses header format from rfc822, and the data b'P3P : CP="ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC"\r\n' not match with `headerRE = re.compile(r'^(From |[\041-\071\073-\176]*:|[\t ])')` so it makes problem. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25539> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25539] python3 fail on parsing http header
Shin Dong-won added the comment: b'Date: Tue, 03 Nov 2015 10:05:42 GMT\nServer: Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/0.9.8e-fips-rhel5 DAV/2\n PHP/5.2.16 mod_fastcgi/2.4.6\nX-Powered-By: PHP/5.2.16\nP3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM\n PRE"\n\nP3P : CP="ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC"\nSet-Cookie: PHPSESSID=**; path=/\nSet-Cookie: PHPSESSID=**; path=/\nContent-Length: 79\nConnection: close\nContent-Type: text/html\n\n' There's no other characters except CRLF. And other weird result, in python2 there are no two CRLF between P3P:~. Here's gist for test. (https://gist.github.com/littmus/9625a4436e1edfb3afe9) -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25539> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25539] python3 fail on parsing http header
Shin Dong-won added the comment: I think so but same http request works well in Python2 -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25539> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue25539] python3 fail on parsing http header
Shin Dong-won added the comment: I monkey patched the method `parse_headers` to print what the fp read and finally arrived at that http.client is not a problem. email.parser.Parser.parsestr adds two '\n' between two lines of "P3P: ~~". end: b'POST /bbs/login_check.php HTTP/1.1\r\nHost: www.koreapas.com\r\nAccept-Encoding: identity\r\nContent-Length: 31\r\nUser-Agent: Mozilla/5.0 (Linux; Android 4.2.2; GT-I9505 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.59 Mobile Safari/537.36\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\nuser_id=blahsdfi=qwera' reply: 'HTTP/1.1 200 OK\r\n' b'Date: Tue, 03 Nov 2015 11:23:16 GMT\r\n' b'Server: Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.16 mod_fastcgi/2.4.6\r\n' b'X-Powered-By: PHP/5.2.16\r\n' b'P3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM PRE"\r\n' b'P3P : CP="ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC"\r\n' b'Set-Cookie: PHPSESSID=e990184309013a2c97579c76a52e203a; path=/\r\n' b'Content-Length: 1504\r\n' b'Connection: close\r\n' b'Content-Type: text/html\r\n' b'\r\n' ## hstring Date: Tue, 03 Nov 2015 11:23:16 GMT Server: Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.16 mod_fastcgi/2.4.6 X-Powered-By: PHP/5.2.16 P3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM PRE" P3P : CP="ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC" Set-Cookie: PHPSESSID=e990184309013a2c97579c76a52e203a; path=/ Content-Length: 1504 Connection: close Content-Type: text/html ## ### parsed b'Date: Tue, 03 Nov 2015 11:23:16 GMT\nServer: Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/0.9.8e-fips-rhel5 DAV/2\n PHP/5.2.16 mod_fastcgi/2.4.6\nX-Powered-By: PHP/5.2.16\nP3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM\n PRE"\n\nP3P : CP="ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC"\nSet-Cookie: PHPSESSID=e990184309013a2c97579c76a52e203a; path=/\nContent-Length: 1504\nConnection: close\nContent-Type: text/html\n\n' ### -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25539> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com