I checked RFC7230 and agreed we need use the origin-form of URI instead of 
using absolute-form. Thanks for fixing this.

Reviewed-by: Ye Ting <ting...@intel.com> 

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Gary 
Ching-Pang Lin
Sent: Friday, August 14, 2015 5:04 PM
To: edk2-devel@lists.01.org
Cc: Justen, Jordan L; Fu, Siyuan; Laszlo Ersek
Subject: [edk2] [PATCH 1/2] NetworkPkg: Remove the hostname for the http 
request url

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
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to