Andrew Kelley
629f0d23b5
Merge pull request #15579 from squeek502/mem-delimiters
...
Split `std.mem.split` and `tokenize` into `sequence`, `any`, and `scalar` versions
2023-06-03 13:51:02 -07:00
Nameless
23ccff9cce
std.http.Server: collapse BufferedConnection into Connection
2023-06-01 13:44:00 -05:00
Nameless
0e5e6cb10c
std.http: add TlsAlert descriptions so that they can at least be viewed in err return traces
2023-06-01 13:43:55 -05:00
Ryan Liptak
2129f28953
Update all std.mem.split calls to their appropriate function
...
Everywhere that can now use `splitScalar` should get a nice little performance boost.
2023-05-13 13:45:05 -07:00
Ryan Liptak
815e53b147
Update all std.mem.tokenize calls to their appropriate function
...
Everywhere that can now use `tokenizeScalar` should get a nice little performance boost.
2023-05-13 13:45:04 -07:00
Nameless
9017d758b9
std.http: use larger read buffer to hit faster tls code
2023-05-06 21:35:17 -05:00
Nameless
1b3ebfefd8
fix keepalive and large buffered writes
2023-05-06 21:35:16 -05:00
Nameless
5f219a2d11
std.http.Server: give Response access to their own allocator
...
* This makes it easier for threaded servers to use a different allocator
for each request.
2023-05-06 21:35:16 -05:00
Nameless
7b09629388
std.http: buffer writes
2023-05-06 21:35:16 -05:00
Nameless
533049fdd8
std.http.Server: use enum for reset state instead of bool
2023-05-06 21:35:15 -05:00
Nameless
6513eb4696
std.http.Server: use client recommendation for keepalive
2023-05-06 21:35:15 -05:00
Nameless
71c228fe65
std.http: add simple standalone http tests, add state check for http server
2023-05-06 21:35:15 -05:00
Andrew Kelley
125221cce9
std: update to use @memcpy directly
2023-04-28 13:24:43 -07:00
Ryo Ota
bba90b8863
fix HTTP server to handle a chunked transfer coding request
2023-04-24 15:36:35 -07:00
Ryo Ota
afebef2465
create std.http.Server.Response.deinit to handle keepalive connections
2023-04-21 10:17:16 +09:00
Ryo Ota
39c0c24b56
fix memory leaks and add an HTTP test
2023-04-21 02:35:38 +09:00
Ryo Ota
d80e6ca5a6
std.http: add missing InvalidTrailers to ReadError
2023-04-20 12:35:26 +03:00
Nameless
a23c8662b4
std.http: pass Method to request directly, parse trailing headers
2023-04-18 10:28:53 -05:00
Nameless
85221b4e97
std.http: curate some Server errors, fix reading chunked bodies
2023-04-17 19:16:01 -05:00
Nameless
134294230a
std.http: add Headers
2023-04-17 19:15:55 -05:00
Ryo Ota
17af53554e
HTTP client and server send "0\r\n\r\n" when chunked encoding
2023-04-17 13:33:25 +03:00
Nameless
ef6d58ed3b
std.http: add documentation
2023-04-08 09:59:36 -05:00
Nameless
aecbfa3a1e
add buffering to connection instead of the http protocol, to allow passing through upgrades
2023-04-08 09:59:36 -05:00
Nameless
08bdaf3bd6
std.http: add http server
...
* extract http protocol into protocol.zig, as it is shared between client and server
* coalesce Request and Response back into Client.zig, they don't contain
any large chunks of code anymore
* http.Server is implemented as basic as possible, a simple example below:
```zig
fn handler(res: *Server.Response) !void {
while (true) {
defer res.reset();
try res.waitForCompleteHead();
res.headers.transfer_encoding = .{ .content_length = 14 };
res.headers.connection = res.request.headers.connection;
try res.sendResponseHead();
_ = try res.write("Hello, World!\n");
if (res.connection.closing) break;
}
}
pub fn main() !void {
var server = Server.init(std.heap.page_allocator, .{ .reuse_address = true });
defer server.deinit();
try server.listen(try net.Address.parseIp("127.0.0.1", 8080));
while (true) {
const res = try server.accept(.{ .dynamic = 8192 });
const thread = try std.Thread.spawn(.{}, handler, .{res});
thread.detach();
}
}
```
2023-04-08 09:59:35 -05:00