1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
putty-source/proxy
Simon Tatham 81dcbd6267 Proxy: discard buffered input data on reconnection.
When talking to a web proxy which requires a password, our HTTP proxy
code sends an initial attempt to connect without authentication,
receives the 407 status indicating that authentication was required
(and which kind), and then closes and reopens the connection (if given
"Connection: close"). Then, on the next attempt, we try again with
authentication, and expect the first thing in the input bufchain to be
the HTTP status response to the revised request.

But what happened about the error document that followed those HTTP
headers? It - or at least some of it - would already have been in the
input bufchain.

With an HTTP/1.1 proxy, we already read it and discarded it (either
via a Content-length header or chunked transfer encoding), before we
set the 'reconnect' flag. So, assuming the proxy HTTP server is
behaving sensibly, our input bufchain ought to be empty at the point
when we start the fresh connection.

But if the proxy only speaks HTTP/1.0 (which does still happen -
'tinyproxy' is a still-current example), then we didn't get a
Content-length header either, so we didn't run any of the code that
skips over the error document. (And HTTP/1.0 implicitly has
"Connection: close" semantics, which is why that doesn't matter.) As a
result, some of it would still be in the input bufchain, and never got
cleared out, and we'd try to parse _that_ as if it was the HTTP
response from the second network connection.

The simple solution is that when we close and reopen the proxy network
connection, we also clear the input bufchain, so that the fresh
connection starts from a clean slate.
2022-05-18 12:55:34 +01:00
..
cproxy.c Withdraw support for SHA-512-256 in HTTP Digest. 2021-11-27 11:41:00 +00:00
cproxy.h HTTP proxy: correctly handle multiple auth headers. 2021-12-21 09:36:25 +00:00
http.c HTTP proxy: accept Digest algorithm name as a quoted string. 2022-02-19 12:51:59 +00:00
interactor.c Fix trust status when Interactor returns a seat. 2022-03-12 21:05:07 +00:00
local.c Richer data type for interactive prompt results. 2021-12-28 18:08:31 +00:00
nocproxy.c Withdraw support for SHA-512-256 in HTTP Digest. 2021-11-27 11:41:00 +00:00
noproxy.c Pass an Interactor to new_connection(). 2021-10-30 18:19:56 +01:00
nosshproxy.c Pass an Interactor to new_connection(). 2021-10-30 18:19:56 +01:00
pproxy.c Pass an Interactor to platform_new_connection. 2021-12-22 15:24:58 +00:00
proxy.c Proxy: discard buffered input data on reconnection. 2022-05-18 12:55:34 +01:00
proxy.h Proxy system: ability to reconnect to the proxy server. 2022-02-19 12:51:59 +00:00
socks4.c Reorganise proxy system into coroutines. 2021-11-19 15:09:17 +00:00
socks5.c proxy_socks5_free: fix inadequate smemclr. 2022-01-29 18:24:31 +00:00
socks.h Pull out SOCKS protocol constants into a header. 2021-11-19 15:09:17 +00:00
sshproxy.c sshproxy.c: remember to call prepare_session(). 2022-04-29 16:41:18 +01:00
telnet.c Richer data type for interactive prompt results. 2021-12-28 18:08:31 +00:00