aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/t-http.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-09-26 10:33:09 +0000
committerWerner Koch <[email protected]>2023-09-26 12:19:26 +0000
commita5e33618f4211557e60c1b2d013ea8c8d1923e46 (patch)
treec81e5ab527ccfb8f614f8050acd5d0b199c8b7db /dirmngr/t-http.c
parentcommon: Add gnupg_memstr to replace static versions. (diff)
downloadgnupg-a5e33618f4211557e60c1b2d013ea8c8d1923e46.tar.gz
gnupg-a5e33618f4211557e60c1b2d013ea8c8d1923e46.zip
dirmngr: Fix handling of the HTTP Content-Length
* dirmngr/http.c (cookie_s): Add fields pending, up_to_empty_line, last_was_lf, and last_was_lfcr. (http_context_s): Add field keep-alive. (http_wait_response): Set up_to_empty_line. Take care of keep_alive flag. (coookie_read): Implement detection of empty lines. (cookie_write): Free the pending buffer. -- The problem we fix here is that we already buffered stuff beyond the empty line which marks the start of the content-length counting. Thus we tried to wait for more bytes despite that everything had already been read. This bug might have showed up more often in the real world since the we changed the BUFSIZ on Windows from 512 byte to 8k. It also depends on the length of the headers and whether the server closed the connection so that we ignored the Content-Length. The bug was introduced earlier than 2010 and could have the effect that a connection got stuck until the network layer timed out. Note that the keep-alive parts of the patch are not yet used.
Diffstat (limited to 'dirmngr/t-http.c')
0 files changed, 0 insertions, 0 deletions