Internal Interfaces
Parser Interface
HTTP.Parsers.find_end_of_header — Functionfind_end_of_header(bytes) -> length or 0Find length of header delimited by \r\n\r\n or \n\n.
HTTP.Parsers.find_end_of_chunk_size — FunctionFind \n after chunk size in bytes.
HTTP.Parsers.find_end_of_trailer — Functionfind_end_of_trailer(bytes) -> length or 0Find length of trailer delimited by \r\n\r\n (or starting with \r\n). RFC7230 4.1
HTTP.Parsers.parse_status_line! — FunctionParse HTTP response-line bytes and set the status and version fields of response. Return a SubString containing the header-field lines.
HTTP.Parsers.parse_request_line! — FunctionParse HTTP request-line bytes and set the method, target and version fields of request. Return a SubString containing the header-field lines.
HTTP.Parsers.parse_header_field — FunctionParse HTTP header-field. Return Pair(field-name => field-value) and a SubString containing the remaining header-field lines.
HTTP.Parsers.parse_chunk_size — FunctionMessages Interface
HTTP.Messages.iserror — Functioniserror(::Response)Does this Response have an error status?
HTTP.Messages.isredirect — Functionisredirect(::Response)Does this Response have a redirect status?
HTTP.Messages.ischunked — Functionischunked(::Message)Does the Message have a "Transfer-Encoding: chunked" header?
HTTP.Messages.issafe — Functionissafe(::Request)https://tools.ietf.org/html/rfc7231#section-4.2.1
HTTP.Messages.isidempotent — Functionisidempotent(::Request)https://tools.ietf.org/html/rfc7231#section-4.2.2
HTTP.Messages.header — Functionheader(::Message, key [, default=""]) -> StringGet header value for key (case-insensitive).
HTTP.Messages.hasheader — Functionhasheader(::Message, key) -> BoolDoes header value for key exist (case-insensitive)?
hasheader(::Message, key, value) -> BoolDoes header for key match value (both case-insensitive)?
HTTP.Messages.setheader — Functionsetheader(::Message, key => value)Set header value for key (case-insensitive).
HTTP.Messages.defaultheader! — Functiondefaultheader!(::Message, key => value)Set header value in message for key if it is not already set.
HTTP.Messages.appendheader — Functionappendheader(::Message, key => value)Append a header value to message.headers.
If key is the same as the previous header, the value is appended to the value of the previous header with a comma delimiter
Set-Cookie headers are not comma-combined because cookies often contain internal commas.
HTTP.Messages.readheaders — Functionreadheaders(::IO, ::Message)Read headers (and startline) from an IO stream into a Message struct. Throw EOFError if input is incomplete.
HTTP.MessageRequest.setuseragent! — Functionsetuseragent!(x::Union{String, Nothing})Set the default User-Agent string to be used in each HTTP request. Can be manually overridden by passing an explicit User-Agent header. Setting nothing will prevent the default User-Agent header from being passed.
HTTP.Messages.readchunksize — FunctionRead chunk-size from an IO stream. After the final zero size chunk, read trailers into a Message struct.
HTTP.Messages.headerscomplete — Methodheaderscomplete(::Message)Have the headers been read into this Message?
HTTP.Messages.writestartline — Functionwritestartline(::IO, ::Message)e.g. "GET /path HTTP/1.1\r\n" or "HTTP/1.1 200 OK\r\n"
HTTP.Messages.writeheaders — Functionwriteheaders(::IO, ::Message)Write Message start line and a line for each "name: value" pair and a trailing blank line.
Base.write — Methodwrite(::IO, ::Message)Write start line, headers and body of HTTP Message.
IOExtras Interface
HTTP.IOExtras — ModuleIOExtrasThis module defines extensions to the Base.IO interface to support:
startwrite,closewrite,startreadandclosereadfor streams with transactional semantics.
Missing docstring for HTTP.IOExtras.startwrite(::IO). Check Documenter's build log for details.
HTTP.IOExtras.isioerror — Functionisioerror(exception)Is exception caused by a possibly recoverable IO error.
Streams Interface
HTTP.Streams.closebody — Functionclosebody(::Stream)Write the final 0 chunk if needed.
HTTP.Streams.isaborted — Functionisaborted(::Stream{Response})Has the server signaled that it does not wish to receive the message body?
"If [the response] indicates the server does not wish to receive the message body and is closing the connection, the client SHOULD immediately cease transmitting the body and close the connection." RFC7230, 6.5
Connection Pooling Interface
HTTP.ConnectionPool.Connection — TypeConnection{T <: IO}A TCPSocket or SSLContext connection to a HTTP host and port.
Fields:
host::Stringport::String, exactly as specified in the URI (i.e. may be empty).pipeline_limit, number of requests to send before waiting for responses.idle_timeout, No. of seconds to maintain connection after last transaction.peerip, remote IP adress (used for debug/log messages).peerport, remote TCP port number (used for debug/log messages).localport, local TCP port number (used for debug messages).io::T, theTCPSocketor `SSLContext.clientconnection::Bool, whether the Connection was created from client code (as opposed to server code)buffer::IOBuffer, left over bytes read from the connection after the end of a response header (or chunksize). These bytes are usually part of the response body.sequence, number of most recentTransaction.writecount, number of Messages that have been written, protected bywritelockwritelock, lock writecount and writebusy, and signal thatwritecountwas incremented.writebusy, whether a Transaction currently holds the Connection write lock, protected bywritelockreadcount, number of Messages that have been read, protected byreadlockreadlock, lock readcount and readbusy, and signal thatreadcountwas incremented.readbusy, whether a Transaction currently holds the Connection read lock, protectecd byreadlocktimestamp, time data was last received.
HTTP.ConnectionPool.Transaction — TypeTransactionA single pipelined HTTP Request/Response transaction.
Fields:
c, the sharedConnectionused for thisTransaction.sequence::Int, identifies thisTransactionamong the others that sharec.writebusy::Bool, whether this Transaction holds its parent Connection write lock, protected by c.writelockreadbusy::Bool, whether this Transaction holds its parent Connection read lock, protected by c.readlock
HTTP.ConnectionPool.getconnection — Functiongetconnection(type, host, port) -> ConnectionFind a reusable Connection in the pool, or create a new Connection if required.
HTTP.ConnectionPool.POOL — ConstantPOOLGlobal connection pool keeping track of active connections.
HTTP.IOExtras.startwrite — Methodstartwrite(::Transaction)Wait for prior pending writes to complete.
HTTP.IOExtras.closewrite — Methodclosewrite(::Transaction)Signal that an entire Request Message has been written to the Transaction.
HTTP.IOExtras.startread — Methodstartread(::Transaction)Wait for prior pending reads to complete.
HTTP.IOExtras.closeread — Methodcloseread(::Transaction)Signal that an entire Response Message has been read from the Transaction.
Increment readcount and wake up tasks waiting in startread.