mirror of https://github.com/ipxe/ipxe.git
[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>
pull/598/head
parent
1170a36e6b
commit
8f7cd88af5
|
@ -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 );
|
||||
|
|
Loading…
Reference in New Issue