Overview
| Artifact ID: | 8c5b29629756779fe64ab9e9f38b8f81913cbe12c1be61802113bb7fb6d502dd |
|---|---|
| Ticket: | a976e76bafee1943af1045e0f7d8b87b72afece3
http: endToEndProxy without useSockThread bypasses the proxy |
| User & Date: | serhiy.storchaka on 2026-10-14 13:42:29 |
Changes
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
<nowiki>[http::register]</nowiki> documents <i>useSockThread</i> and <i>endToEndProxy</i> as independent options, but <i>endToEndProxy</i> only works when <i>useSockThread</i> is also true. Otherwise the request does not go through the configured proxy at all: http connects directly to the target server. <verbatim> package require http namespace eval my {variable socketCmd ::socket} proc mysock {args} {puts "openCmd: $args"; $::my::socketCmd {*}$args} http::register xs 443 mysock ::my::socketCmd 0 1 http::config -proxyhost 127.0.0.1 -proxyport 3128 http::geturl xs://example.invalid/ </verbatim> This prints <tt>openCmd: -async example.invalid 443</tt> and fails with <tt>couldn't open socket: Name or service not known</tt>: it tries to connect to the target host directly instead of to the proxy. With <tt>... ::my::socketCmd 1 1</tt> it sends <tt>CONNECT example.invalid:443</tt> to the proxy as expected. The cause: http::geturl passes <tt>-type $token</tt> to the socket command only if <i>useSockThread</i> is true (library/http/http.tcl, <tt>if {$useSockThread}</tt> before <tt>set state(openCmd)</tt>). Without the token, http::socketAsCallback cannot see state(protoProxyConn), treats the connection as not proxied and calls http::AltSocket. - foundin changed to: "9.0.5, 9.1.0"
- login: "serhiy.storchaka"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- severity changed to: "Important"
- status changed to: "Open"
- submitter changed to: "serhiy.storchaka"
- subsystem changed to: "29. http Package"
- title changed to:
http: endToEndProxy without useSockThread bypasses the proxy
- type changed to: "Bug"