1
Fork 0
Commit graph

47 commits

Author SHA1 Message Date
Jan-Erik Rediger 53a13840bd Add Host header into target uri
Previously this would lead to an abort for an empty path (`/`), because
`http:/` cannot be parsed correctly.
The URI becomes the `target` in `request`, so it seems best to add the
`Host` header value too.

Note that this is still not 100% correct:
HTTP headers are case-insensitive, so it could also be `host:` or `HoSt`.
Right now headers are not normalized.
However it will not abort if `Host` is missing:
In that case `header_get` returns an empty string and then `http:///`
(three slashes) is parsed with an empty host name as expected.
2024-05-27 22:49:41 +02:00
Drew DeVault 9237448725 Updates for Hare upstream changes
Signed-off-by: Drew DeVault <sir@cmpwn.com>
2024-04-19 11:24:02 +02:00
Willow Barraco 1d5c710f55 Implement server-side HTTP support
Co-authored-by: Drew DeVault <sir@cmpwn.com>
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
Signed-off-by: Drew DeVault <sir@cmpwn.com>
2024-04-19 11:22:15 +02:00
Drew DeVault cfdb921520 transport.ha: fix unreachable abort 2024-03-04 11:23:32 +01:00
Drew DeVault 9d14e36566 Define new request method constants 2024-03-04 11:23:13 +01:00
Drew DeVault a8da673321 net::http: implement response cases without body 2023-10-08 11:24:26 +02:00
Drew DeVault 2acf7fa873 net::http: export new_request{,_body} 2023-10-08 11:14:26 +02:00
Drew DeVault 380d174beb cmd/http: add headers via getopt 2023-10-07 12:57:35 +02:00
Drew DeVault d798088e9e net/http/header.ha: fix assertion 2023-10-07 12:57:24 +02:00
Drew DeVault 396d6caa76 transport: improve identity transport lifetime 2023-10-07 12:43:58 +02:00
Drew DeVault 159dd0d06f http::do: handle more protoerror cases 2023-10-07 12:26:10 +02:00
Drew DeVault dbeb079262 Use errors::unsupported if scheme != http(s) 2023-10-07 12:23:41 +02:00
Drew DeVault 78a5d982eb net::http::new_request: exhaustive switch 2023-10-07 12:14:26 +02:00
Alexey Yerin 372eb47e4a Fix compilation with latest stdlib 2023-08-31 11:15:49 +02:00
Drew DeVault c203af3f8b README: update to latest RFC 2023-02-15 09:53:03 +01:00
Drew DeVault 5bcc5539f5 Finish chunked reader implementation 2023-02-12 17:58:25 +01:00
Drew DeVault 047472da93 Implement new_chunked_reader
TODO: Implement chunked_read too
2023-02-12 13:23:32 +01:00
Drew DeVault e7f4a73aab error: correct doc reference 2023-02-12 13:19:00 +01:00
Drew DeVault 1679405268 Don't export reader types
These are opaquely accessed through *io::stream
2023-02-12 13:18:29 +01:00
Drew DeVault 337d063f15 Merge _set_content_length into new_request_body 2023-02-12 13:14:19 +01:00
Drew DeVault 5038e0031a Lil' more README 2023-02-12 13:13:09 +01:00
Drew DeVault 2d643a6be3 request_set_content_length: set Transfer-Encoding
As a fallback for non-seekable streams
2023-02-12 13:10:02 +01:00
Drew DeVault 2ea358ae35 Minor docs adjustement 2023-02-12 13:07:53 +01:00
Drew DeVault 5d39543fcf Plumb transport config through to [[do]] 2023-02-12 13:07:05 +01:00
Drew DeVault c63af5d3ec Improve documentation and transport semantics 2023-02-12 13:05:11 +01:00
Drew DeVault 5e205199dc Fish transport config through various types 2023-02-12 12:55:16 +01:00
Drew DeVault c76599f71c transport: don't export new_reader
The semantics are internal
2023-02-12 12:52:48 +01:00
Drew DeVault d350e8ccd9 s/client_add_header/client_default_header/ 2023-02-12 12:21:03 +01:00
Drew DeVault fa4defb964 transport: add config options (unimplemented) 2023-02-12 12:14:19 +01:00
Drew DeVault 0e4277ded9 Improve support riggings for Transfer-Encoding 2023-02-12 11:04:05 +01:00
Drew DeVault 8edf406c52 Drop obsolete comments 2023-02-11 17:19:26 +01:00
Drew DeVault 946c985a02 Rig out transport handling, finish identity reader
New patch will implement more transports, such as chunked and gzip.
2023-02-11 11:31:07 +01:00
Drew DeVault 91e0a6874b net::http: add status code utilities 2023-02-11 11:16:15 +01:00
Drew DeVault 6b36cfcff5 Improve error handling 2023-02-11 11:03:51 +01:00
Drew DeVault 4ce86752b3 net::http::header_set: rename from set_header 2023-02-10 14:28:25 +01:00
Drew DeVault 0eef917610 net::http::*_header: rename to header_* 2023-02-10 14:19:08 +01:00
Drew DeVault b297d9d3a0 net::http::get et al: perform request 2023-02-10 14:18:01 +01:00
Drew DeVault ca93a48b12 Implement HTTP response parsing and reader
TODO: Handle Transfer-Encoding and Content-Length properly
2023-02-10 14:09:28 +01:00
Drew DeVault 1c1de31c1a net::http::do: prepare read buffer 2023-02-10 10:52:15 +01:00
Drew DeVault a567ff4418 net::http::do: remove context struct 2023-02-10 10:34:57 +01:00
Drew DeVault 859c8dc06e net::http::do: place buffer on stack
We can afford 4K of stack space
2023-02-10 10:27:14 +01:00
Drew DeVault 8ccb846c55 net::http::do: assert http
Until we implement TLS
2023-02-10 10:16:18 +01:00
Drew DeVault 26b21689b5 (Partially) implement net::http::do 2023-02-10 10:13:30 +01:00
Drew DeVault 8cde44d639 http::new_request: wrap Host in [] for ipv6 2023-02-09 23:31:12 +01:00
Drew DeVault 4bb0cd5c7e Add client struct and request helpers 2023-02-09 23:23:05 +01:00
Drew DeVault a0bfaef6ba Initial commit 2023-02-09 20:56:48 +01:00
Drew DeVault ea1a5ceb8d Initial commit 2023-02-09 11:45:25 +01:00