Artifact
e33e69f6c15afd36f827c1260fca417f94f63eac:
Ticket change
[e33e69f6c1]
- New ticket
[1173760fffffffff|1173760fff] <i>geturl fails on https requests if a proxy server is used</i>.
by
melissachawla on
2005-03-31 01:40:24.
D 2005-03-31T01:40:24
J assignee hobbs
J cmimetype text/plain
J comment Package\srequire\shttp\nI\stried\sto\suse\shttp::geturl\son\san\shttps\surl\swith\sa\sproxy\s\nserver,\sand\sI\skept\sgetting\stimeouts\s(or\sran\sforever\swhen\s\nno\stimeout\swas\sspecified).\n\npackage\srequire\shttp\npackage\srequire\stls\nhttp::config\s-proxyhost\s<my-squid-host>\s-proxyport\s<my-\nsquid-port>\s\nhttp::register\shttps\s443\s::tls::socket\shttp::geturl\s\nhttps://<server>:443/<path>\s-timeout\s30000\n\nCurrently,\sthe\shttp\spackage\swill\suse\sa\sGET\srequest\svia\s\nHTTPS\sto\sa\sweb\sserver\soutside\smy\sfirewall\svia\sa\sweb\s\nproxy\sserver\sinside\smy\sfirewall.\s\sI\sam\ssure\sthat\sthe\sweb\nproxy\sserver\sworks\sbecause\sI\scan\suse\sit\sto\smake\sthe\s\nsame\srequest\sthrough\smy\sbrowser.\s\sThe\sproblem\sis\sthat\s\nhttp\spackage\sneeds\sto\smake\sa\s"CONNECT"\srequest\sto\s\nthe\sproxy\sbefore\smaking\sthe\sGET\srequest.\s\sI\sbelieve\sthat\s\nhttp\sversion\s2.4\sis\saffected\sin\sthe\ssame\sway.\s\sHere's\sa\s\ndescription\sof\sthe\sfix\sthat\sI\sused:\n\n1)\sreplace\sthe\sfollowing\sline\sin\shttp.tcl:\n\n\s\s\s\s\s\s\s\sset\sconStat\s[catch\s{eval\s$defcmd\s$async\s{$phost\s\n$pport}}\ss]\n\nwith:\n\n\s\s\s\s\s\s\s\sif\s{[string\sequal\s-nocase\s$proto\s"https"]\s\\\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s&&\s[string\smatch\s"*tls::socket"\s$defcmd]}\s{\n\s\s\s\s\s\s\s\s\s\s\s\s#\sUse\s"connect"\sto\sinitiate\shttps\sconnection\svia\s\nweb\sproxy.\s\n\s\s\s\s\s\s\s\s\s\s\s\sset\sconStat\s[catch\s{SecureProxyConnect\s\n$phost\s$pport\s$host\s$port}\ss]\n\s\s\s\s\s\s\s\s}\selse\s{\n\s\s\s\s\s\s\s\s\s\s\s\sset\sconStat\s[catch\s{eval\s$defcmd\s$async\s\n{$phost\s$pport}}\ss]\n\s\s\s\s\s\s\s\s}\n\n2)\sAdd\sthe\sSecureProxyConnect\sprocedure:\n\n#\sInternal\sprocedure\sto\sinitiate\shttps\sconnection\svia\s\nproxy\sserver.\nproc\shttp::SecureProxyConnect\s{proxyserver\sproxyport\s\nwebserver\swebserverport}\s{\n\s\s\s\s\sset\ssock\s[socket\s$proxyserver\s$proxyport]\n\s\s\s\s\sfconfigure\s$sock\s-blocking\s0\s-buffering\sline\s-\ntranslation\scrlf\n\n\s\s\s\s\sputs\s$sock\s"CONNECT\s$webserver:$webserverport\s\nHTTP/1.1"\n\s\s\s\s\sputs\s$sock\s"Host:\s$webserver"\n\s\s\s\s\sputs\s$sock\s"User-Agent:\s[http::config\s-useragent]"\n\s\s\s\s\sputs\s$sock\s"Proxy-Connection:\skeep-alive"\n\s\s\s\s\sputs\s$sock\s"Connection:\skeep-alive"\n\s\s\s\s\sputs\s$sock\s""\n\n\s\s\s\s\sfileevent\s$sock\sreadable\s{set\sproxy_readable\s""}\n\s\s\s\s\sglobal\sproxy_readable\n\s\s\s\s\svwait\sproxy_readable\n\s\s\s\s\sfileevent\s$sock\sreadable\s{}\n\n\s\s\s\s\sset\sblock\s[read\s$sock]\n\s\s\s\s\sset\sresult\s[lindex\s[split\s$block\s\\n]\s0]\n\s\s\s\s\sset\scode\s[lindex\s[split\s$result\s{\s}]\s1]\n\s\s\s\s\sfconfigure\s$sock\s-blocking\s1\s-translation\sbinary\s-\nbuffering\snone\n\n\s\s\s\s\sif\s{$code\s>=\s200\s&&\s$code\s<\s300}\s{\n\s\s\s\s\s\s\s\s\stls::import\s$sock\n\s\s\s\s\s}\selse\s{\n\s\s\s\s\s\s\s\s\serror\s"proxy\sconnect\sfailed:\s$block"\n\s\s\s\s\s}\n\s\s\s\s\sreturn\s$sock\n}\n
J foundin obsolete:\s8.3.4
J priority 5\sMedium
J resolution None
J status Open
J submitter melissachawla
J subsystem 29.\shttp\sPackage
J title geturl\sfails\son\shttps\srequests\sif\sa\sproxy\sserver\sis\sused
J type Bug
K 1173760fffffffffffffffffffffffffffffffff
U melissachawla
Z 6461ce4d401e2ab5fb692f2b9a2ddc57