From 9ac2c5a0bb545a5dc48c7e0531346e40e426cf9b Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 22 Dec 2024 09:32:10 -0800 Subject: HTTP: intern the version and avoid allocation There are only a few possible reasonable values, and we can intern them to avoid any allocations for it. (We will probably do the same for the HTTP method shortly as well.) --- include/nng/supplemental/http/http.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/nng/supplemental/http/http.h b/include/nng/supplemental/http/http.h index fa81f984..bb163949 100644 --- a/include/nng/supplemental/http/http.h +++ b/include/nng/supplemental/http/http.h @@ -87,6 +87,11 @@ enum nng_http_status { NNG_HTTP_STATUS_NETWORK_AUTH_REQUIRED = 511, }; +#define NNG_HTTP_VERSION_1_0 "HTTP/1.0" +#define NNG_HTTP_VERSION_1_1 "HTTP/1.1" +#define NNG_HTTP_VERSION_2 "HTTP/2" +#define NNG_HTTP_VERSION_3 "HTTP/3" + // nng_http_req represents an HTTP request. typedef struct nng_http_req nng_http_req; -- cgit v1.2.3-70-g09d2