1
Fork 0

Updates for Hare upstream changes

Signed-off-by: Drew DeVault <sir@cmpwn.com>
This commit is contained in:
Drew DeVault 2024-04-19 11:24:02 +02:00
parent 1d5c710f55
commit 9237448725
4 changed files with 11 additions and 15 deletions

View file

@ -38,8 +38,9 @@ export fn main() void = {
};
const server = match (http::listen(ip_addr, port)) {
case let this: *http::server =>
yield this;
case net::error => abort("failure while listening");
case let this: *http::server => yield this;
};
defer http::server_finish(server);

View file

@ -94,21 +94,21 @@ fn read_statusline(
const version = match (strings::next_token(&tok)) {
case let ver: str =>
yield ver;
case void =>
case done =>
return protoerr;
};
const status = match (strings::next_token(&tok)) {
case let status: str =>
yield status;
case void =>
case done =>
return protoerr;
};
const reason = match (strings::next_token(&tok)) {
case let reason: str =>
yield reason;
case void =>
case done =>
return protoerr;
};

View file

@ -213,7 +213,7 @@ export fn request_line_parse(scan: *bufio::scanner) (request_line | protoerr | i
const method = match (strings::next_token(&tok)) {
case let method: str =>
yield strings::dup(method);
case void =>
case done =>
return protoerr;
};
@ -227,14 +227,14 @@ export fn request_line_parse(scan: *bufio::scanner) (request_line | protoerr | i
case let uri: uri::uri => yield alloc(uri);
case => yield strings::dup(req_uri); // as path
};
case void =>
case done =>
return protoerr;
};
const version = match (strings::next_token(&tok)) {
case let ver: str =>
yield ver;
case void =>
case done =>
return protoerr;
};

View file

@ -80,13 +80,8 @@ fn new_reader(
let stream: io::handle = conn;
let buffer: []u8 = bufio::scan_buffer(scan);
const iter = strings::tokenize(te, ",");
for (true) {
const te = match (strings::next_token(&iter)) {
case let tok: str =>
yield strings::trim(tok);
case void =>
break;
};
for (const tok => strings::next_token(&iter)) {
const te = strings::trim(tok);
// XXX: We could add lzw support if someone added it to
// hare-compress
@ -246,7 +241,7 @@ fn chunked_read(
return errors::invalid;
};
match (strconv::stozb(ln, strconv::base::HEX)) {
match (strconv::stoz(ln, strconv::base::HEX)) {
case let z: size =>
rd.length = z;
case =>