Skip to content

Commit 4a4da57

Browse files
committed
[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>
1 parent 23b788e commit 4a4da57

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

src/net/tcp/httpcore.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -275,15 +275,9 @@ static void http_close ( struct http_transaction *http, int rc ) {
275275
/* Stop timer */
276276
stop_timer ( &http->timer );
277277

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 );
287281
}
288282

289283
/**
@@ -784,12 +778,9 @@ static int http_transfer_complete ( struct http_transaction *http ) {
784778
}
785779
}
786780

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 );
793784
intf_plug_plug ( &http->transfer, &http->content );
794785
http->len = 0;
795786
assert ( http->remaining == 0 );

0 commit comments

Comments
 (0)