diff --git a/cmd/httpd/main.ha b/cmd/httpd/main.ha index c6533fb..819a2f5 100644 --- a/cmd/httpd/main.ha +++ b/cmd/httpd/main.ha @@ -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); diff --git a/net/http/do.ha b/net/http/do.ha index 9ec723e..9b5905b 100644 --- a/net/http/do.ha +++ b/net/http/do.ha @@ -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; }; diff --git a/net/http/request.ha b/net/http/request.ha index 45cdf6b..cb85a8c 100644 --- a/net/http/request.ha +++ b/net/http/request.ha @@ -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; }; diff --git a/net/http/transport.ha b/net/http/transport.ha index 78768ba..6343ccf 100644 --- a/net/http/transport.ha +++ b/net/http/transport.ha @@ -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 =>