Browse Source

[http] Cleanly shut down potentially looped interfaces

Use intfs_shutdown() and intfs_restart() to cleanly shut down multiple
interfaces that may loop back to the same object.

This fixes a regression introduced by commit daa8ed9 ("[interface]
Provide intf_reinit() to reinitialise nullified interfaces") which
broke the use of HTTP Basic and Digest authentication.

Reported-by: murmansk <murmansk@hotmail.com>
Reported-by: Brett Waldo <brettwaldo@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 7 years ago
parent
commit
4a4da573dd
1 changed files with 6 additions and 15 deletions
  1. 6
    15
      src/net/tcp/httpcore.c

+ 6
- 15
src/net/tcp/httpcore.c View File

@@ -275,15 +275,9 @@ static void http_close ( struct http_transaction *http, int rc ) {
275 275
 	/* Stop timer */
276 276
 	stop_timer ( &http->timer );
277 277
 
278
-	/* Close all interfaces, allowing for the fact that the
279
-	 * content-decoded and transfer-decoded interfaces may be
280
-	 * connected to the same object.
281
-	 */
282
-	intf_shutdown ( &http->conn, rc );
283
-	intf_nullify ( &http->transfer );
284
-	intf_shutdown ( &http->content, rc );
285
-	intf_shutdown ( &http->transfer, rc );
286
-	intf_shutdown ( &http->xfer, rc );
278
+	/* Close all interfaces */
279
+	intfs_shutdown ( rc, &http->conn, &http->transfer, &http->content,
280
+			 &http->xfer, NULL );
287 281
 }
288 282
 
289 283
 /**
@@ -784,12 +778,9 @@ static int http_transfer_complete ( struct http_transaction *http ) {
784 778
 		}
785 779
 	}
786 780
 
787
-	/* Restart content decoding interfaces (which may be attached
788
-	 * to the same object).
789
-	 */
790
-	intf_nullify ( &http->transfer ); /* avoid potential loops */
791
-	intf_restart ( &http->content, http->response.rc );
792
-	intf_restart ( &http->transfer, http->response.rc );
781
+	/* Restart content decoding interfaces */
782
+	intfs_restart ( http->response.rc, &http->content, &http->transfer,
783
+			NULL );
793 784
 	intf_plug_plug ( &http->transfer, &http->content );
794 785
 	http->len = 0;
795 786
 	assert ( http->remaining == 0 );

Loading…
Cancel
Save