Module: HttpParser

Extended by:
FFI::Library
Defined in:
lib/http-parser.rb,
lib/http-parser/ext.rb,
lib/http-parser/types.rb,
lib/http-parser/errors.rb,
lib/http-parser/parser.rb,
lib/http-parser/version.rb

Defined Under Namespace

Classes: Error, FieldData, HttpParserUrl, Instance, Parser, Settings

Constant Summary collapse

HTTP_MAX_HEADER_SIZE =
(80 * 1024)
TYPES =

These share a byte of data as a bitmap

enum :http_parser_type, [
    :request, 0, 
    :response,
    :both
]
FLAG =
{
    :CHUNKED => 1 << 2,
    :CONNECTION_KEEP_ALIVE => 1 << 3,
    :CONNECTION_CLOSE => 1 << 4,
    :CONNECTION_UPGRADE => 1 << 5,
    :TRAILING => 1 << 6,
    :UPGRADE => 1 << 7,
    :SKIPBODY => 1 << 8
}
METHODS =

Request Methods

enum :http_method, [
    :DELETE, 0,
    :GET,
    :HEAD,
    :POST,
    :PUT,
    # pathological
    :CONNECT,
    :OPTIONS,
    :TRACE,
    # webdav
    :COPY,
    :LOCK,
    :MKCOL,
    :MOVE,
    :PROPFIND,
    :PROPPATCH,
    :SEARCH,
    :UNLOCK,
    :BIND,
    :REBIND,
    :UNBIND,
    :ACL,
    # subversion
    :REPORT,
    :MKACTIVITY,
    :CHECKOUT,
    :MERGE,
    # upnp
    :MSEARCH,
    :NOTIFY,
    :SUBSCRIBE,
    :UNSUBSCRIBE,
    # RFC-5789
    :PATCH,
    :PURGE,
    # CalDAV
    :MKCALENDAR,
    # RFC-2068, section 19.6.1.2
    :LINK,
    :UNLINK
]
UrlFields =
enum :http_parser_url_fields, [
    :SCHEMA, 0,
    :HOST,
    :PORT,
    :PATH,
    :QUERY,
    :FRAGMENT,
    :USERINFO,
    :MAX
]
ERRORS =
{
    :OK => Error::OK,

    :CB_message_begin => Error::CALLBACK,
    :CB_url => Error::CALLBACK,
    :CB_header_field => Error::CALLBACK,
    :CB_header_value => Error::CALLBACK,
    :CB_headers_complete => Error::CALLBACK,
    :CB_body => Error::CALLBACK,
    :CB_message_complete => Error::CALLBACK,
    :CB_status => Error::CALLBACK,
    :CB_chunk_header => Error::CALLBACK,
    :CB_chunk_complete => Error::CALLBACK,

    :INVALID_EOF_STATE => Error::INVALID_EOF_STATE,
    :HEADER_OVERFLOW => Error::HEADER_OVERFLOW,
    :CLOSED_CONNECTION => Error::CLOSED_CONNECTION,
    :INVALID_VERSION => Error::INVALID_VERSION,
    :INVALID_STATUS => Error::INVALID_STATUS,
    :INVALID_METHOD => Error::INVALID_METHOD,
    :INVALID_URL => Error::INVALID_URL,
    :INVALID_HOST => Error::INVALID_HOST,
    :INVALID_PORT => Error::INVALID_PORT,
    :INVALID_PATH => Error::INVALID_PATH,
    :INVALID_QUERY_STRING => Error::INVALID_QUERY_STRING,
    :INVALID_FRAGMENT => Error::INVALID_FRAGMENT,
    :LF_EXPECTED => Error::LF_EXPECTED,
    :INVALID_HEADER_TOKEN => Error::INVALID_HEADER_TOKEN,
    :INVALID_CONTENT_LENGTH => Error::INVALID_CONTENT_LENGTH,
    :INVALID_CHUNK_SIZE => Error::INVALID_CHUNK_SIZE,
    :INVALID_CONSTANT => Error::INVALID_CONSTANT,
    :INVALID_INTERNAL_STATE => Error::INVALID_INTERNAL_STATE,
    :STRICT => Error::STRICT,
    :PAUSED => Error::PAUSED,

    :UNKNOWN => Error::UNKNOWN
}
VERSION =
"1.2.3"