Updates for Hare upstream changes
Signed-off-by: Drew DeVault <sir@cmpwn.com>
This commit is contained in:
parent
1d5c710f55
commit
9237448725
|
@ -38,8 +38,9 @@ export fn main() void = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const server = match (http::listen(ip_addr, port)) {
|
const server = match (http::listen(ip_addr, port)) {
|
||||||
|
case let this: *http::server =>
|
||||||
|
yield this;
|
||||||
case net::error => abort("failure while listening");
|
case net::error => abort("failure while listening");
|
||||||
case let this: *http::server => yield this;
|
|
||||||
};
|
};
|
||||||
defer http::server_finish(server);
|
defer http::server_finish(server);
|
||||||
|
|
||||||
|
|
|
@ -94,21 +94,21 @@ fn read_statusline(
|
||||||
const version = match (strings::next_token(&tok)) {
|
const version = match (strings::next_token(&tok)) {
|
||||||
case let ver: str =>
|
case let ver: str =>
|
||||||
yield ver;
|
yield ver;
|
||||||
case void =>
|
case done =>
|
||||||
return protoerr;
|
return protoerr;
|
||||||
};
|
};
|
||||||
|
|
||||||
const status = match (strings::next_token(&tok)) {
|
const status = match (strings::next_token(&tok)) {
|
||||||
case let status: str =>
|
case let status: str =>
|
||||||
yield status;
|
yield status;
|
||||||
case void =>
|
case done =>
|
||||||
return protoerr;
|
return protoerr;
|
||||||
};
|
};
|
||||||
|
|
||||||
const reason = match (strings::next_token(&tok)) {
|
const reason = match (strings::next_token(&tok)) {
|
||||||
case let reason: str =>
|
case let reason: str =>
|
||||||
yield reason;
|
yield reason;
|
||||||
case void =>
|
case done =>
|
||||||
return protoerr;
|
return protoerr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ export fn request_line_parse(scan: *bufio::scanner) (request_line | protoerr | i
|
||||||
const method = match (strings::next_token(&tok)) {
|
const method = match (strings::next_token(&tok)) {
|
||||||
case let method: str =>
|
case let method: str =>
|
||||||
yield strings::dup(method);
|
yield strings::dup(method);
|
||||||
case void =>
|
case done =>
|
||||||
return protoerr;
|
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 let uri: uri::uri => yield alloc(uri);
|
||||||
case => yield strings::dup(req_uri); // as path
|
case => yield strings::dup(req_uri); // as path
|
||||||
};
|
};
|
||||||
case void =>
|
case done =>
|
||||||
return protoerr;
|
return protoerr;
|
||||||
};
|
};
|
||||||
|
|
||||||
const version = match (strings::next_token(&tok)) {
|
const version = match (strings::next_token(&tok)) {
|
||||||
case let ver: str =>
|
case let ver: str =>
|
||||||
yield ver;
|
yield ver;
|
||||||
case void =>
|
case done =>
|
||||||
return protoerr;
|
return protoerr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -80,13 +80,8 @@ fn new_reader(
|
||||||
let stream: io::handle = conn;
|
let stream: io::handle = conn;
|
||||||
let buffer: []u8 = bufio::scan_buffer(scan);
|
let buffer: []u8 = bufio::scan_buffer(scan);
|
||||||
const iter = strings::tokenize(te, ",");
|
const iter = strings::tokenize(te, ",");
|
||||||
for (true) {
|
for (const tok => strings::next_token(&iter)) {
|
||||||
const te = match (strings::next_token(&iter)) {
|
const te = strings::trim(tok);
|
||||||
case let tok: str =>
|
|
||||||
yield strings::trim(tok);
|
|
||||||
case void =>
|
|
||||||
break;
|
|
||||||
};
|
|
||||||
|
|
||||||
// XXX: We could add lzw support if someone added it to
|
// XXX: We could add lzw support if someone added it to
|
||||||
// hare-compress
|
// hare-compress
|
||||||
|
@ -246,7 +241,7 @@ fn chunked_read(
|
||||||
return errors::invalid;
|
return errors::invalid;
|
||||||
};
|
};
|
||||||
|
|
||||||
match (strconv::stozb(ln, strconv::base::HEX)) {
|
match (strconv::stoz(ln, strconv::base::HEX)) {
|
||||||
case let z: size =>
|
case let z: size =>
|
||||||
rd.length = z;
|
rd.length = z;
|
||||||
case =>
|
case =>
|
||||||
|
|
Loading…
Reference in a new issue