cosmopolitan/net/http/gethttpheader.gperf
Justine Tunney 1966369e8e Fix bugs and make improvements
- Fix regression with `%lu`
- Added some more headers witnessed in the wild
- Added `-M INT` option to redbean to tune max payload size
- Work around InfoZIP 256 character limit on comment line size
2021-05-01 05:11:35 -07:00

87 lines
4 KiB
Text

%{
#include "libc/str/str.h"
#include "net/http/http.h"
#define GPERF_DOWNCASE
%}
%compare-strncmp
%ignore-case
%language=ANSI-C
%readonly-tables
%struct-type
%define lookup-function-name LookupHttpHeader
struct thatispacked HttpHeaderSlot { char *name; char code; };
%%
Host, kHttpHost
Cache-Control, kHttpCacheControl
Connection, kHttpConnection
Accept, kHttpAccept
Accept-Language, kHttpAcceptLanguage
Accept-Encoding, kHttpAcceptEncoding
User-Agent, kHttpUserAgent
Referer, kHttpReferer
X-Forwarded-For, kHttpXForwardedFor
Origin, kHttpOrigin
Upgrade-Insecure-Requests, kHttpUpgradeInsecureRequests
Pragma, kHttpPragma
Cookie, kHttpCookie
DNT, kHttpDnt
Sec-GPC, kHttpSecGpc
From, kHttpFrom
If-Modified-Since, kHttpIfModifiedSince
X-Requested-With, kHttpXRequestedWith
X-Forwarded-Host, kHttpXForwardedHost
X-Forwarded-Proto, kHttpXForwardedProto
X-CSRF-Token, kHttpXCsrfToken
Save-Data, kHttpSaveData
Range, kHttpRange
Content-Length, kHttpContentLength
Content-Type, kHttpContentType
Vary, kHttpVary
Date, kHttpDate
Server, kHttpServer
Expires, kHttpExpires
Content-Encoding, kHttpContentEncoding
Last-Modified, kHttpLastModified
ETag, kHttpEtag
Allow, kHttpAllow
Content-Range, kHttpContentRange
Accept-Charset, kHttpAcceptCharset
Access-Control-Allow-Credentials, kHttpAccessControlAllowCredentials
Access-Control-Allow-Headers, kHttpAccessControlAllowHeaders
Access-Control-Allow-Methods, kHttpAccessControlAllowMethods
Access-Control-Allow-Origin, kHttpAccessControlAllowOrigin
Access-Control-MaxAge, kHttpAccessControlMaxAge
Access-Control-Method, kHttpAccessControlMethod
Access-Control-RequestHeaders, kHttpAccessControlRequestHeaders
Access-Control-Request-Method, kHttpAccessControlRequestMethod
Access-Control-Request-Methods, kHttpAccessControlRequestMethods
Age, kHttpAge
Authorization, kHttpAuthorization
Content-Base, kHttpContentBase
Content-Description, kHttpContentDescription
Content-Disposition, kHttpContentDisposition
Content-Language, kHttpContentLanguage
Content-Location, kHttpContentLocation
Content-MD5, kHttpContentMd5
Expect, kHttpExpect
If-Match, kHttpIfMatch
If-None-Match, kHttpIfNoneMatch
If-Range, kHttpIfRange
If-Unmodified-Since, kHttpIfUnmodifiedSince
Keep-Alive, kHttpKeepAlive
Link, kHttpLink
Location, kHttpLocation
Max-Forwards, kHttpMaxForwards
Proxy-Authenticate, kHttpProxyAuthenticate
Proxy-Authorization, kHttpProxyAuthorization
Proxy-Connection, kHttpProxyConnection
Public, kHttpPublic
Retry-After, kHttpRetryAfter
TE, kHttpTe
Trailer, kHttpTrailer
Transfer-Encoding, kHttpTransferEncoding
Upgrade, kHttpUpgrade
Uri, kHttpUri
Warning, kHttpWarning
WWW-Authenticate, kHttpWwwAuthenticate
Via, kHttpVia