|
@@ -260,8 +260,8 @@ static void http_done ( struct http_request *http ) {
|
260
|
260
|
* force an error.
|
261
|
261
|
*/
|
262
|
262
|
if ( ( http->rx_state < HTTP_RX_DATA ) || ( http->chunked != 0 ) ) {
|
263
|
|
- DBGC ( http, "HTTP %p connection closed unexpectedly\n",
|
264
|
|
- http );
|
|
263
|
+ DBGC ( http, "HTTP %p connection closed unexpectedly in state "
|
|
264
|
+ "%d\n", http, http->rx_state );
|
265
|
265
|
http_close ( http, -ECONNRESET );
|
266
|
266
|
return;
|
267
|
267
|
}
|
|
@@ -362,8 +362,9 @@ static int http_rx_response ( struct http_request *http, char *response ) {
|
362
|
362
|
return -EINVAL_RESPONSE;
|
363
|
363
|
http->code = strtoul ( spc, NULL, 10 );
|
364
|
364
|
|
365
|
|
- /* Move to received headers */
|
366
|
|
- http->rx_state = HTTP_RX_HEADER;
|
|
365
|
+ /* Move to receive headers */
|
|
366
|
+ http->rx_state = ( ( http->flags & HTTP_HEAD_ONLY ) ?
|
|
367
|
+ HTTP_RX_TRAILER : HTTP_RX_HEADER );
|
367
|
368
|
return 0;
|
368
|
369
|
}
|
369
|
370
|
|
|
@@ -697,8 +698,7 @@ static int http_rx_header ( struct http_request *http, char *header ) {
|
697
|
698
|
}
|
698
|
699
|
|
699
|
700
|
/* Move to next state */
|
700
|
|
- if ( ( http->rx_state == HTTP_RX_HEADER ) &&
|
701
|
|
- ( ! ( http->flags & HTTP_HEAD_ONLY ) ) ) {
|
|
701
|
+ if ( http->rx_state == HTTP_RX_HEADER ) {
|
702
|
702
|
DBGC ( http, "HTTP %p start of data\n", http );
|
703
|
703
|
http->rx_state = ( http->chunked ?
|
704
|
704
|
HTTP_RX_CHUNK_LEN : HTTP_RX_DATA );
|