Procházet zdrojové kódy

[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 před 7 roky
rodič
revize
4a4da573dd
1 změnil soubory, kde provedl 6 přidání a 15 odebrání
  1. 6
    15
      src/net/tcp/httpcore.c

+ 6
- 15
src/net/tcp/httpcore.c Zobrazit soubor

275
 	/* Stop timer */
275
 	/* Stop timer */
276
 	stop_timer ( &http->timer );
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
 		}
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
 	intf_plug_plug ( &http->transfer, &http->content );
784
 	intf_plug_plug ( &http->transfer, &http->content );
794
 	http->len = 0;
785
 	http->len = 0;
795
 	assert ( http->remaining == 0 );
786
 	assert ( http->remaining == 0 );

Načítá se…
Zrušit
Uložit