* [PATCH v2 0/4] Http Fixes [not found] <20220304130403.47832-1-osteffen@redhat.com> @ 2022-03-08 13:21 ` Oliver Steffen 2022-03-08 13:21 ` [PATCH v2 1/4] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Oliver Steffen ` (3 more replies) 2022-03-15 13:42 ` [PATCH v3 0/5] Http Fixes Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 0/5] Http Fixes (Take Two) Oliver Steffen 2 siblings, 4 replies; 28+ messages in thread From: Oliver Steffen @ 2022-03-08 13:21 UTC (permalink / raw) To: devel; +Cc: Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 This set of patches fixes booting from HTTP/1.0 servers. It also improves the interaction with HTTP/1.1 servers by recognizing the 'Connection: close' header field, which fixes a problem with servers that close the connection after a 404-error is encountered. It also prevents triggering the TCP issue described in https://bugzilla.tianocore.org/show_bug.cgi?id=3735 when booting from HTTP/1.0 servers. PR: https://github.com/tianocore/edk2/pull/2564 Oliver Steffen (4): NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL NetworkPkg/HttpDxe: Detect 'Connection: close' header NetworkPkg/HttpDxe: Detect HTTP/1.0 servers NetworkPkg/HttpDxe/HttpProto.h | 2 ++ NetworkPkg/HttpDxe/HttpImpl.c | 25 ++++++++++++++++++++++++- NetworkPkg/HttpDxe/HttpProto.c | 12 ++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) -- 2.35.1 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 1/4] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring 2022-03-08 13:21 ` [PATCH v2 0/4] Http Fixes Oliver Steffen @ 2022-03-08 13:21 ` Oliver Steffen 2022-03-09 9:29 ` [edk2-devel] " Gerd Hoffmann 2022-03-08 13:21 ` [PATCH v2 2/4] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL Oliver Steffen ` (2 subsequent siblings) 3 siblings, 1 reply; 28+ messages in thread From: Oliver Steffen @ 2022-03-08 13:21 UTC (permalink / raw) To: devel; +Cc: Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Check if the state of the HTTP instance is HTTP_STATE_TCP_CONNECTED, or HTTP_STATE_TCP_CLOSED and de-configure the Tcp4 instance before configuring it again. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpProto.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index 9457dd2623d3..cd54c574044b 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -1086,6 +1086,18 @@ HttpConfigureTcp4 ( Tcp4Option->EnableNagle = TRUE; Tcp4CfgData->ControlOption = Tcp4Option; + if ((HttpInstance->State == HTTP_STATE_TCP_CONNECTED) || + (HttpInstance->State == HTTP_STATE_TCP_CLOSED)) + { + Status = HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4(NULL) - %r\n", Status)); + return Status; + } + + HttpInstance->State = HTTP_STATE_TCP_UNCONFIGED; + } + Status = HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, Tcp4CfgData); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4 - %r\n", Status)); -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [edk2-devel] [PATCH v2 1/4] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring 2022-03-08 13:21 ` [PATCH v2 1/4] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Oliver Steffen @ 2022-03-09 9:29 ` Gerd Hoffmann 0 siblings, 0 replies; 28+ messages in thread From: Gerd Hoffmann @ 2022-03-09 9:29 UTC (permalink / raw) To: devel, osteffen On Tue, Mar 08, 2022 at 02:21:01PM +0100, Oliver Steffen wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 > > Check if the state of the HTTP instance is HTTP_STATE_TCP_CONNECTED, or > HTTP_STATE_TCP_CLOSED and de-configure the Tcp4 instance before > configuring it again. > > Signed-off-by: Oliver Steffen <osteffen@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 2/4] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL 2022-03-08 13:21 ` [PATCH v2 0/4] Http Fixes Oliver Steffen 2022-03-08 13:21 ` [PATCH v2 1/4] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Oliver Steffen @ 2022-03-08 13:21 ` Oliver Steffen 2022-03-09 9:31 ` [edk2-devel] " Gerd Hoffmann 2022-03-08 13:21 ` [PATCH v2 3/4] NetworkPkg/HttpDxe: Detect 'Connection: close' header Oliver Steffen 2022-03-08 13:21 ` [PATCH v2 4/4] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers Oliver Steffen 3 siblings, 1 reply; 28+ messages in thread From: Oliver Steffen @ 2022-03-08 13:21 UTC (permalink / raw) To: devel; +Cc: Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Add ConnectionClose flag to HTTP_PROTOCOL. This boolean is FALSE by default. If set to TRUE, a reconfigure of the Http instance is forced on the next request. The flag is then reset. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpProto.h | 2 ++ NetworkPkg/HttpDxe/HttpImpl.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/HttpDxe/HttpProto.h b/NetworkPkg/HttpDxe/HttpProto.h index 8ed99c7a02d3..620eb3915843 100644 --- a/NetworkPkg/HttpDxe/HttpProto.h +++ b/NetworkPkg/HttpDxe/HttpProto.h @@ -194,6 +194,8 @@ typedef struct _HTTP_PROTOCOL { EFI_TCP6_IO_TOKEN Tcp6TlsRxToken; EFI_TCP6_RECEIVE_DATA Tcp6TlsRxData; BOOLEAN TlsIsRxDone; + + BOOLEAN ConnectionClose; } HTTP_PROTOCOL; typedef struct { diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index d64cd9e965c0..d8b014c94f3a 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -161,6 +161,7 @@ EfiHttpConfigure ( HttpInstance->HttpVersion = HttpConfigData->HttpVersion; HttpInstance->TimeOutMillisec = HttpConfigData->TimeOutMillisec; HttpInstance->LocalAddressIsIPv6 = HttpConfigData->LocalAddressIsIPv6; + HttpInstance->ConnectionClose = FALSE; if (HttpConfigData->LocalAddressIsIPv6) { CopyMem ( @@ -440,7 +441,8 @@ EfiHttpRequest ( // ReConfigure = FALSE; } else { - if ((HttpInstance->RemotePort == RemotePort) && + if ((HttpInstance->ConnectionClose == FALSE) && + (HttpInstance->RemotePort == RemotePort) && (AsciiStrCmp (HttpInstance->RemoteHost, HostName) == 0) && (!HttpInstance->UseHttps || (HttpInstance->UseHttps && !TlsConfigure && @@ -649,6 +651,8 @@ EfiHttpRequest ( } } + HttpInstance->ConnectionClose = FALSE; + // // Transmit the request message. // -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [edk2-devel] [PATCH v2 2/4] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL 2022-03-08 13:21 ` [PATCH v2 2/4] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL Oliver Steffen @ 2022-03-09 9:31 ` Gerd Hoffmann 0 siblings, 0 replies; 28+ messages in thread From: Gerd Hoffmann @ 2022-03-09 9:31 UTC (permalink / raw) To: devel, osteffen On Tue, Mar 08, 2022 at 02:21:02PM +0100, Oliver Steffen wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 > > Add ConnectionClose flag to HTTP_PROTOCOL. > This boolean is FALSE by default. If set to TRUE, a reconfigure > of the Http instance is forced on the next request. The flag > is then reset. Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 3/4] NetworkPkg/HttpDxe: Detect 'Connection: close' header 2022-03-08 13:21 ` [PATCH v2 0/4] Http Fixes Oliver Steffen 2022-03-08 13:21 ` [PATCH v2 1/4] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Oliver Steffen 2022-03-08 13:21 ` [PATCH v2 2/4] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL Oliver Steffen @ 2022-03-08 13:21 ` Oliver Steffen 2022-03-09 9:30 ` [edk2-devel] " Gerd Hoffmann 2022-03-08 13:21 ` [PATCH v2 4/4] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers Oliver Steffen 3 siblings, 1 reply; 28+ messages in thread From: Oliver Steffen @ 2022-03-08 13:21 UTC (permalink / raw) To: devel; +Cc: Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Force connection close before the next request if the server sends the 'Connection: close' header. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpImpl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index d8b014c94f3a..d40d55ac92ad 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -994,6 +994,7 @@ HttpResponseWorker ( UINTN HdrLen; NET_FRAGMENT Fragment; UINT32 TimeoutValue; + UINTN index; if ((Wrap == NULL) || (Wrap->HttpInstance == NULL)) { return EFI_INVALID_PARAMETER; @@ -1200,6 +1201,16 @@ HttpResponseWorker ( FreePool (HttpHeaders); HttpHeaders = NULL; + for (index = 0; index < HttpMsg->HeaderCount; ++index) { + if ((AsciiStriCmp ("Connection", HttpMsg->Headers[index].FieldName) == 0) && + (AsciiStriCmp ("close", HttpMsg->Headers[index].FieldValue) == 0)) + { + DEBUG ((DEBUG_VERBOSE, "Http: 'Connection: close' header received.\n")); + HttpInstance->ConnectionClose = TRUE; + break; + } + } + // // Init message-body parser by header information. // -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [edk2-devel] [PATCH v2 3/4] NetworkPkg/HttpDxe: Detect 'Connection: close' header 2022-03-08 13:21 ` [PATCH v2 3/4] NetworkPkg/HttpDxe: Detect 'Connection: close' header Oliver Steffen @ 2022-03-09 9:30 ` Gerd Hoffmann 0 siblings, 0 replies; 28+ messages in thread From: Gerd Hoffmann @ 2022-03-09 9:30 UTC (permalink / raw) To: devel, osteffen On Tue, Mar 08, 2022 at 02:21:03PM +0100, Oliver Steffen wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 > > Force connection close before the next request if > the server sends the 'Connection: close' header. > > Signed-off-by: Oliver Steffen <osteffen@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 4/4] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers 2022-03-08 13:21 ` [PATCH v2 0/4] Http Fixes Oliver Steffen ` (2 preceding siblings ...) 2022-03-08 13:21 ` [PATCH v2 3/4] NetworkPkg/HttpDxe: Detect 'Connection: close' header Oliver Steffen @ 2022-03-08 13:21 ` Oliver Steffen 2022-03-09 9:30 ` [edk2-devel] " Gerd Hoffmann 3 siblings, 1 reply; 28+ messages in thread From: Oliver Steffen @ 2022-03-08 13:21 UTC (permalink / raw) To: devel; +Cc: Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Force connection close before the next request if the server identifies as version 1.0. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpImpl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index d40d55ac92ad..623e029c606e 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -1105,6 +1105,14 @@ HttpResponseWorker ( HttpInstance->CacheLen = BodyLen; } + // + // Check server's HTTP version. + // + if (AsciiStrnCmp (HttpHeaders, "HTTP/1.0", AsciiStrLen ("HTTP/1.0")) == 0) { + DEBUG ((DEBUG_VERBOSE, "HTTP: Server version is 1.0. Setting Connection close.\n")); + HttpInstance->ConnectionClose = TRUE; + } + // // Search for Status Code. // -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [edk2-devel] [PATCH v2 4/4] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers 2022-03-08 13:21 ` [PATCH v2 4/4] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers Oliver Steffen @ 2022-03-09 9:30 ` Gerd Hoffmann 0 siblings, 0 replies; 28+ messages in thread From: Gerd Hoffmann @ 2022-03-09 9:30 UTC (permalink / raw) To: devel, osteffen On Tue, Mar 08, 2022 at 02:21:04PM +0100, Oliver Steffen wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 > > Force connection close before the next request if > the server identifies as version 1.0. > > Signed-off-by: Oliver Steffen <osteffen@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v3 0/5] Http Fixes [not found] <20220304130403.47832-1-osteffen@redhat.com> 2022-03-08 13:21 ` [PATCH v2 0/4] Http Fixes Oliver Steffen @ 2022-03-15 13:42 ` Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 1/5] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Oliver Steffen ` (5 more replies) 2022-03-22 13:30 ` [PATCH v3 0/5] Http Fixes (Take Two) Oliver Steffen 2 siblings, 6 replies; 28+ messages in thread From: Oliver Steffen @ 2022-03-15 13:42 UTC (permalink / raw) To: devel; +Cc: Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 This set of patches fixes booting from HTTP/1.0 servers. It also improves the interaction with HTTP/1.1 servers by recognizing the 'Connection: close' header field, which fixes a problem with servers that close the connection after a 404-error is encountered. It also prevents triggering the TCP issue described in https://bugzilla.tianocore.org/show_bug.cgi?id=3735 when booting from HTTP/1.0 servers. PR: https://github.com/tianocore/edk2/pull/2564 Oliver Steffen (5): NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring NetworkPkg/HttpDxe: Decofigure Tcp6 before reconfiguring NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL NetworkPkg/HttpDxe: Detect 'Connection: close' header NetworkPkg/HttpDxe: Detect HTTP/1.0 servers NetworkPkg/HttpDxe/HttpProto.h | 2 ++ NetworkPkg/HttpDxe/HttpImpl.c | 25 ++++++++++++++++++++++++- NetworkPkg/HttpDxe/HttpProto.c | 24 ++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) -- 2.35.1 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v3 1/5] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring 2022-03-15 13:42 ` [PATCH v3 0/5] Http Fixes Oliver Steffen @ 2022-03-15 13:42 ` Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 2/5] NetworkPkg/HttpDxe: Decofigure Tcp6 " Oliver Steffen ` (4 subsequent siblings) 5 siblings, 0 replies; 28+ messages in thread From: Oliver Steffen @ 2022-03-15 13:42 UTC (permalink / raw) To: devel; +Cc: Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Check if the state of the HTTP instance is HTTP_STATE_TCP_CONNECTED, or HTTP_STATE_TCP_CLOSED and de-configure the Tcp4 instance before configuring it again. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpProto.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index 9457dd2623d3..cd54c574044b 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -1086,6 +1086,18 @@ HttpConfigureTcp4 ( Tcp4Option->EnableNagle = TRUE; Tcp4CfgData->ControlOption = Tcp4Option; + if ((HttpInstance->State == HTTP_STATE_TCP_CONNECTED) || + (HttpInstance->State == HTTP_STATE_TCP_CLOSED)) + { + Status = HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4(NULL) - %r\n", Status)); + return Status; + } + + HttpInstance->State = HTTP_STATE_TCP_UNCONFIGED; + } + Status = HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, Tcp4CfgData); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4 - %r\n", Status)); -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 2/5] NetworkPkg/HttpDxe: Decofigure Tcp6 before reconfiguring 2022-03-15 13:42 ` [PATCH v3 0/5] Http Fixes Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 1/5] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Oliver Steffen @ 2022-03-15 13:42 ` Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 3/5] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL Oliver Steffen ` (3 subsequent siblings) 5 siblings, 0 replies; 28+ messages in thread From: Oliver Steffen @ 2022-03-15 13:42 UTC (permalink / raw) To: devel; +Cc: Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Check if the state of the HTTP instance is HTTP_STATE_TCP_CONNECTED, or HTTP_STATE_TCP_CLOSED and de-configure the Tcp6 instance before configuring it again. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpProto.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index cd54c574044b..33ae622c3f0b 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -1168,6 +1168,18 @@ HttpConfigureTcp6 ( Tcp6Option->KeepAliveInterval = HTTP_KEEP_ALIVE_INTERVAL; Tcp6Option->EnableNagle = TRUE; + if ((HttpInstance->State == HTTP_STATE_TCP_CONNECTED) || + (HttpInstance->State == HTTP_STATE_TCP_CLOSED)) + { + Status = HttpInstance->Tcp6->Configure (HttpInstance->Tcp6, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "HttpConfigureTcp6(NULL) - %r\n", Status)); + return Status; + } + + HttpInstance->State = HTTP_STATE_TCP_UNCONFIGED; + } + Status = HttpInstance->Tcp6->Configure (HttpInstance->Tcp6, Tcp6CfgData); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "HttpConfigureTcp6 - %r\n", Status)); -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 3/5] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL 2022-03-15 13:42 ` [PATCH v3 0/5] Http Fixes Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 1/5] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 2/5] NetworkPkg/HttpDxe: Decofigure Tcp6 " Oliver Steffen @ 2022-03-15 13:42 ` Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 4/5] NetworkPkg/HttpDxe: Detect 'Connection: close' header Oliver Steffen ` (2 subsequent siblings) 5 siblings, 0 replies; 28+ messages in thread From: Oliver Steffen @ 2022-03-15 13:42 UTC (permalink / raw) To: devel; +Cc: Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Add ConnectionClose flag to HTTP_PROTOCOL. This boolean is FALSE by default. If set to TRUE, a reconfigure of the Http instance is forced on the next request. The flag is then reset. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpProto.h | 2 ++ NetworkPkg/HttpDxe/HttpImpl.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/HttpDxe/HttpProto.h b/NetworkPkg/HttpDxe/HttpProto.h index 8ed99c7a02d3..620eb3915843 100644 --- a/NetworkPkg/HttpDxe/HttpProto.h +++ b/NetworkPkg/HttpDxe/HttpProto.h @@ -194,6 +194,8 @@ typedef struct _HTTP_PROTOCOL { EFI_TCP6_IO_TOKEN Tcp6TlsRxToken; EFI_TCP6_RECEIVE_DATA Tcp6TlsRxData; BOOLEAN TlsIsRxDone; + + BOOLEAN ConnectionClose; } HTTP_PROTOCOL; typedef struct { diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index d64cd9e965c0..d8b014c94f3a 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -161,6 +161,7 @@ EfiHttpConfigure ( HttpInstance->HttpVersion = HttpConfigData->HttpVersion; HttpInstance->TimeOutMillisec = HttpConfigData->TimeOutMillisec; HttpInstance->LocalAddressIsIPv6 = HttpConfigData->LocalAddressIsIPv6; + HttpInstance->ConnectionClose = FALSE; if (HttpConfigData->LocalAddressIsIPv6) { CopyMem ( @@ -440,7 +441,8 @@ EfiHttpRequest ( // ReConfigure = FALSE; } else { - if ((HttpInstance->RemotePort == RemotePort) && + if ((HttpInstance->ConnectionClose == FALSE) && + (HttpInstance->RemotePort == RemotePort) && (AsciiStrCmp (HttpInstance->RemoteHost, HostName) == 0) && (!HttpInstance->UseHttps || (HttpInstance->UseHttps && !TlsConfigure && @@ -649,6 +651,8 @@ EfiHttpRequest ( } } + HttpInstance->ConnectionClose = FALSE; + // // Transmit the request message. // -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 4/5] NetworkPkg/HttpDxe: Detect 'Connection: close' header 2022-03-15 13:42 ` [PATCH v3 0/5] Http Fixes Oliver Steffen ` (2 preceding siblings ...) 2022-03-15 13:42 ` [PATCH v3 3/5] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL Oliver Steffen @ 2022-03-15 13:42 ` Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 5/5] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers Oliver Steffen 2022-03-16 10:36 ` [edk2-devel] [PATCH v3 0/5] Http Fixes Gerd Hoffmann 5 siblings, 0 replies; 28+ messages in thread From: Oliver Steffen @ 2022-03-15 13:42 UTC (permalink / raw) To: devel; +Cc: Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Force connection close before the next request if the server sends the 'Connection: close' header. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpImpl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index d8b014c94f3a..d40d55ac92ad 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -994,6 +994,7 @@ HttpResponseWorker ( UINTN HdrLen; NET_FRAGMENT Fragment; UINT32 TimeoutValue; + UINTN index; if ((Wrap == NULL) || (Wrap->HttpInstance == NULL)) { return EFI_INVALID_PARAMETER; @@ -1200,6 +1201,16 @@ HttpResponseWorker ( FreePool (HttpHeaders); HttpHeaders = NULL; + for (index = 0; index < HttpMsg->HeaderCount; ++index) { + if ((AsciiStriCmp ("Connection", HttpMsg->Headers[index].FieldName) == 0) && + (AsciiStriCmp ("close", HttpMsg->Headers[index].FieldValue) == 0)) + { + DEBUG ((DEBUG_VERBOSE, "Http: 'Connection: close' header received.\n")); + HttpInstance->ConnectionClose = TRUE; + break; + } + } + // // Init message-body parser by header information. // -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 5/5] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers 2022-03-15 13:42 ` [PATCH v3 0/5] Http Fixes Oliver Steffen ` (3 preceding siblings ...) 2022-03-15 13:42 ` [PATCH v3 4/5] NetworkPkg/HttpDxe: Detect 'Connection: close' header Oliver Steffen @ 2022-03-15 13:42 ` Oliver Steffen 2022-03-16 10:36 ` [edk2-devel] [PATCH v3 0/5] Http Fixes Gerd Hoffmann 5 siblings, 0 replies; 28+ messages in thread From: Oliver Steffen @ 2022-03-15 13:42 UTC (permalink / raw) To: devel; +Cc: Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Force connection close before the next request if the server identifies as version 1.0. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpImpl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index d40d55ac92ad..623e029c606e 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -1105,6 +1105,14 @@ HttpResponseWorker ( HttpInstance->CacheLen = BodyLen; } + // + // Check server's HTTP version. + // + if (AsciiStrnCmp (HttpHeaders, "HTTP/1.0", AsciiStrLen ("HTTP/1.0")) == 0) { + DEBUG ((DEBUG_VERBOSE, "HTTP: Server version is 1.0. Setting Connection close.\n")); + HttpInstance->ConnectionClose = TRUE; + } + // // Search for Status Code. // -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [edk2-devel] [PATCH v3 0/5] Http Fixes 2022-03-15 13:42 ` [PATCH v3 0/5] Http Fixes Oliver Steffen ` (4 preceding siblings ...) 2022-03-15 13:42 ` [PATCH v3 5/5] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers Oliver Steffen @ 2022-03-16 10:36 ` Gerd Hoffmann 5 siblings, 0 replies; 28+ messages in thread From: Gerd Hoffmann @ 2022-03-16 10:36 UTC (permalink / raw) To: devel, osteffen On Tue, Mar 15, 2022 at 02:42:24PM +0100, Oliver Steffen wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 > > This set of patches fixes booting from HTTP/1.0 servers. > It also improves the interaction with HTTP/1.1 servers by recognizing > the 'Connection: close' header field, which fixes a problem with > servers that close the connection after a 404-error is encountered. > > It also prevents triggering the TCP issue described in > https://bugzilla.tianocore.org/show_bug.cgi?id=3735 > when booting from HTTP/1.0 servers. > > PR: https://github.com/tianocore/edk2/pull/2564 Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> take care, Gerd ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v3 0/5] Http Fixes (Take Two) [not found] <20220304130403.47832-1-osteffen@redhat.com> 2022-03-08 13:21 ` [PATCH v2 0/4] Http Fixes Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 0/5] Http Fixes Oliver Steffen @ 2022-03-22 13:30 ` Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 1/5] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Oliver Steffen ` (5 more replies) 2 siblings, 6 replies; 28+ messages in thread From: Oliver Steffen @ 2022-03-22 13:30 UTC (permalink / raw) To: devel; +Cc: maciej.rabeda, jiaxin.wu, siyuan.fu, kraxel, Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 This set of patches fixes booting from HTTP/1.0 servers. It also improves the interaction with HTTP/1.1 servers by recognizing the 'Connection: close' header field, which fixes a problem with servers that close the connection after a 404-error is encountered. It also prevents triggering the TCP issue described in https://bugzilla.tianocore.org/show_bug.cgi?id=3735 when booting from HTTP/1.0 servers. PR: https://github.com/tianocore/edk2/pull/2564 Oliver Steffen (5): NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring NetworkPkg/HttpDxe: Decofigure Tcp6 before reconfiguring NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL NetworkPkg/HttpDxe: Detect 'Connection: close' header NetworkPkg/HttpDxe: Detect HTTP/1.0 servers NetworkPkg/HttpDxe/HttpProto.h | 2 ++ NetworkPkg/HttpDxe/HttpImpl.c | 25 ++++++++++++++++++++++++- NetworkPkg/HttpDxe/HttpProto.c | 24 ++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) -- 2.35.1 ^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v3 1/5] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring 2022-03-22 13:30 ` [PATCH v3 0/5] Http Fixes (Take Two) Oliver Steffen @ 2022-03-22 13:30 ` Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 2/5] NetworkPkg/HttpDxe: Decofigure Tcp6 " Oliver Steffen ` (4 subsequent siblings) 5 siblings, 0 replies; 28+ messages in thread From: Oliver Steffen @ 2022-03-22 13:30 UTC (permalink / raw) To: devel; +Cc: maciej.rabeda, jiaxin.wu, siyuan.fu, kraxel, Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Check if the state of the HTTP instance is HTTP_STATE_TCP_CONNECTED, or HTTP_STATE_TCP_CLOSED and de-configure the Tcp4 instance before configuring it again. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpProto.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index 9457dd2623d3..cd54c574044b 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -1086,6 +1086,18 @@ HttpConfigureTcp4 ( Tcp4Option->EnableNagle = TRUE; Tcp4CfgData->ControlOption = Tcp4Option; + if ((HttpInstance->State == HTTP_STATE_TCP_CONNECTED) || + (HttpInstance->State == HTTP_STATE_TCP_CLOSED)) + { + Status = HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4(NULL) - %r\n", Status)); + return Status; + } + + HttpInstance->State = HTTP_STATE_TCP_UNCONFIGED; + } + Status = HttpInstance->Tcp4->Configure (HttpInstance->Tcp4, Tcp4CfgData); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "HttpConfigureTcp4 - %r\n", Status)); -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 2/5] NetworkPkg/HttpDxe: Decofigure Tcp6 before reconfiguring 2022-03-22 13:30 ` [PATCH v3 0/5] Http Fixes (Take Two) Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 1/5] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Oliver Steffen @ 2022-03-22 13:30 ` Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 3/5] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL Oliver Steffen ` (3 subsequent siblings) 5 siblings, 0 replies; 28+ messages in thread From: Oliver Steffen @ 2022-03-22 13:30 UTC (permalink / raw) To: devel; +Cc: maciej.rabeda, jiaxin.wu, siyuan.fu, kraxel, Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Check if the state of the HTTP instance is HTTP_STATE_TCP_CONNECTED, or HTTP_STATE_TCP_CLOSED and de-configure the Tcp6 instance before configuring it again. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpProto.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index cd54c574044b..33ae622c3f0b 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -1168,6 +1168,18 @@ HttpConfigureTcp6 ( Tcp6Option->KeepAliveInterval = HTTP_KEEP_ALIVE_INTERVAL; Tcp6Option->EnableNagle = TRUE; + if ((HttpInstance->State == HTTP_STATE_TCP_CONNECTED) || + (HttpInstance->State == HTTP_STATE_TCP_CLOSED)) + { + Status = HttpInstance->Tcp6->Configure (HttpInstance->Tcp6, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "HttpConfigureTcp6(NULL) - %r\n", Status)); + return Status; + } + + HttpInstance->State = HTTP_STATE_TCP_UNCONFIGED; + } + Status = HttpInstance->Tcp6->Configure (HttpInstance->Tcp6, Tcp6CfgData); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "HttpConfigureTcp6 - %r\n", Status)); -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 3/5] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL 2022-03-22 13:30 ` [PATCH v3 0/5] Http Fixes (Take Two) Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 1/5] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 2/5] NetworkPkg/HttpDxe: Decofigure Tcp6 " Oliver Steffen @ 2022-03-22 13:30 ` Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 4/5] NetworkPkg/HttpDxe: Detect 'Connection: close' header Oliver Steffen ` (2 subsequent siblings) 5 siblings, 0 replies; 28+ messages in thread From: Oliver Steffen @ 2022-03-22 13:30 UTC (permalink / raw) To: devel; +Cc: maciej.rabeda, jiaxin.wu, siyuan.fu, kraxel, Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Add ConnectionClose flag to HTTP_PROTOCOL. This boolean is FALSE by default. If set to TRUE, a reconfigure of the Http instance is forced on the next request. The flag is then reset. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpProto.h | 2 ++ NetworkPkg/HttpDxe/HttpImpl.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NetworkPkg/HttpDxe/HttpProto.h b/NetworkPkg/HttpDxe/HttpProto.h index 8ed99c7a02d3..620eb3915843 100644 --- a/NetworkPkg/HttpDxe/HttpProto.h +++ b/NetworkPkg/HttpDxe/HttpProto.h @@ -194,6 +194,8 @@ typedef struct _HTTP_PROTOCOL { EFI_TCP6_IO_TOKEN Tcp6TlsRxToken; EFI_TCP6_RECEIVE_DATA Tcp6TlsRxData; BOOLEAN TlsIsRxDone; + + BOOLEAN ConnectionClose; } HTTP_PROTOCOL; typedef struct { diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index d64cd9e965c0..d8b014c94f3a 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -161,6 +161,7 @@ EfiHttpConfigure ( HttpInstance->HttpVersion = HttpConfigData->HttpVersion; HttpInstance->TimeOutMillisec = HttpConfigData->TimeOutMillisec; HttpInstance->LocalAddressIsIPv6 = HttpConfigData->LocalAddressIsIPv6; + HttpInstance->ConnectionClose = FALSE; if (HttpConfigData->LocalAddressIsIPv6) { CopyMem ( @@ -440,7 +441,8 @@ EfiHttpRequest ( // ReConfigure = FALSE; } else { - if ((HttpInstance->RemotePort == RemotePort) && + if ((HttpInstance->ConnectionClose == FALSE) && + (HttpInstance->RemotePort == RemotePort) && (AsciiStrCmp (HttpInstance->RemoteHost, HostName) == 0) && (!HttpInstance->UseHttps || (HttpInstance->UseHttps && !TlsConfigure && @@ -649,6 +651,8 @@ EfiHttpRequest ( } } + HttpInstance->ConnectionClose = FALSE; + // // Transmit the request message. // -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 4/5] NetworkPkg/HttpDxe: Detect 'Connection: close' header 2022-03-22 13:30 ` [PATCH v3 0/5] Http Fixes (Take Two) Oliver Steffen ` (2 preceding siblings ...) 2022-03-22 13:30 ` [PATCH v3 3/5] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL Oliver Steffen @ 2022-03-22 13:30 ` Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 5/5] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers Oliver Steffen 2022-03-23 1:19 ` 回复: [edk2-devel] [PATCH v3 0/5] Http Fixes (Take Two) gaoliming 5 siblings, 0 replies; 28+ messages in thread From: Oliver Steffen @ 2022-03-22 13:30 UTC (permalink / raw) To: devel; +Cc: maciej.rabeda, jiaxin.wu, siyuan.fu, kraxel, Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Force connection close before the next request if the server sends the 'Connection: close' header. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpImpl.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index d8b014c94f3a..d40d55ac92ad 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -994,6 +994,7 @@ HttpResponseWorker ( UINTN HdrLen; NET_FRAGMENT Fragment; UINT32 TimeoutValue; + UINTN index; if ((Wrap == NULL) || (Wrap->HttpInstance == NULL)) { return EFI_INVALID_PARAMETER; @@ -1200,6 +1201,16 @@ HttpResponseWorker ( FreePool (HttpHeaders); HttpHeaders = NULL; + for (index = 0; index < HttpMsg->HeaderCount; ++index) { + if ((AsciiStriCmp ("Connection", HttpMsg->Headers[index].FieldName) == 0) && + (AsciiStriCmp ("close", HttpMsg->Headers[index].FieldValue) == 0)) + { + DEBUG ((DEBUG_VERBOSE, "Http: 'Connection: close' header received.\n")); + HttpInstance->ConnectionClose = TRUE; + break; + } + } + // // Init message-body parser by header information. // -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v3 5/5] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers 2022-03-22 13:30 ` [PATCH v3 0/5] Http Fixes (Take Two) Oliver Steffen ` (3 preceding siblings ...) 2022-03-22 13:30 ` [PATCH v3 4/5] NetworkPkg/HttpDxe: Detect 'Connection: close' header Oliver Steffen @ 2022-03-22 13:30 ` Oliver Steffen 2022-03-23 1:19 ` 回复: [edk2-devel] [PATCH v3 0/5] Http Fixes (Take Two) gaoliming 5 siblings, 0 replies; 28+ messages in thread From: Oliver Steffen @ 2022-03-22 13:30 UTC (permalink / raw) To: devel; +Cc: maciej.rabeda, jiaxin.wu, siyuan.fu, kraxel, Oliver Steffen REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 Force connection close before the next request if the server identifies as version 1.0. Signed-off-by: Oliver Steffen <osteffen@redhat.com> --- NetworkPkg/HttpDxe/HttpImpl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c index d40d55ac92ad..623e029c606e 100644 --- a/NetworkPkg/HttpDxe/HttpImpl.c +++ b/NetworkPkg/HttpDxe/HttpImpl.c @@ -1105,6 +1105,14 @@ HttpResponseWorker ( HttpInstance->CacheLen = BodyLen; } + // + // Check server's HTTP version. + // + if (AsciiStrnCmp (HttpHeaders, "HTTP/1.0", AsciiStrLen ("HTTP/1.0")) == 0) { + DEBUG ((DEBUG_VERBOSE, "HTTP: Server version is 1.0. Setting Connection close.\n")); + HttpInstance->ConnectionClose = TRUE; + } + // // Search for Status Code. // -- 2.35.1 ^ permalink raw reply related [flat|nested] 28+ messages in thread
* 回复: [edk2-devel] [PATCH v3 0/5] Http Fixes (Take Two) 2022-03-22 13:30 ` [PATCH v3 0/5] Http Fixes (Take Two) Oliver Steffen ` (4 preceding siblings ...) 2022-03-22 13:30 ` [PATCH v3 5/5] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers Oliver Steffen @ 2022-03-23 1:19 ` gaoliming 2022-04-07 9:57 ` Gerd Hoffmann 5 siblings, 1 reply; 28+ messages in thread From: gaoliming @ 2022-03-23 1:19 UTC (permalink / raw) To: devel, osteffen, maciej.rabeda, jiaxin.wu, siyuan.fu; +Cc: kraxel Maciej, Jiaxin and Siyuan: Can you help review this fix? Thanks Liming > -----邮件原件----- > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Oliver Steffen > 发送时间: 2022年3月22日 21:30 > 收件人: devel@edk2.groups.io > 抄送: maciej.rabeda@linux.intel.com; jiaxin.wu@intel.com; > siyuan.fu@intel.com; kraxel@redhat.com; Oliver Steffen > <osteffen@redhat.com> > 主题: [edk2-devel] [PATCH v3 0/5] Http Fixes (Take Two) > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2720 > > This set of patches fixes booting from HTTP/1.0 servers. > It also improves the interaction with HTTP/1.1 servers by recognizing > the 'Connection: close' header field, which fixes a problem with > servers that close the connection after a 404-error is encountered. > > It also prevents triggering the TCP issue described in > https://bugzilla.tianocore.org/show_bug.cgi?id=3735 > when booting from HTTP/1.0 servers. > > PR: https://github.com/tianocore/edk2/pull/2564 > > Oliver Steffen (5): > NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring > NetworkPkg/HttpDxe: Decofigure Tcp6 before reconfiguring > NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL > NetworkPkg/HttpDxe: Detect 'Connection: close' header > NetworkPkg/HttpDxe: Detect HTTP/1.0 servers > > NetworkPkg/HttpDxe/HttpProto.h | 2 ++ > NetworkPkg/HttpDxe/HttpImpl.c | 25 ++++++++++++++++++++++++- > NetworkPkg/HttpDxe/HttpProto.c | 24 ++++++++++++++++++++++++ > 3 files changed, 50 insertions(+), 1 deletion(-) > > -- > 2.35.1 > > > > > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 回复: [edk2-devel] [PATCH v3 0/5] Http Fixes (Take Two) 2022-03-23 1:19 ` 回复: [edk2-devel] [PATCH v3 0/5] Http Fixes (Take Two) gaoliming @ 2022-04-07 9:57 ` Gerd Hoffmann 2022-04-07 12:46 ` Maciej Rabeda 0 siblings, 1 reply; 28+ messages in thread From: Gerd Hoffmann @ 2022-04-07 9:57 UTC (permalink / raw) To: devel, gaoliming; +Cc: osteffen, maciej.rabeda, jiaxin.wu, siyuan.fu On Wed, Mar 23, 2022 at 09:19:09AM +0800, gaoliming wrote: > Maciej, Jiaxin and Siyuan: > Can you help review this fix? Ping. Anything blocking the merge of these bugfixes? thanks, Gerd ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 回复: [edk2-devel] [PATCH v3 0/5] Http Fixes (Take Two) 2022-04-07 9:57 ` Gerd Hoffmann @ 2022-04-07 12:46 ` Maciej Rabeda 2022-04-07 12:55 ` Oliver Steffen 0 siblings, 1 reply; 28+ messages in thread From: Maciej Rabeda @ 2022-04-07 12:46 UTC (permalink / raw) To: Gerd Hoffmann, devel, gaoliming; +Cc: osteffen, jiaxin.wu, siyuan.fu Hi Gerd, Sorry, I can spare very little time for reviews these days... I am alright with the patch with two cosmetic changes. 1. In HttpResponseWorker(): if (AsciiStrnCmp (HttpHeaders, "HTTP/1.0", AsciiStrLen ("HTTP/1.0")) == 0) { DEBUG ((DEBUG_VERBOSE, "HTTP: Server version is 1.0. Setting Connection close.\n")); HttpInstance->ConnectionClose = TRUE; } I'd change AsciiStrLen ("HTTP/1.0") to sizeof("HTTP/1.0") - 1. No need to call a AsciiStrLen every time this flow is executed, it is easily a compile-time thing. 2. In HttpResponseWorker(), index -> Index, coding standard. I can merge this patch with changes above one I get an ACK from you. Thanks, Maciej On 7 kwi 2022 11:57, Gerd Hoffmann wrote: > On Wed, Mar 23, 2022 at 09:19:09AM +0800, gaoliming wrote: >> Maciej, Jiaxin and Siyuan: >> Can you help review this fix? > Ping. Anything blocking the merge of these bugfixes? > > thanks, > Gerd > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 回复: [edk2-devel] [PATCH v3 0/5] Http Fixes (Take Two) 2022-04-07 12:46 ` Maciej Rabeda @ 2022-04-07 12:55 ` Oliver Steffen 2022-04-08 9:07 ` Maciej Rabeda 0 siblings, 1 reply; 28+ messages in thread From: Oliver Steffen @ 2022-04-07 12:55 UTC (permalink / raw) To: Rabeda, Maciej, devel; +Cc: Gerd Hoffmann, gaoliming, jiaxin.wu, siyuan.fu On Thu, Apr 7, 2022 at 2:46 PM Rabeda, Maciej <maciej.rabeda@linux.intel.com> wrote: > 1. In HttpResponseWorker(): > > if (AsciiStrnCmp (HttpHeaders, "HTTP/1.0", AsciiStrLen > ("HTTP/1.0")) == 0) { > DEBUG ((DEBUG_VERBOSE, "HTTP: Server version is 1.0. Setting > Connection close.\n")); > HttpInstance->ConnectionClose = TRUE; > } > > I'd change AsciiStrLen ("HTTP/1.0") to sizeof("HTTP/1.0") - 1. No need > to call a AsciiStrLen every time this flow is executed, it is easily a > compile-time thing. Yes, of course. > 2. In HttpResponseWorker(), index -> Index, coding standard. Sorry, I missed that one. > I can merge this patch with changes above one I get an ACK from you. Sounds good to me. Thank you! -- Oliver ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 回复: [edk2-devel] [PATCH v3 0/5] Http Fixes (Take Two) 2022-04-07 12:55 ` Oliver Steffen @ 2022-04-08 9:07 ` Maciej Rabeda 2022-04-11 15:24 ` Maciej Rabeda 0 siblings, 1 reply; 28+ messages in thread From: Maciej Rabeda @ 2022-04-08 9:07 UTC (permalink / raw) To: devel, osteffen; +Cc: Gerd Hoffmann, gaoliming, jiaxin.wu, siyuan.fu Alright. Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com> Merge soon. On 7 kwi 2022 14:55, Oliver Steffen wrote: > On Thu, Apr 7, 2022 at 2:46 PM Rabeda, Maciej > <maciej.rabeda@linux.intel.com> wrote: > >> 1. In HttpResponseWorker(): >> >> if (AsciiStrnCmp (HttpHeaders, "HTTP/1.0", AsciiStrLen >> ("HTTP/1.0")) == 0) { >> DEBUG ((DEBUG_VERBOSE, "HTTP: Server version is 1.0. Setting >> Connection close.\n")); >> HttpInstance->ConnectionClose = TRUE; >> } >> >> I'd change AsciiStrLen ("HTTP/1.0") to sizeof("HTTP/1.0") - 1. No need >> to call a AsciiStrLen every time this flow is executed, it is easily a >> compile-time thing. > Yes, of course. > >> 2. In HttpResponseWorker(), index -> Index, coding standard. > Sorry, I missed that one. > >> I can merge this patch with changes above one I get an ACK from you. > Sounds good to me. Thank you! > > -- Oliver > > > > > > ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: 回复: [edk2-devel] [PATCH v3 0/5] Http Fixes (Take Two) 2022-04-08 9:07 ` Maciej Rabeda @ 2022-04-11 15:24 ` Maciej Rabeda 0 siblings, 0 replies; 28+ messages in thread From: Maciej Rabeda @ 2022-04-11 15:24 UTC (permalink / raw) To: devel, osteffen; +Cc: Gerd Hoffmann, gaoliming, jiaxin.wu, siyuan.fu Patchset merged: https://github.com/tianocore/edk2/pull/2756 On 8 kwi 2022 11:07, Rabeda, Maciej wrote: > Alright. > > Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com> > > Merge soon. > > On 7 kwi 2022 14:55, Oliver Steffen wrote: >> On Thu, Apr 7, 2022 at 2:46 PM Rabeda, Maciej >> <maciej.rabeda@linux.intel.com> wrote: >> >>> 1. In HttpResponseWorker(): >>> >>> if (AsciiStrnCmp (HttpHeaders, "HTTP/1.0", AsciiStrLen >>> ("HTTP/1.0")) == 0) { >>> DEBUG ((DEBUG_VERBOSE, "HTTP: Server version is 1.0. Setting >>> Connection close.\n")); >>> HttpInstance->ConnectionClose = TRUE; >>> } >>> >>> I'd change AsciiStrLen ("HTTP/1.0") to sizeof("HTTP/1.0") - 1. No need >>> to call a AsciiStrLen every time this flow is executed, it is easily a >>> compile-time thing. >> Yes, of course. >> >>> 2. In HttpResponseWorker(), index -> Index, coding standard. >> Sorry, I missed that one. >> >>> I can merge this patch with changes above one I get an ACK from you. >> Sounds good to me. Thank you! >> >> -- Oliver >> >> >> >> >> >> ^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2022-04-11 15:24 UTC | newest] Thread overview: 28+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20220304130403.47832-1-osteffen@redhat.com> 2022-03-08 13:21 ` [PATCH v2 0/4] Http Fixes Oliver Steffen 2022-03-08 13:21 ` [PATCH v2 1/4] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Oliver Steffen 2022-03-09 9:29 ` [edk2-devel] " Gerd Hoffmann 2022-03-08 13:21 ` [PATCH v2 2/4] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL Oliver Steffen 2022-03-09 9:31 ` [edk2-devel] " Gerd Hoffmann 2022-03-08 13:21 ` [PATCH v2 3/4] NetworkPkg/HttpDxe: Detect 'Connection: close' header Oliver Steffen 2022-03-09 9:30 ` [edk2-devel] " Gerd Hoffmann 2022-03-08 13:21 ` [PATCH v2 4/4] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers Oliver Steffen 2022-03-09 9:30 ` [edk2-devel] " Gerd Hoffmann 2022-03-15 13:42 ` [PATCH v3 0/5] Http Fixes Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 1/5] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 2/5] NetworkPkg/HttpDxe: Decofigure Tcp6 " Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 3/5] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 4/5] NetworkPkg/HttpDxe: Detect 'Connection: close' header Oliver Steffen 2022-03-15 13:42 ` [PATCH v3 5/5] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers Oliver Steffen 2022-03-16 10:36 ` [edk2-devel] [PATCH v3 0/5] Http Fixes Gerd Hoffmann 2022-03-22 13:30 ` [PATCH v3 0/5] Http Fixes (Take Two) Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 1/5] NetworkPkg/HttpDxe: Decofigure Tcp4 before reconfiguring Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 2/5] NetworkPkg/HttpDxe: Decofigure Tcp6 " Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 3/5] NetworkPkg/HttpDxe: Add ConnectionClose flag fo HTTP_PROTOCOL Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 4/5] NetworkPkg/HttpDxe: Detect 'Connection: close' header Oliver Steffen 2022-03-22 13:30 ` [PATCH v3 5/5] NetworkPkg/HttpDxe: Detect HTTP/1.0 servers Oliver Steffen 2022-03-23 1:19 ` 回复: [edk2-devel] [PATCH v3 0/5] Http Fixes (Take Two) gaoliming 2022-04-07 9:57 ` Gerd Hoffmann 2022-04-07 12:46 ` Maciej Rabeda 2022-04-07 12:55 ` Oliver Steffen 2022-04-08 9:07 ` Maciej Rabeda 2022-04-11 15:24 ` Maciej Rabeda
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox