# Copyright (c) 2016 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

config HTTP_PARSER
	bool "HTTP Parser support"
	select HTTP_PARSER_URL
	help
	  This option enables the http_parser library from nodejs.
	  This parser requires some string-related routines commonly
	  provided by a libc implementation.

config HTTP_PARSER_URL
	bool "HTTP Parser for URL support"
	help
	  This option enables the URI parser library based on source from nodejs.
	  This parser requires some string-related routines commonly
	  provided by a libc implementation.

config HTTP_PARSER_STRICT
	bool "HTTP strict parsing"
	depends on (HTTP_PARSER || HTTP_PARSER_URL)
	help
	  This option enables the strict parsing option

config HTTP_CLIENT
	bool "HTTP client API"
	select HTTP_PARSER
	select HTTP_PARSER_URL
	help
	  HTTP client API

config HTTP_SERVER
	bool "HTTP Server [EXPERIMENTAL]"
	select HTTP_PARSER
	select HTTP_PARSER_URL
	select EXPERIMENTAL
	help
	  HTTP1 and HTTP2 server support.

if HTTP_SERVER

config HTTP_SERVER_STACK_SIZE
	int "HTTP server thread stack size"
	default 3072
	help
	  HTTP server thread stack size for processing RX/TX events.

config HTTP_SERVER_NUM_SERVICES
	int "Number of HTTP Server Instances"
	default 1
	range 1 100
	help
	  This setting determines the number of http services that the server supports.

config HTTP_SERVER_MAX_CLIENTS
	int "Max number of HTTP/2 clients"
	default 3
	range 1 100
	help
	  This setting determines the maximum number of HTTP/2 clients that the server can handle at once.

config HTTP_SERVER_MAX_STREAMS
	int "Max number of HTTP/2 streams"
	default 10
	range 1 100
	help
	  This setting determines the maximum number of HTTP/2 streams for each client.

config HTTP_SERVER_CLIENT_BUFFER_SIZE
	int "Client Buffer Size"
	default 256
	range 64 4294967295
	help
	  This setting determines the buffer size for each client.

config HTTP_SERVER_HUFFMAN_DECODE_BUFFER_SIZE
	int "Size of the buffer used for decoding Huffman-encoded strings"
	default 256
	range 64 4294967295
	help
	  Size of the buffer used for decoding Huffman-encoded strings when
	  processing HPACK compressed headers. This effectively limits the
	  maximum length of an individual HTTP header supported.

config HTTP_SERVER_MAX_URL_LENGTH
	int "Maximum HTTP URL Length"
	default 256
	range 32 2048
	help
	  This setting determines the maximum length of the HTTP URL that the server can process.

config HTTP_SERVER_MAX_CONTENT_TYPE_LENGTH
	int "Maximum HTTP Content-Type Length"
	default 64
	range 1 128
	help
	  This setting determines the maximum length of the HTTP Content-Length field.

config HTTP_SERVER_CLIENT_INACTIVITY_TIMEOUT
	int "Client inactivity timeout (seconds)"
	default 10
	range 1 86400
	help
	  This timeout specifies maximum time the client may remain inactive
	  (i. e. not sending or receiving any data) before the server drops the
	  connection.

config HTTP_SERVER_WEBSOCKET
	bool "Allow upgrading to Websocket connection"
	select WEBSOCKET_CLIENT
	select WEBSOCKET
	help
	  If this is enabled, then the user can allow the HTTP connection to be
	  upgraded to a Websocket connection. The user can then define a Websocket
	  handler that is called after upgrading to handle the Websocket network
	  traffic.

config HTTP_SERVER_RESOURCE_WILDCARD
	bool "Allow wildcard matching of resources"
	select FNMATCH
	help
	  Allow user to specify wildcards when setting up resource strings.
	  This means that instead of specifying multiple resources with exact
	  string matches, one resource handler could handle multiple URLs.

config HTTP_SERVER_RESTART_DELAY
	int "Delay before re-initialization when restarting server"
	default 1000
	range 1 60000
	help
	  In case server restarts for any reason, the server re-initialization
	  will be delayed by this value (miliseconds). The delay is needed to
	  allow any existing connections to finalize to avoid binding errors
	  during initialization.

endif

# Hidden option to avoid having multiple individual options that are ORed together
config HTTP
	bool
	depends on (HTTP_PARSER_URL || HTTP_PARSER || HTTP_CLIENT || HTTP_SERVER)
	default y

module = NET_HTTP
module-dep = NET_LOG
module-str = Log level for HTTP client library
module-help = Enables HTTP client code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"

module = NET_HTTP_SERVER
module-dep = NET_LOG
module-str = Log level for HTTP server library
module-help = Enables HTTP server code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
