Navigation Menu

Skip to content

Commit

Permalink
http: add priority to common http headers
Browse files Browse the repository at this point in the history
The standard `Priority` header is defined in RFC 9218.

This is added as part of the precusor to quic/http3 work.

Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: #45045
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
jasnell authored and danielleadams committed Jan 3, 2023
1 parent cd911d7 commit f222c95
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 55 deletions.
111 changes: 56 additions & 55 deletions src/node_http_common.h
Expand Up @@ -24,61 +24,62 @@ class Environment;
V(PATH, ":path") \
V(PROTOCOL, ":protocol")

#define HTTP_REGULAR_HEADERS(V) \
V(ACCEPT_ENCODING, "accept-encoding") \
V(ACCEPT_LANGUAGE, "accept-language") \
V(ACCEPT_RANGES, "accept-ranges") \
V(ACCEPT, "accept") \
V(ACCESS_CONTROL_ALLOW_CREDENTIALS, "access-control-allow-credentials") \
V(ACCESS_CONTROL_ALLOW_HEADERS, "access-control-allow-headers") \
V(ACCESS_CONTROL_ALLOW_METHODS, "access-control-allow-methods") \
V(ACCESS_CONTROL_ALLOW_ORIGIN, "access-control-allow-origin") \
V(ACCESS_CONTROL_EXPOSE_HEADERS, "access-control-expose-headers") \
V(ACCESS_CONTROL_REQUEST_HEADERS, "access-control-request-headers") \
V(ACCESS_CONTROL_REQUEST_METHOD, "access-control-request-method") \
V(AGE, "age") \
V(AUTHORIZATION, "authorization") \
V(CACHE_CONTROL, "cache-control") \
V(CONNECTION, "connection") \
V(CONTENT_DISPOSITION, "content-disposition") \
V(CONTENT_ENCODING, "content-encoding") \
V(CONTENT_LENGTH, "content-length") \
V(CONTENT_TYPE, "content-type") \
V(COOKIE, "cookie") \
V(DATE, "date") \
V(ETAG, "etag") \
V(FORWARDED, "forwarded") \
V(HOST, "host") \
V(IF_MODIFIED_SINCE, "if-modified-since") \
V(IF_NONE_MATCH, "if-none-match") \
V(IF_RANGE, "if-range") \
V(LAST_MODIFIED, "last-modified") \
V(LINK, "link") \
V(LOCATION, "location") \
V(RANGE, "range") \
V(REFERER, "referer") \
V(SERVER, "server") \
V(SET_COOKIE, "set-cookie") \
V(STRICT_TRANSPORT_SECURITY, "strict-transport-security") \
V(TRANSFER_ENCODING, "transfer-encoding") \
V(TE, "te") \
V(UPGRADE_INSECURE_REQUESTS, "upgrade-insecure-requests") \
V(UPGRADE, "upgrade") \
V(USER_AGENT, "user-agent") \
V(VARY, "vary") \
V(X_CONTENT_TYPE_OPTIONS, "x-content-type-options") \
V(X_FRAME_OPTIONS, "x-frame-options") \
V(KEEP_ALIVE, "keep-alive") \
V(PROXY_CONNECTION, "proxy-connection") \
V(X_XSS_PROTECTION, "x-xss-protection") \
V(ALT_SVC, "alt-svc") \
V(CONTENT_SECURITY_POLICY, "content-security-policy") \
V(EARLY_DATA, "early-data") \
V(EXPECT_CT, "expect-ct") \
V(ORIGIN, "origin") \
V(PURPOSE, "purpose") \
V(TIMING_ALLOW_ORIGIN, "timing-allow-origin") \
V(X_FORWARDED_FOR, "x-forwarded-for")
#define HTTP_REGULAR_HEADERS(V) \
V(ACCEPT_ENCODING, "accept-encoding") \
V(ACCEPT_LANGUAGE, "accept-language") \
V(ACCEPT_RANGES, "accept-ranges") \
V(ACCEPT, "accept") \
V(ACCESS_CONTROL_ALLOW_CREDENTIALS, "access-control-allow-credentials") \
V(ACCESS_CONTROL_ALLOW_HEADERS, "access-control-allow-headers") \
V(ACCESS_CONTROL_ALLOW_METHODS, "access-control-allow-methods") \
V(ACCESS_CONTROL_ALLOW_ORIGIN, "access-control-allow-origin") \
V(ACCESS_CONTROL_EXPOSE_HEADERS, "access-control-expose-headers") \
V(ACCESS_CONTROL_REQUEST_HEADERS, "access-control-request-headers") \
V(ACCESS_CONTROL_REQUEST_METHOD, "access-control-request-method") \
V(AGE, "age") \
V(AUTHORIZATION, "authorization") \
V(CACHE_CONTROL, "cache-control") \
V(CONNECTION, "connection") \
V(CONTENT_DISPOSITION, "content-disposition") \
V(CONTENT_ENCODING, "content-encoding") \
V(CONTENT_LENGTH, "content-length") \
V(CONTENT_TYPE, "content-type") \
V(COOKIE, "cookie") \
V(DATE, "date") \
V(ETAG, "etag") \
V(FORWARDED, "forwarded") \
V(HOST, "host") \
V(IF_MODIFIED_SINCE, "if-modified-since") \
V(IF_NONE_MATCH, "if-none-match") \
V(IF_RANGE, "if-range") \
V(LAST_MODIFIED, "last-modified") \
V(LINK, "link") \
V(LOCATION, "location") \
V(RANGE, "range") \
V(REFERER, "referer") \
V(SERVER, "server") \
V(SET_COOKIE, "set-cookie") \
V(STRICT_TRANSPORT_SECURITY, "strict-transport-security") \
V(TRANSFER_ENCODING, "transfer-encoding") \
V(TE, "te") \
V(UPGRADE_INSECURE_REQUESTS, "upgrade-insecure-requests") \
V(UPGRADE, "upgrade") \
V(USER_AGENT, "user-agent") \
V(VARY, "vary") \
V(X_CONTENT_TYPE_OPTIONS, "x-content-type-options") \
V(X_FRAME_OPTIONS, "x-frame-options") \
V(KEEP_ALIVE, "keep-alive") \
V(PROXY_CONNECTION, "proxy-connection") \
V(X_XSS_PROTECTION, "x-xss-protection") \
V(ALT_SVC, "alt-svc") \
V(CONTENT_SECURITY_POLICY, "content-security-policy") \
V(EARLY_DATA, "early-data") \
V(EXPECT_CT, "expect-ct") \
V(ORIGIN, "origin") \
V(PURPOSE, "purpose") \
V(TIMING_ALLOW_ORIGIN, "timing-allow-origin") \
V(X_FORWARDED_FOR, "x-forwarded-for") \
V(PRIORITY, "priority")

#define HTTP_ADDITIONAL_HEADERS(V) \
V(ACCEPT_CHARSET, "accept-charset") \
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-http2-binding.js
Expand Up @@ -180,6 +180,7 @@ const expectedHeaderNames = {
HTTP2_HEADER_PURPOSE: 'purpose',
HTTP2_HEADER_TIMING_ALLOW_ORIGIN: 'timing-allow-origin',
HTTP2_HEADER_X_FORWARDED_FOR: 'x-forwarded-for',
HTTP2_HEADER_PRIORITY: 'priority',
};

const expectedNGConstants = {
Expand Down

0 comments on commit f222c95

Please sign in to comment.