1# Copyright (c) 2016 Intel Corporation
2# SPDX-License-Identifier: Apache-2.0
3
4config HTTP_PARSER
5	bool "HTTP Parser support"
6	select HTTP_PARSER_URL
7	help
8	  This option enables the http_parser library from nodejs.
9	  This parser requires some string-related routines commonly
10	  provided by a libc implementation.
11
12config HTTP_PARSER_URL
13	bool "HTTP Parser for URL support"
14	help
15	  This option enables the URI parser library based on source from nodejs.
16	  This parser requires some string-related routines commonly
17	  provided by a libc implementation.
18
19config HTTP_PARSER_STRICT
20	bool "HTTP strict parsing"
21	depends on (HTTP_PARSER || HTTP_PARSER_URL)
22	help
23	  This option enables the strict parsing option
24
25config HTTP_CLIENT
26	bool "HTTP client API"
27	select HTTP_PARSER
28	select HTTP_PARSER_URL
29	help
30	  HTTP client API
31
32config HTTP_SERVER
33	bool "HTTP Server [EXPERIMENTAL]"
34	select HTTP_PARSER
35	select HTTP_PARSER_URL
36	select EXPERIMENTAL
37	imply NET_IPV4_MAPPING_TO_IPV6 if NET_IPV4 && NET_IPV6
38	help
39	  HTTP1 and HTTP2 server support.
40
41if HTTP_SERVER
42
43config HTTP_SERVER_STACK_SIZE
44	int "HTTP server thread stack size"
45	default 3072
46	help
47	  HTTP server thread stack size for processing RX/TX events.
48
49config HTTP_SERVER_NUM_SERVICES
50	int "Number of HTTP Server Instances"
51	default 1
52	range 1 100
53	help
54	  This setting determines the number of http services that the server supports.
55
56config HTTP_SERVER_MAX_CLIENTS
57	int "Max number of HTTP/2 clients"
58	default 3
59	range 1 100
60	help
61	  This setting determines the maximum number of HTTP/2 clients that the server can handle at once.
62
63config HTTP_SERVER_MAX_STREAMS
64	int "Max number of HTTP/2 streams"
65	default 10
66	range 1 100
67	help
68	  This setting determines the maximum number of HTTP/2 streams for each client.
69
70config HTTP_SERVER_CLIENT_BUFFER_SIZE
71	int "Client Buffer Size"
72	default 256
73	range 64 $(UINT32_MAX)
74	help
75	  This setting determines the buffer size for each client.
76
77config HTTP_SERVER_HUFFMAN_DECODE_BUFFER_SIZE
78	int "Size of the buffer used for decoding Huffman-encoded strings"
79	default 256
80	range 64 $(UINT32_MAX)
81	help
82	  Size of the buffer used for decoding Huffman-encoded strings when
83	  processing HPACK compressed headers. This effectively limits the
84	  maximum length of an individual HTTP header supported.
85
86config HTTP_SERVER_MAX_URL_LENGTH
87	int "Maximum HTTP URL Length"
88	default 256
89	range 32 2048
90	help
91	  This setting determines the maximum length of the HTTP URL that the server can process.
92
93config HTTP_SERVER_MAX_CONTENT_TYPE_LENGTH
94	int "Maximum HTTP Content-Type Length"
95	default 64
96	range 1 128
97	help
98	  This setting determines the maximum length of the HTTP Content-Length field.
99
100config HTTP_SERVER_MAX_HEADER_LEN
101	int "Maximum HTTP Header Field/Value Length"
102	default 32
103	range 32 512
104	help
105	  This setting determines the maximum length of HTTP header field or value
106	  that can be parsed. The default value is sufficient for HTTP server
107	  internal header processing, and only needs to be increased if the
108	  application wishes to access headers of a greater length.
109
110config HTTP_SERVER_HTTP2_MAX_HEADER_FRAME_LEN
111	int "Maximum HTTP/2 response header frame length"
112	default 64
113	range 64 2048
114	help
115	  This setting determines the maximum length of an HTTP/2 header frame
116	  (applies to response headers only, not request headers). The default
117	  value is sufficient for the standard headers included with a response,
118	  and only needs to be increased if the application wishes to send
119	  additional response headers.
120
121config HTTP_SERVER_CAPTURE_HEADERS
122	bool "Allow capturing HTTP headers for application use"
123	help
124	  This setting enables the HTTP server to capture selected headers that have
125	  been registered by the application.
126
127config HTTP_SERVER_CAPTURE_HEADER_BUFFER_SIZE
128	int "Size of buffer for capturing HTTP headers for application use"
129	default 128
130	range 32 2048
131	depends on HTTP_SERVER_CAPTURE_HEADERS
132	help
133	  This setting determines the size of the (per-client) buffer used to store
134	  HTTP headers for later use by the application.
135
136config HTTP_SERVER_CAPTURE_HEADER_COUNT
137	int "Maximum number of HTTP headers to be captured for application use"
138	default 3
139	range 1 100
140	depends on HTTP_SERVER_CAPTURE_HEADERS
141	help
142	  This setting determines the maximum number of HTTP headers it is possible
143	  to capture for application use in a single HTTP request.
144
145config HTTP_SERVER_CLIENT_INACTIVITY_TIMEOUT
146	int "Client inactivity timeout (seconds)"
147	default 10
148	range 1 86400
149	help
150	  This timeout specifies maximum time the client may remain inactive
151	  (i. e. not sending or receiving any data) before the server drops the
152	  connection.
153
154config HTTP_SERVER_WEBSOCKET
155	bool "Allow upgrading to Websocket connection"
156	select WEBSOCKET_CLIENT
157	select WEBSOCKET
158	help
159	  If this is enabled, then the user can allow the HTTP connection to be
160	  upgraded to a Websocket connection. The user can then define a Websocket
161	  handler that is called after upgrading to handle the Websocket network
162	  traffic.
163
164config HTTP_SERVER_RESOURCE_WILDCARD
165	bool "Allow wildcard matching of resources"
166	select FNMATCH
167	help
168	  Allow user to specify wildcards when setting up resource strings.
169	  This means that instead of specifying multiple resources with exact
170	  string matches, one resource handler could handle multiple URLs.
171
172config HTTP_SERVER_RESTART_DELAY
173	int "Delay before re-initialization when restarting server"
174	default 1000
175	range 1 60000
176	help
177	  In case server restarts for any reason, the server re-initialization
178	  will be delayed by this value (miliseconds). The delay is needed to
179	  allow any existing connections to finalize to avoid binding errors
180	  during initialization.
181
182config HTTP_SERVER_TLS_USE_ALPN
183	bool "ALPN support for HTTPS server"
184	depends on NET_SOCKETS_SOCKOPT_TLS
185	depends on MBEDTLS_SSL_ALPN
186	help
187	  Use ALPN (application layer protocol negotiation) to negotiate HTTP2
188	  protocol for TLS connections. Web browsers use this mechanism to determine
189	  whether HTTP2 is supported.
190
191config WEBSOCKET_CONSOLE
192	bool
193	default y if HTTP_SERVER_WEBSOCKET && SHELL_BACKEND_WEBSOCKET
194	help
195	  Hidden option that is enabled only when all the necessary options
196	  needed by websocket console are set.
197endif
198
199# Hidden option to avoid having multiple individual options that are ORed together
200config HTTP
201	bool
202	depends on (HTTP_PARSER_URL || HTTP_PARSER || HTTP_CLIENT || HTTP_SERVER)
203	default y
204
205module = NET_HTTP
206module-dep = NET_LOG
207module-str = Log level for HTTP client library
208module-help = Enables HTTP client code to output debug messages.
209source "subsys/net/Kconfig.template.log_config.net"
210
211module = NET_HTTP_SERVER
212module-dep = NET_LOG
213module-str = Log level for HTTP server library
214module-help = Enables HTTP server code to output debug messages.
215source "subsys/net/Kconfig.template.log_config.net"
216