The hostname is already set in the header of the http request.
The url shouldn't contain the hostname since the hostname will
be prepended to the url when the server interprets the request.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Ching-Pang Lin <g...@suse.com>
---
 NetworkPkg/HttpDxe/HttpImpl.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 545fe42..030dcfe 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -227,6 +227,7 @@ EfiHttpRequest (
   CHAR16                        *HostNameStr;
   HTTP_TOKEN_WRAP               *Wrap;
   HTTP_TCP_TOKEN_WRAP           *TcpWrap;
+  CHAR8                         *FileUrl;
 
   if ((This == NULL) || (Token == NULL)) {
     return EFI_INVALID_PARAMETER;
@@ -450,7 +451,18 @@ EfiHttpRequest (
   //
   // Create request message.
   //
-  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, Url);
+  FileUrl = Url;
+  while (*FileUrl != ':')
+    FileUrl++;
+  if ((*(FileUrl+1) == '/') && (*(FileUrl+2) == '/')) {
+    FileUrl += 3;
+    while (*FileUrl != '/')
+      FileUrl++;
+  } else {
+    Status = EFI_INVALID_PARAMETER;
+    goto Error3;
+  }
+  RequestStr = HttpGenRequestString (HttpInstance, HttpMsg, FileUrl);
   if (RequestStr == NULL) {
     Status = EFI_OUT_OF_RESOURCES;
     goto Error3;
-- 
2.1.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to