2 Header file for HttpLib.
4 Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
5 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #ifndef _DXE_HTTP_LIB_H_
12 #define _DXE_HTTP_LIB_H_
15 #include <Library/NetLib.h>
16 #include <Library/HttpLib.h>
17 #include <Library/BaseLib.h>
18 #include <Library/DebugLib.h>
19 #include <Library/MemoryAllocationLib.h>
20 #include <Library/UefiBootServicesTableLib.h>
21 #include <IndustryStandard/Http11.h>
22 #include <Protocol/HttpUtilities.h>
24 #define BIT(x) (1 << x)
26 #define HTTP_VERSION_CRLF_STR " HTTP/1.1\r\n"
27 #define EMPTY_SPACE " "
29 #define NET_IS_HEX_CHAR(Ch) \
30 ((('0' <= (Ch)) && ((Ch) <= '9')) || \
31 (('A' <= (Ch)) && ((Ch) <= 'F')) || \
32 (('a' <= (Ch)) && ((Ch) <= 'f')))
35 // Field index of the HTTP URL parse result.
37 #define HTTP_URI_FIELD_SCHEME 0
38 #define HTTP_URI_FIELD_AUTHORITY 1
39 #define HTTP_URI_FIELD_PATH 2
40 #define HTTP_URI_FIELD_QUERY 3
41 #define HTTP_URI_FIELD_FRAGMENT 4
42 #define HTTP_URI_FIELD_USERINFO 5
43 #define HTTP_URI_FIELD_HOST 6
44 #define HTTP_URI_FIELD_PORT 7
45 #define HTTP_URI_FIELD_MAX 8
47 #define HTTP_URI_PORT_MAX_NUM 65535
50 // Structure to store the parse result of a HTTP URL.
55 } HTTP_URL_FILED_DATA
;
59 HTTP_URL_FILED_DATA FieldData
[HTTP_URI_FIELD_MAX
];
65 UrlParserSchemeColon
, // ":"
66 UrlParserSchemeColonSlash
, // ":/"
67 UrlParserSchemeColonSlashSlash
, // "://"
69 UrlParserAtInAuthority
,
71 UrlParserQueryStart
, // "?"
73 UrlParserFragmentStart
, // "#"
76 UrlParserHostStart
, // "@"
78 UrlParserHostIpv6
, // "["(Ipv6 address) "]"
79 UrlParserPortStart
, // ":"
82 } HTTP_URL_PARSE_STATE
;