Browse Source

NetworkPkg/HttpDxe: Detect HTTP/1.0 servers

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: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Oliver Steffen 2 years ago
parent
commit
12a50c9ce1
1 changed files with 8 additions and 0 deletions
  1. 8 0
      NetworkPkg/HttpDxe/HttpImpl.c

+ 8 - 0
NetworkPkg/HttpDxe/HttpImpl.c

@@ -1105,6 +1105,14 @@ HttpResponseWorker (
       HttpInstance->CacheLen = BodyLen;
     }
 
+    //
+    // Check server's HTTP version.
+    //
+    if (AsciiStrnCmp (HttpHeaders, "HTTP/1.0", sizeof ("HTTP/1.0") - 1) == 0) {
+      DEBUG ((DEBUG_VERBOSE, "HTTP: Server version is 1.0. Setting Connection close.\n"));
+      HttpInstance->ConnectionClose = TRUE;
+    }
+
     //
     // Search for Status Code.
     //