Artifact
51a60eadb4629e1fdff0624783ddb93f3a48d9b3:
Ticket change
[51a60eadb4]
- New ticket
[2b1eaecfae3aab67|2b1eaecfae] <i>http fails under certain circumstances</i>.
by
JKU on
2013-08-13 13:59:00.
D 2013-08-13T13:59:00.781
J assignee nobody
J closer nobody
J cmimetype text/x-fossil-wiki
J comment The\shttp\slibrary\smay\scall\shttp::Eof\stwice\sunder\scertain\scircumstances,\swhich\sleads\sto\sa\s"data\serror"\son\sthe\ssecond\stry\sto\sremove\sthe\sencoding.\r\n\r\n<verbatim>\r\n%\spackage\srequire\shttp\r\n2.8.5\r\n%\sproc\sputargs\sargs\s{puts\s$args}\r\n%\strace\sadd\sexecution\s::http::Eof\senter\sputargs\r\n%\shttp::geturl\shttp://johannes13.de:36895/hgolf.tcl\r\n{Eof\s::http::44}\senter\r\n{Eof\s::http::44}\senter\r\ndata\serror\r\n</verbatim>\r\n\r\nOne\spossible\sway\sis\sif\sthe\sserver\r\n\r\n\s\s*\s\ssends\sthe\sheader\s"Connection:\skeep-alive"\r\n\s\s*\s\ssends\sthe\sheader\s"Content-Encoding:\sgzip"\r\n\s\s*\s\scloses\sthe\sconnection\safter\sthe\srequest.\r\n\r\nExample\swebserver\s(I\swrote\sit\sfor\scode-golf\sand\smodified\sit\sa\sbit\sto\smatch\sthe\srequirements\sabove):\r\n\r\n<verbatim>\r\nsocket\s-server\sa\s36895\r\nproc\sa\ss\\\sargs\s{\r\nset\sh\s200\\\sOK;set\sc\s"\\nConnection:\skeep-alive\\nContent-Encoding:\sgzip\\nContent-Type:\s";set\sg\s0\r\nexpr\s{[regexp\s{GET\s(\\S*)}\s[gets\s$s]\s-\s1]?[file\sisd\s[set\sf\s/home/$1]]?0:[file\sexi\s$f]?[set\sg\s1;file\sext\s$f]in{.txt\s.html}?[append\sh\s$c[dict\sget\s{.txt\stext/plain\s.html\stext/html}\s[file\sext\s$f]]]:[append\sh\s${c}application/octet-stream]:[set\sh\s404\\\sNot\\\sFound]:[set\sh\s405\\\sNot\\\sSupported]}\r\nputs\s$s\sHTTP/1.1\\\s$h\r\nif\s$g\s{flush\s$s;\s\sset\sh\s[open\s$f];set\scnt\s[zlib\sgzip\s[read\s$h]];\r\nputs\s$s\s"Content-Length:\s[string\sle\s$cnt]\\n"\r\nflush\s$s\r\nfconfigure\s$s\s-translation\sbinary;\r\nputs\s-nonewline\s$s\s$cnt\r\nclose\s$h}\r\nclose\s$s}\r\n</verbatim>
J foundin Tcl\s8.6.0\shttp\s2.8.5
J is_private 0
J login JKU
J priority 5\sMedium
J resolution None
J severity Minor
J status Open
J submitter JKU
J subsystem 29.\shttp\sPackage
J title http\sfails\sunder\scertain\scircumstances
J type Bug
K 2b1eaecfae3aab675dab7837db3a6fea5bd7d484
U JKU
Z 2eaa4e9c1059294430091152d0e2f1d8