|
2018-04-13
| ||
| 14:03 | • Closed ticket [2b1eaecfae]: http fails under certain circumstances plus 5 ot... artifact: 2f6858f1f5 user: kjnash | |
|
2013-08-13
| ||
| 13:59 | • New ticket [2b1eaecfae]. artifact: 51a60eadb4 user: JKU | |
http fails under certain circumstances
Closed2b1eaecfae3aab675dab7837db3a6fea5bd7d484Created 13 years agoUpdated 9 years ago
Descriptionwiki2013-08-13 13:59:00
The http library may call http::Eof twice under certain circumstances, which leads to a "data error" on the second try to remove the encoding.
% package require http
2.8.5
% proc putargs args {puts $args}
% trace add execution ::http::Eof enter putargs
% http::geturl http://johannes13.de:36895/hgolf.tcl
{Eof ::http::44} enter
{Eof ::http::44} enter
data error
One possible way is if the server
- sends the header "Connection: keep-alive"
- sends the header "Content-Encoding: gzip"
- closes the connection after the request.
Example webserver (I wrote it for code-golf and modified it a bit to match the requirements above):
socket -server a 36895
proc a s\ args {
set h 200\ OK;set c "\nConnection: keep-alive\nContent-Encoding: gzip\nContent-Type: ";set g 0
expr {[regexp {GET (\S*)} [gets $s] - 1]?[file isd [set f /home/$1]]?0:[file exi $f]?[set g 1;file ext $f]in{.txt .html}?[append h $c[dict get {.txt text/plain .html text/html} [file ext $f]]]:[append h ${c}application/octet-stream]:[set h 404\ Not\ Found]:[set h 405\ Not\ Supported]}
puts $s HTTP/1.1\ $h
if $g {flush $s; set h [open $f];set cnt [zlib gzip [read $h]];
puts $s "Content-Length: [string le $cnt]\n"
flush $s
fconfigure $s -translation binary;
puts -nonewline $s $cnt
close $h}
close $s}
kjnashplain2018-04-13 14:03:07
I have verified that this was a bug in http 2.7.10. The attempt to decode content-encoding twice no longer occurs in 2.8.12, and was probably fixed long before that. I'm going to close the bug.
Log in (anonymous is fine) to add a comment.