diff options
author | Faidon Liambotis <paravoid@debian.org> | 2020-12-23 01:54:14 +0200 |
---|---|---|
committer | Faidon Liambotis <paravoid@debian.org> | 2020-12-23 01:54:14 +0200 |
commit | 1663774bf309fbd196fd2b9c5c2afdd7a25fd288 (patch) | |
tree | 60934613ba832c954ba1db2dd1a77cdd97198515 /test | |
parent | 8d4b3a4fcead0ca534b5d1c5a99ae2a4c95eee21 (diff) |
connect: use ServiceNameOrPort, not Port, as the cache key
The "last connection" cache is currently being stored and looked up on
the combination of (LastHost, LastPort). However, these are not what the
arguments to getaddrinfo() were on the first try: the call is to
getaddrinfo(Host, ServiceNameOrPort, ...), i.e. with the port *or if 0,
the service name* (e.g. http).
Effectively this means that the connection cache lookup for:
https://example.org/... i.e. Host = example.org, Port = 0, Service = http
would end up matching the "last" connection of (if existed):
https://example.org/... i.e. Host = example.org, Port = 0, Service = https
...and thus performing a TLS request over an (unrelated) port 80
connection. Therefore, an HTTP request, followed up by an (unrelated)
HTTPS request to the same server, would always fail.
Address this by using as the cache key the ServiceNameOrPort, rather
than Port.
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions