#include "root.h"

#include "HTTPHeaderNames.h"

// This is a separate file so we avoid creating these static initializers in several files.

namespace WTF {

const WTF::String& httpHeaderNameStringImpl(WebCore::HTTPHeaderName headerName)
{
    static const NeverDestroyed<String> staticHeaderNames[] = {
        MAKE_STATIC_STRING_IMPL("accept"),
        MAKE_STATIC_STRING_IMPL("accept-charset"),
        MAKE_STATIC_STRING_IMPL("accept-encoding"),
        MAKE_STATIC_STRING_IMPL("accept-language"),
        MAKE_STATIC_STRING_IMPL("accept-ranges"),
        MAKE_STATIC_STRING_IMPL("access-control-allow-credentials"),
        MAKE_STATIC_STRING_IMPL("access-control-allow-headers"),
        MAKE_STATIC_STRING_IMPL("access-control-allow-methods"),
        MAKE_STATIC_STRING_IMPL("access-control-allow-origin"),
        MAKE_STATIC_STRING_IMPL("access-control-expose-headers"),
        MAKE_STATIC_STRING_IMPL("access-control-max-age"),
        MAKE_STATIC_STRING_IMPL("access-control-request-headers"),
        MAKE_STATIC_STRING_IMPL("access-control-request-method"),
        MAKE_STATIC_STRING_IMPL("age"),
        MAKE_STATIC_STRING_IMPL("authorization"),
        MAKE_STATIC_STRING_IMPL("cache-control"),
        MAKE_STATIC_STRING_IMPL("connection"),
        MAKE_STATIC_STRING_IMPL("content-disposition"),
        MAKE_STATIC_STRING_IMPL("content-encoding"),
        MAKE_STATIC_STRING_IMPL("content-language"),
        MAKE_STATIC_STRING_IMPL("content-length"),
        MAKE_STATIC_STRING_IMPL("content-location"),
        MAKE_STATIC_STRING_IMPL("content-range"),
        MAKE_STATIC_STRING_IMPL("content-security-policy"),
        MAKE_STATIC_STRING_IMPL("content-security-policy-report-only"),
        MAKE_STATIC_STRING_IMPL("content-type"),
        MAKE_STATIC_STRING_IMPL("cookie"),
        MAKE_STATIC_STRING_IMPL("cookie2"),
        MAKE_STATIC_STRING_IMPL("cross-origin-embedder-policy"),
        MAKE_STATIC_STRING_IMPL("cross-origin-embedder-policy-report-only"),
        MAKE_STATIC_STRING_IMPL("cross-origin-opener-policy"),
        MAKE_STATIC_STRING_IMPL("cross-origin-opener-policy-report-only"),
        MAKE_STATIC_STRING_IMPL("cross-origin-resource-policy"),
        MAKE_STATIC_STRING_IMPL("dnt"),
        MAKE_STATIC_STRING_IMPL("date"),
        MAKE_STATIC_STRING_IMPL("default-style"),
        MAKE_STATIC_STRING_IMPL("etag"),
        MAKE_STATIC_STRING_IMPL("expect"),
        MAKE_STATIC_STRING_IMPL("expires"),
        MAKE_STATIC_STRING_IMPL("host"),
        MAKE_STATIC_STRING_IMPL("icy-metaint"),
        MAKE_STATIC_STRING_IMPL("icy-metadata"),
        MAKE_STATIC_STRING_IMPL("if-match"),
        MAKE_STATIC_STRING_IMPL("if-modified-since"),
        MAKE_STATIC_STRING_IMPL("if-none-match"),
        MAKE_STATIC_STRING_IMPL("if-range"),
        MAKE_STATIC_STRING_IMPL("if-unmodified-since"),
        MAKE_STATIC_STRING_IMPL("keep-alive"),
        MAKE_STATIC_STRING_IMPL("last-event-id"),
        MAKE_STATIC_STRING_IMPL("last-modified"),
        MAKE_STATIC_STRING_IMPL("link"),
        MAKE_STATIC_STRING_IMPL("location"),
        MAKE_STATIC_STRING_IMPL("origin"),
        MAKE_STATIC_STRING_IMPL("ping-from"),
        MAKE_STATIC_STRING_IMPL("ping-to"),
        MAKE_STATIC_STRING_IMPL("pragma"),
        MAKE_STATIC_STRING_IMPL("proxy-authorization"),
        MAKE_STATIC_STRING_IMPL("purpose"),
        MAKE_STATIC_STRING_IMPL("range"),
        MAKE_STATIC_STRING_IMPL("referer"),
        MAKE_STATIC_STRING_IMPL("referrer-policy"),
        MAKE_STATIC_STRING_IMPL("refresh"),
        MAKE_STATIC_STRING_IMPL("report-to"),
        MAKE_STATIC_STRING_IMPL("sec-fetch-dest"),
        MAKE_STATIC_STRING_IMPL("sec-fetch-mode"),
        MAKE_STATIC_STRING_IMPL("sec-websocket-accept"),
        MAKE_STATIC_STRING_IMPL("sec-websocket-extensions"),
        MAKE_STATIC_STRING_IMPL("sec-websocket-key"),
        MAKE_STATIC_STRING_IMPL("sec-websocket-protocol"),
        MAKE_STATIC_STRING_IMPL("sec-websocket-version"),
        MAKE_STATIC_STRING_IMPL("server-timing"),
        MAKE_STATIC_STRING_IMPL("service-worker"),
        MAKE_STATIC_STRING_IMPL("service-worker-allowed"),
        MAKE_STATIC_STRING_IMPL("service-worker-navigation-preload"),
        MAKE_STATIC_STRING_IMPL("set-cookie"),
        MAKE_STATIC_STRING_IMPL("set-cookie2"),
        MAKE_STATIC_STRING_IMPL("sourcemap"),
        MAKE_STATIC_STRING_IMPL("strict-transport-security"),
        MAKE_STATIC_STRING_IMPL("te"),
        MAKE_STATIC_STRING_IMPL("timing-allow-origin"),
        MAKE_STATIC_STRING_IMPL("trailer"),
        MAKE_STATIC_STRING_IMPL("transfer-encoding"),
        MAKE_STATIC_STRING_IMPL("upgrade"),
        MAKE_STATIC_STRING_IMPL("upgrade-insecure-requests"),
        MAKE_STATIC_STRING_IMPL("user-agent"),
        MAKE_STATIC_STRING_IMPL("vary"),
        MAKE_STATIC_STRING_IMPL("via"),
        MAKE_STATIC_STRING_IMPL("x-content-type-options"),
        MAKE_STATIC_STRING_IMPL("x-dns-prefetch-control"),
        MAKE_STATIC_STRING_IMPL("x-frame-options"),
        MAKE_STATIC_STRING_IMPL("x-sourcemap"),
        MAKE_STATIC_STRING_IMPL("x-temp-tablet"),
        MAKE_STATIC_STRING_IMPL("x-xss-protection"),
    };

    return staticHeaderNames[static_cast<size_t>(headerName)];
}
const WTF::String& httpHeaderNameDefaultCaseStringImpl(WebCore::HTTPHeaderName headerName)
{
    static const NeverDestroyed<String> staticHeaderNamesDefaultCase[] = {
        MAKE_STATIC_STRING_IMPL("Accept"),
        MAKE_STATIC_STRING_IMPL("Accept-Charset"),
        MAKE_STATIC_STRING_IMPL("Accept-Encoding"),
        MAKE_STATIC_STRING_IMPL("Accept-Language"),
        MAKE_STATIC_STRING_IMPL("Accept-Ranges"),
        MAKE_STATIC_STRING_IMPL("Access-Control-Allow-Credentials"),
        MAKE_STATIC_STRING_IMPL("Access-Control-Allow-Headers"),
        MAKE_STATIC_STRING_IMPL("Access-Control-Allow-Methods"),
        MAKE_STATIC_STRING_IMPL("Access-Control-Allow-Origin"),
        MAKE_STATIC_STRING_IMPL("Access-Control-Expose-Headers"),
        MAKE_STATIC_STRING_IMPL("Access-Control-Max-Age"),
        MAKE_STATIC_STRING_IMPL("Access-Control-Request-Headers"),
        MAKE_STATIC_STRING_IMPL("Access-Control-Request-Method"),
        MAKE_STATIC_STRING_IMPL("Age"),
        MAKE_STATIC_STRING_IMPL("Authorization"),
        MAKE_STATIC_STRING_IMPL("Cache-Control"),
        MAKE_STATIC_STRING_IMPL("Connection"),
        MAKE_STATIC_STRING_IMPL("Content-Disposition"),
        MAKE_STATIC_STRING_IMPL("Content-Encoding"),
        MAKE_STATIC_STRING_IMPL("Content-Language"),
        MAKE_STATIC_STRING_IMPL("Content-Length"),
        MAKE_STATIC_STRING_IMPL("Content-Location"),
        MAKE_STATIC_STRING_IMPL("Content-Range"),
        MAKE_STATIC_STRING_IMPL("Content-Security-Policy"),
        MAKE_STATIC_STRING_IMPL("Content-Security-Policy-Report-Only"),
        MAKE_STATIC_STRING_IMPL("Content-Type"),
        MAKE_STATIC_STRING_IMPL("Cookie"),
        MAKE_STATIC_STRING_IMPL("Cookie2"),
        MAKE_STATIC_STRING_IMPL("Cross-Origin-Embedder-Policy"),
        MAKE_STATIC_STRING_IMPL("Cross-Origin-Embedder-Policy-Report-Only"),
        MAKE_STATIC_STRING_IMPL("Cross-Origin-Opener-Policy"),
        MAKE_STATIC_STRING_IMPL("Cross-Origin-Opener-Policy-Report-Only"),
        MAKE_STATIC_STRING_IMPL("Cross-Origin-Resource-Policy"),
        MAKE_STATIC_STRING_IMPL("DNT"),
        MAKE_STATIC_STRING_IMPL("Date"),
        MAKE_STATIC_STRING_IMPL("Default-Style"),
        MAKE_STATIC_STRING_IMPL("ETag"),
        MAKE_STATIC_STRING_IMPL("Expect"),
        MAKE_STATIC_STRING_IMPL("Expires"),
        MAKE_STATIC_STRING_IMPL("Host"),
        MAKE_STATIC_STRING_IMPL("Icy-Metaint"),
        MAKE_STATIC_STRING_IMPL("Icy-Metadata"),
        MAKE_STATIC_STRING_IMPL("If-Match"),
        MAKE_STATIC_STRING_IMPL("If-Modified-Since"),
        MAKE_STATIC_STRING_IMPL("If-None-Match"),
        MAKE_STATIC_STRING_IMPL("If-Range"),
        MAKE_STATIC_STRING_IMPL("If-Unmodified-Since"),
        MAKE_STATIC_STRING_IMPL("Keep-Alive"),
        MAKE_STATIC_STRING_IMPL("Last-Event-Id"),
        MAKE_STATIC_STRING_IMPL("Last-Modified"),
        MAKE_STATIC_STRING_IMPL("Link"),
        MAKE_STATIC_STRING_IMPL("Location"),
        MAKE_STATIC_STRING_IMPL("Origin"),
        MAKE_STATIC_STRING_IMPL("Ping-From"),
        MAKE_STATIC_STRING_IMPL("Ping-To"),
        MAKE_STATIC_STRING_IMPL("Pragma"),
        MAKE_STATIC_STRING_IMPL("Proxy-Authorization"),
        MAKE_STATIC_STRING_IMPL("Purpose"),
        MAKE_STATIC_STRING_IMPL("Range"),
        MAKE_STATIC_STRING_IMPL("Referer"),
        MAKE_STATIC_STRING_IMPL("Referrer-Policy"),
        MAKE_STATIC_STRING_IMPL("Refresh"),
        MAKE_STATIC_STRING_IMPL("Report-To"),
        MAKE_STATIC_STRING_IMPL("Sec-Fetch-Dest"),
        MAKE_STATIC_STRING_IMPL("Sec-Fetch-Mode"),
        MAKE_STATIC_STRING_IMPL("Sec-WebSocket-Accept"),
        MAKE_STATIC_STRING_IMPL("Sec-WebSocket-Extensions"),
        MAKE_STATIC_STRING_IMPL("Sec-WebSocket-Key"),
        MAKE_STATIC_STRING_IMPL("Sec-WebSocket-Protocol"),
        MAKE_STATIC_STRING_IMPL("Sec-WebSocket-Version"),
        MAKE_STATIC_STRING_IMPL("Server-Timing"),
        MAKE_STATIC_STRING_IMPL("Service-Worker"),
        MAKE_STATIC_STRING_IMPL("Service-Worker-Allowed"),
        MAKE_STATIC_STRING_IMPL("Service-Worker-Navigation-Preload"),
        MAKE_STATIC_STRING_IMPL("Set-Cookie"),
        MAKE_STATIC_STRING_IMPL("Set-Cookie2"),
        MAKE_STATIC_STRING_IMPL("Sourcemap"),
        MAKE_STATIC_STRING_IMPL("Strict-Transport-Security"),
        MAKE_STATIC_STRING_IMPL("TE"),
        MAKE_STATIC_STRING_IMPL("Timing-Allow-Origin"),
        MAKE_STATIC_STRING_IMPL("Trailer"),
        MAKE_STATIC_STRING_IMPL("Transfer-Encoding"),
        MAKE_STATIC_STRING_IMPL("Upgrade"),
        MAKE_STATIC_STRING_IMPL("Upgrade-Insecure-Requests"),
        MAKE_STATIC_STRING_IMPL("User-Agent"),
        MAKE_STATIC_STRING_IMPL("Vary"),
        MAKE_STATIC_STRING_IMPL("Via"),
        MAKE_STATIC_STRING_IMPL("X-Content-Type-Options"),
        MAKE_STATIC_STRING_IMPL("X-DNS-Prefetch-Control"),
        MAKE_STATIC_STRING_IMPL("X-Frame-Options"),
        MAKE_STATIC_STRING_IMPL("X-Sourcemap"),
        MAKE_STATIC_STRING_IMPL("X-Temp-Tablet"),
        MAKE_STATIC_STRING_IMPL("X-XSS-Protection"),
    };

    return staticHeaderNamesDefaultCase[static_cast<size_t>(headerName)];
}

}
