emerging-ezhttp
Releases (14)
-
0.21.0.0 indexed
-
0.20.0.0 unindexed
-
0.19.0.0 unindexed
-
0.18.0.0 unindexed
-
0.17.0.0 unindexed
-
0.16.0.0 unindexed
-
0.15.0.0 unindexed
-
0.14.0.0 unindexed
-
0.13.0.0 unindexed
-
0.12.0.0 unindexed
-
0.11.0.0 unindexed
-
0.10.0.0 unindexed
-
0.9.0.0 invalid
expected a fresh constructor name (duplicate declaration: Text)
-
0.8.0.0 invalid
expected a fresh constructor name (duplicate declaration: Text)
Definitions (909)
main.bend
- def parse_urlURL parse re-export
- def quote_pathpercent-encode a path (RFC 3986 §2.1), as Python's urllib.parse.quote(text): unreserved characters and "/" stay, every other character becomes %XX per UTF-8 byte, upper-case hex (SPEC.md HTTP-URL)
- def quote_componentpercent-encode a path segment, query key or value (RFC 3986 §2.1), as urllib.parse.quote(text, safe=""): like quote_path, but "/" becomes %2F
- def unquotepercent-decode a string as urllib.parse.unquote: %XX escapes (either case) become bytes, decoded as UTF-8 with U+FFFD for bytes that are not; an escape that is not two hex digits is kept as written, and characters outside ASCII are kept (SPEC.md HTTP-QS)
- def unquote_pluspercent-decode as urllib.parse.unquote_plus: `+` is a space, then unquote
- def quote_pluspercent-encode as urllib.parse.quote_plus: as quote_component, but a space is written `+` (so `+` itself is %2B)
- def Kva name and a value, reusable: a query field or a cookie, written (k, v)
- def urlencodea query string from name and value pairs, as urllib.parse.urlencode(pairs): `name=value` with both quote_plus'd, joined by `&`, in order
- def parse_querya query string's name and value pairs, as urllib.parse.parse_qsl(text, keep_blank_values=True): split on `&`, empty pieces skipped, each cut at its first `=` (a piece without one is a name with an empty value), both unquote_plus'd.
- def query_getthe value of the last pair with this name (names compared exactly), none when no pair has it: last-wins, as a dict(parse_qsl(...)) would be
- def parse_responseresponse parse re-export; `raw` is octets, one character each (SPEC.md HTTP-BODY)
- def parse_response_toa response as the client reads it for a request with this method: interim 1xx heads skipped, and no body for HEAD or a 1xx, 204 or 304 status, whatever Content-Length says (SPEC.md HTTP-CLI-9)
- def reason_phrasethe reason phrase of a response's status line (RFC 9112 §4), read from the head parse_response_to stops at; empty when there is none (SPEC.md HTTP-CLI-11)
- def parse_requestrequest parse re-export (server inbound)
- def format_responseformat a response message (server outbound)
- def empty_bodyempty request body
- def text_bodyUTF-8 text request body
- def octets_bodypacked octets request body (bend-kit-bytes Bytes), sent unchanged
- def octets_list_bodyoctets request body from a list of octet values (each 0..255)
- def form_fielda multipart/form-data text field (RFC 7578)
- def form_filea multipart/form-data file part: field name, filename, content type and the file's bytes (packed Bytes, sent unchanged)
- def form_bodya multipart/form-data body (RFC 7578) with this boundary: the Content-Type field value to send and an octet body, or why the boundary cannot be used (SPEC.md HTTP-FORM)
- def encodeBYO JSON (or any codec): encode a value with the caller's to_text
- def decodeBYO JSON (or any codec): decode body text with the caller's from_text
- def bearerBearer token header helper
- def basicBasic credentials header (RFC 7617)
- def set_cookieSet-Cookie header from a parsed cookie (RFC 6265)
- def parse_cookieparse one Set-Cookie field value
- def cookie_headerCookie request header for a list of cookies
- def cache_controlparse a Cache-Control field value (RFC 9111)
- def freshfreshness of a Cache-Control value at an age in seconds
- def cors_replyCORS preflight or simple headers on a handler reply
- def html_escapeescape text for HTML as markupsafe and Jinja's autoescape do: & < > " ' as & < > " ', every other character as itself
- def html_unescapeHTML character references back to characters, as Python's html.unescape: decimal and hex numeric references (with the HTML Standard's replacements) and the HTML Standard's 2231 named references, the legacy ones also without `;`; anything that is not a reference is kept as written (SPEC.md HTTP-REF)
- def cookie_from_set_cookiesthe Cookie header value to send back after these Set-Cookie field values (RFC 6265 §5.2, §5.4): each one's name=value, attributes ignored; a later cookie with the same name replaces the earlier one's value in its place; `name=value` pairs joined by `; ` (SPEC.md HTTP-CK)
- def cookie_from_headersthe same, from a response's header fields (its Set-Cookie fields, in order)
- def http.getGET with no extra headers
- def http.get_withGET with headers
- def http.get_optsGET with headers and a timeout in milliseconds that bounds connecting, sending and receiving; with `follow`, redirects are followed (GET only, at most 10 hops, see src/redirect.bend)
- def http.request_optsa request with any method, headers, a body and a timeout in milliseconds that bounds connecting, sending and receiving; with `follow`, a GET follows redirects (at most 10 hops, see src/redirect.bend) and every other method answers a redirect as its response
- def http.post_optsPOST with headers, a body and a timeout in milliseconds; redirects are not followed
- def http.put_optsPUT with headers, a body and a timeout in milliseconds; redirects are not followed
- def http.delete_optsDELETE with headers, a body and a timeout in milliseconds; redirects are not followed
- def http.timed_outwhether a response is an exchange that ran out of time
- def body_texta response body's octets (a Response's `bytes`) decoded as UTF-8, done only when called (SPEC.md HTTP-BODY-4)
- def http.headHEAD with no extra headers
- def http.head_withHEAD with headers
- def http.postPOST with a body and no extra headers
- def http.post_withPOST with headers and a body
- def http.putPUT with a body and no extra headers
- def http.put_withPUT with headers and a body
- def http.deleteDELETE with a body and no extra headers
- def http.delete_withDELETE with headers and a body
- def http.optionsOPTIONS with no extra headers
- def http.options_withOPTIONS with headers
- def http.servelisten on host:port and serve up to `limit` connections
- def http.serve_iolisten on host:port and serve up to `limit` connections with a handler that does IO; a failed connection is logged and the next one is served
- def http.serve_foreverlisten on host:port and serve with an IO handler until the process stops
- def http.serve_withlisten on host:port and serve up to `limit` connections, each on its own fork and at most `max` at once (0: no limit), calling a pure handler with `ctx` and the request (Server.Req: text, and its body's octets); returns once every connection is closed (SPEC.md HTTP-SRV, HTTP-TRUST-2)
- def http.serve_io_withthe same with a handler that does IO
- def http.serve_forever_withthe same with no limit: it serves until the process is stopped
- def text_replya reply with a text body, written as UTF-8
- def octets_replya reply whose body is packed octets, written unchanged
- def stream_replya reply streamed chunked: each chunk the channel gives is written as it comes, and the body ends when the channel is closed
- def http.serve_oncelisten on host:port, serve one connection, then stop
src/auth.bend
- def auth.bearerAuthorization: Bearer … (RFC 6750)
- def auth.basicAuthorization: Basic … (RFC 7617, credentials are RFC 4648 Base64)
src/b64.bend
- type Phasehow many octets of the current quantum are still missing
- def b64.tableRFC 4648 §4 alphabet, index 0 is `A`
- def b64.charthe character at a 0..63 index, `A` when the index is out of the table
- def b64.atone 6-bit value as an alphabet character
- def b64.pack24 bits from three octets
- def b64.tail.morethe last two characters when the quantum was short
- def b64.tailfour characters from a packed quantum; pad is how many `=` to write
- def b64.quadone quantum as four characters
- def b64.endpadding for a quantum that ended early
- def b64.gooctets to Base64, three at a time (RFC 4648 §4)
- def b64.bytescode points of a string, one octet each (credentials are ASCII)
- def b64.encodeBase64 of a string (RFC 4648 §4)
src/body.bend
- type Bodywhat rides in a request: nothing, text, or raw octets
- type Shapewhat the request text needs to know of a body: its text, or how many octets follow it (SPEC.md HTTP-CLI-10)
- def body.sizedan octets body's count: its shape, and the octets handed back
- def body.shapea body as its shape and the octets sent after the request text: a text body's are none, and the empty body is the empty text
- def octets.charsoctets, one character each (each 0..255), from a list of their values
- def body.emptyempty body
- def body.textUTF-8 text body
- def body.octetsoctets body
- def body.listan octets body from a list of octet values (each 0..255; a value past 255 keeps its low 8 bits)
- def body.encodeBYO encode: any value to a text body via the caller's encoder
- def body.decodeBYO decode: body text to a value via the caller's decoder
src/cache.bend
- type Ccthe directives this module records
- def cache.emptyno directives
- def cache.storeset no-store
- def cache.revalidateset no-cache
- def cache.pubset public
- def cache.privset private
- def cache.ageset max-age text
- def cache.expiresset the Expires header text
- def cache.one.privateprivate, or leave the directive unrecognized
- def cache.one.publicpublic