nodejs / llhttp

Port of http_parser to llparse

Home Page:http://llhttp.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add the missed status code support

aengusjiang opened this issue · comments

please add the missed status code support, status code list could be like below:
#define HTTP_STATUS_MAP(XX)
XX(100, CONTINUE, Continue)
XX(101, SWITCHING_PROTOCOLS, Switching Protocols)
XX(102, PROCESSING, Processing)
XX(103, EARLY_HINTS, Early Hints)
XX(110, RSP_IS_STALE, Response is Stale)
XX(111, REVALIDATE_FAILED, Revalidation Failed)
XX(112, DISCONNECT, Miscellaneous Warning)
XX(113, HEURISTIC_EXPIRATION, Transformation Applied)
XX(199, MISCELLANEOUS_WARNING, Miscellaneous Warning)
XX(200, OK, OK)
XX(201, CREATED, Created)
XX(202, ACCEPTED, Accepted)
XX(203, NON_AUTHORITATIVE_INFORMATION, Non-Authoritative Information)
XX(204, NO_CONTENT, No Content)
XX(205, RESET_CONTENT, Reset Content)
XX(206, PARTIAL_CONTENT, Partial Content)
XX(207, MULTI_STATUS, Multi-Status)
XX(208, ALREADY_REPORTED, Already Reported)
XX(214, TRANSFORMATION_APPLIED, Transformation Applied)
XX(226, IM_USED, IM Used)
XX(299, MISCELLANEOUS_PERSISTENT_WARNING,Miscellaneous Persistent Warning)
XX(300, MULTIPLE_CHOICES, Multiple Choices)
XX(301, MOVED_PERMANENTLY, Moved Permanently)
XX(302, FOUND, Found)
XX(303, SEE_OTHER, See Other)
XX(304, NOT_MODIFIED, Not Modified)
XX(305, USE_PROXY, Use Proxy)
XX(307, TEMPORARY_REDIRECT, Temporary Redirect)
XX(308, PERMANENT_REDIRECT, Permanent Redirect)
XX(400, BAD_REQUEST, Bad Request)
XX(401, UNAUTHORIZED, Unauthorized)
XX(402, PAYMENT_REQUIRED, Payment Required)
XX(403, FORBIDDEN, Forbidden)
XX(404, NOT_FOUND, Not Found)
XX(405, METHOD_NOT_ALLOWED, Method Not Allowed)
XX(406, NOT_ACCEPTABLE, Not Acceptable)
XX(407, PROXY_AUTHENTICATION_REQUIRED, Proxy Authentication Required)
XX(408, REQUEST_TIMEOUT, Request Timeout)
XX(409, CONFLICT, Conflict)
XX(410, GONE, Gone)
XX(411, LENGTH_REQUIRED, Length Required)
XX(412, PRECONDITION_FAILED, Precondition Failed)
XX(413, PAYLOAD_TOO_LARGE, Payload Too Large)
XX(414, URI_TOO_LONG, URI Too Long)
XX(415, UNSUPPORTED_MEDIA_TYPE, Unsupported Media Type)
XX(416, RANGE_NOT_SATISFIABLE, Range Not Satisfiable)
XX(417, EXPECTATION_FAILED, Expectation Failed)
XX(418, I_AM_A_TEAPOT, I am a teapot)
XX(419, PAGE_EXPIRED, Page Expired)
XX(420, METHOD_FAILURE, Method Failure)
XX(421, MISDIRECTED_REQUEST, Misdirected Request)
XX(422, UNPROCESSABLE_ENTITY, Unprocessable Entity)
XX(423, LOCKED, Locked)
XX(424, FAILED_DEPENDENCY, Failed Dependency)
XX(426, UPGRADE_REQUIRED, Upgrade Required)
XX(428, PRECONDITION_REQUIRED, Precondition Required)
XX(429, TOO_MANY_REQUESTS, Too Many Requests)
XX(430, REQ_HEADER_FIELDS_TOO_LARGE, Request Header Fields Too Large)
XX(431, REQUEST_HEADER_FIELDS_TOO_LARGE, Request Header Fields Too Large)
XX(440, LOGIN_TIME_OUT, Login Time-out)
XX(444, NO_RESPONSE, No Response)
XX(449, RETRY_WITH, Retry With)
XX(450, BLOCKED_BY_WINDOWS_PARENTAL_CONTROLS, Blocked by Windows Parental Controls)
XX(451, UNAVAILABLE_FOR_LEGAL_REASONS, Unavailable For Legal Reasons)
XX(500, INTERNAL_SERVER_ERROR, Internal Server Error)
XX(501, NOT_IMPLEMENTED, Not Implemented)
XX(502, BAD_GATEWAY, Bad Gateway)
XX(503, SERVICE_UNAVAILABLE, Service Unavailable)
XX(504, GATEWAY_TIMEOUT, Gateway Timeout)
XX(505, HTTP_VERSION_NOT_SUPPORTED, HTTP Version Not Supported)
XX(506, VARIANT_ALSO_NEGOTIATES, Variant Also Negotiates)
XX(507, INSUFFICIENT_STORAGE, Insufficient Storage)
XX(508, LOOP_DETECTED, Loop Detected)
XX(509, BANDWIDTH_LIMIT_EXCEEDED, Bandwidth Limit Exceeded)
XX(510, NOT_EXTENDED, Not Extended)
XX(511, NETWORK_AUTHENTICATION_REQUIRED, Network Authentication Required)
XX(520, WEB_SERVER_RETURNED_AN_UNKNOWN_ERROR, Web Server Returned an Unknown Error)
XX(521, WEB_SERVER_IS_DOWN, Web Server Is Down)
XX(522, CONNECTION_TIMED_OUT, Connection Timed Out)
XX(523, ORIGIN_IS_UNREACHABLE, Origin Is Unreachable)
XX(524, A_TIMEOUT_OCCURRED, A Timeout Occurred)
XX(525, SSL_HANDSHAKE_FAILED, SSL Handshake Failed)
XX(526, INVALID_SSL_CERTIFICATE, Invalid SSL Certificate)
XX(527, RAILGUN_ERROR, Railgun Error)
XX(529, SITE_IS_OVERLOADED, Site is overloaded)
XX(530, SITE_IS_FROZEN, Site is frozen)
XX(561, UNAUTHORIZED2, Unauthorized)
XX(598, NETWORK_READ_TIMEOUT_ERROR, Network read timeout error)
XX(599, NETWORK_CONNECT_TIMEOUT_ERROR, Network Connect Timeout Error) \

This has been fixed in #179.

It seem not the full status code fixed in #179 .
such as
XX(110, RSP_IS_STALE, Response is Stale)
XX(111, REVALIDATE_FAILED, Revalidation Failed)
XX(112, DISCONNECT, Miscellaneous Warning)
XX(113, HEURISTIC_EXPIRATION, Transformation Applied)

I think it still missing many status code. please check.

see https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

because the api llhttp_status_name will abort when the status is missed, so it need a full implement.
image