diff options
author | Michael Brown <mcb30@ipxe.org> | 2017-02-02 16:52:55 +0000 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2017-02-02 16:58:00 +0000 |
commit | 4a4da573dd8ffabff881ee52c2d1151c15d1730e (patch) | |
tree | 062c1fca0637d818a89c13b2a324fbe83acd99a7 /src/net/tcp | |
parent | 23b788e5cdd7fcfa863a476a1448870ac3cf0103 (diff) | |
download | ipxe-4a4da573dd8ffabff881ee52c2d1151c15d1730e.tar.gz |
[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>
Diffstat (limited to 'src/net/tcp')
-rw-r--r-- | src/net/tcp/httpcore.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/net/tcp/httpcore.c b/src/net/tcp/httpcore.c index 27cc50653..ec527c64d 100644 --- a/src/net/tcp/httpcore.c +++ b/src/net/tcp/httpcore.c @@ -275,15 +275,9 @@ static void http_close ( struct http_transaction *http, int rc ) { /* Stop timer */ stop_timer ( &http->timer ); - /* Close all interfaces, allowing for the fact that the - * content-decoded and transfer-decoded interfaces may be - * connected to the same object. - */ - intf_shutdown ( &http->conn, rc ); - intf_nullify ( &http->transfer ); - intf_shutdown ( &http->content, rc ); - intf_shutdown ( &http->transfer, rc ); - intf_shutdown ( &http->xfer, rc ); + /* Close all interfaces */ + intfs_shutdown ( rc, &http->conn, &http->transfer, &http->content, + &http->xfer, NULL ); } /** @@ -784,12 +778,9 @@ static int http_transfer_complete ( struct http_transaction *http ) { } } - /* Restart content decoding interfaces (which may be attached - * to the same object). - */ - intf_nullify ( &http->transfer ); /* avoid potential loops */ - intf_restart ( &http->content, http->response.rc ); - intf_restart ( &http->transfer, http->response.rc ); + /* Restart content decoding interfaces */ + intfs_restart ( http->response.rc, &http->content, &http->transfer, + NULL ); intf_plug_plug ( &http->transfer, &http->content ); http->len = 0; assert ( http->remaining == 0 ); |