diff options
author | Michael Brown <mcb30@ipxe.org> | 2012-08-17 18:00:40 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2012-08-17 18:00:40 +0100 |
commit | 8f7cd88af543b0b95e4f6663251ba9d392389b8b (patch) | |
tree | 800ff42d5dc0a613d6b565407a1220be14e1c42c /src/net/tcp | |
parent | 1170a36e6bb8091a638c815a17c2ec43715ad0a3 (diff) | |
download | ipxe-8f7cd88af543b0b95e4f6663251ba9d392389b8b.tar.gz |
[http] Fix HTTP SAN booting
Commit 501527d ("[http] Treat any unexpected connection close as an
error") introduced a regression causing HTTP SAN booting to fail. At
the end of the response to the HEAD request, the call to http_done()
would erroneously believe that the server had disconnected in the
middle of the HTTP headers.
Fix by treating the header block from a HEAD request as a trailer
block. This fixes the problem and also simplifies the logic in
http_rx_header().
Reported-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/tcp')
-rw-r--r-- | src/net/tcp/httpcore.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/net/tcp/httpcore.c b/src/net/tcp/httpcore.c index 534e5a78..7f178cc8 100644 --- a/src/net/tcp/httpcore.c +++ b/src/net/tcp/httpcore.c @@ -260,8 +260,8 @@ static void http_done ( struct http_request *http ) { * force an error. */ if ( ( http->rx_state < HTTP_RX_DATA ) || ( http->chunked != 0 ) ) { - DBGC ( http, "HTTP %p connection closed unexpectedly\n", - http ); + DBGC ( http, "HTTP %p connection closed unexpectedly in state " + "%d\n", http, http->rx_state ); http_close ( http, -ECONNRESET ); return; } @@ -362,8 +362,9 @@ static int http_rx_response ( struct http_request *http, char *response ) { return -EINVAL_RESPONSE; http->code = strtoul ( spc, NULL, 10 ); - /* Move to received headers */ - http->rx_state = HTTP_RX_HEADER; + /* Move to receive headers */ + http->rx_state = ( ( http->flags & HTTP_HEAD_ONLY ) ? + HTTP_RX_TRAILER : HTTP_RX_HEADER ); return 0; } @@ -697,8 +698,7 @@ static int http_rx_header ( struct http_request *http, char *header ) { } /* Move to next state */ - if ( ( http->rx_state == HTTP_RX_HEADER ) && - ( ! ( http->flags & HTTP_HEAD_ONLY ) ) ) { + if ( http->rx_state == HTTP_RX_HEADER ) { DBGC ( http, "HTTP %p start of data\n", http ); http->rx_state = ( http->chunked ? HTTP_RX_CHUNK_LEN : HTTP_RX_DATA ); |