+/**\r
+ Get the Path from a HTTP URL.\r
+\r
+ This function will return the Path according to the Url and previous parse result,and\r
+ it is the caller's responsibility to free the buffer returned in *Path.\r
+\r
+ @param[in] Url The pointer to a HTTP URL string.\r
+ @param[in] UrlParser URL Parse result returned by NetHttpParseUrl().\r
+ @param[out] Path Pointer to a buffer to store the Path.\r
+\r
+ @retval EFI_SUCCESS Successfully get the required component.\r
+ @retval EFI_INVALID_PARAMETER Uri is NULL or HostName is NULL or UrlParser is invalid.\r
+ @retval EFI_NOT_FOUND No hostName component in the URL.\r
+ @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources.\r
+ \r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+HttpUrlGetPath (\r
+ IN CHAR8 *Url,\r
+ IN VOID *UrlParser,\r
+ OUT CHAR8 **Path\r
+ )\r
+{\r
+ CHAR8 *PathStr;\r
+ EFI_STATUS Status;\r
+ UINT32 ResultLength;\r
+ HTTP_URL_PARSER *Parser;\r
+\r
+ if (Url == NULL || UrlParser == NULL || Path == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ Parser = (HTTP_URL_PARSER*) UrlParser;\r
+\r
+ if ((Parser->FieldBitMap & BIT (HTTP_URI_FIELD_PATH)) == 0) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ PathStr = AllocatePool (Parser->FieldData[HTTP_URI_FIELD_PATH].Length + 1);\r
+ if (PathStr == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+ \r
+ Status = UriPercentDecode (\r
+ Url + Parser->FieldData[HTTP_URI_FIELD_PATH].Offset,\r
+ Parser->FieldData[HTTP_URI_FIELD_PATH].Length,\r
+ PathStr,\r
+ &ResultLength\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ PathStr[ResultLength] = '\0';\r
+ *Path = PathStr;\r
+ return EFI_SUCCESS;\r
+}\r
+\r