aboutsummaryrefslogtreecommitdiff
path: root/lib/std/http/Server.zig
AgeCommit message (Collapse)Author
2023-10-31std.builtin.Endian: make the tags lower caseAndrew Kelley
Let's take this breaking change opportunity to fix the style of this enum.
2023-10-22Merge pull request #17407 from truemedian/http-ngAndrew Kelley
std.http: more proxy support, buffer writes, tls toggle
2023-10-22Revert "Revert "Merge pull request #17637 from jacobly0/x86_64-test-std""Jacob Young
This reverts commit 6f0198cadbe29294f2bf3153a27beebd64377566.
2023-10-22Revert "Merge pull request #17637 from jacobly0/x86_64-test-std"Andrew Kelley
This reverts commit 0c99ba1eab63865592bb084feb271cd4e4b0357e, reversing changes made to 5f92b070bf284f1493b1b5d433dd3adde2f46727. This caused a CI failure when it landed in master branch due to a 128-bit `@byteSwap` in std.mem.
2023-10-21std.http: fix crashes found via fuzzingNameless
2023-10-21std.http: rename start->send and request->open to be more inline with operationNameless
2023-10-21std.http.Server: improve documentation, do -> startNameless
Response.do was renamed to Response.start to mimic the naming scheme in http.Client
2023-10-21std.http: make encoding fields non-null, store as enum variantNameless
2023-10-21x86_64: fix bugs and disable erroring testsJacob Young
2023-10-06Update Server.zig:{listen, do} to specify error enumsBecker A
2023-09-26std.http: add identity to content encodings (#16493)Chris Burgess
Some servers will respond with the identity encoding, meaning no encoding, especially when responding to range-get requests. Adding the identity encoding stops the header parser from failing when it encounters this.
2023-08-30std.http: allow for arbitrary http methodsNameless
2023-08-29std.http.Server: responses to HEAD not allowed to have a payloadNameless
2023-08-29std.http: handle expect:100-continue and continue responsesNameless
2023-08-10std.http.Server: use correct header for Transfer-Encodingjaina heartles
2023-07-23Fix the http.Server test and add it to the set of tests in http.zigjim price
2023-06-24all: migrate code to new cast builtin syntaxmlugg
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
2023-06-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-17zlib: naming conventionXavier Bouchoux
Adress review comments from https://github.com/ziglang/zig/pull/13977 by using the same naming convention as zstd. And by using `finish()` instead of `close()` for the finalisation of the compressed stream. rationale: - it is not the same as how close() is usually used, since it must be called to flush and write the final bytes. And as such it may fail. - it is not the same `flush` in the deflate code, which allows to keep writting more bytes later, and doesn't write the final checksum. - it is the same name as used in the original zlib library (Z_FINISH) Also, use a packed struct for the header, which seems a better fit.
2023-06-03Merge pull request #15579 from squeek502/mem-delimitersAndrew Kelley
Split `std.mem.split` and `tokenize` into `sequence`, `any`, and `scalar` versions
2023-06-01std.http.Server: collapse BufferedConnection into ConnectionNameless
2023-06-01std.http: add TlsAlert descriptions so that they can at least be viewed in ↵Nameless
err return traces
2023-05-13Update all std.mem.split calls to their appropriate functionRyan Liptak
Everywhere that can now use `splitScalar` should get a nice little performance boost.
2023-05-13Update all std.mem.tokenize calls to their appropriate functionRyan Liptak
Everywhere that can now use `tokenizeScalar` should get a nice little performance boost.
2023-05-06std.http: use larger read buffer to hit faster tls codeNameless
2023-05-06fix keepalive and large buffered writesNameless
2023-05-06std.http.Server: give Response access to their own allocatorNameless
* This makes it easier for threaded servers to use a different allocator for each request.
2023-05-06std.http: buffer writesNameless
2023-05-06std.http.Server: use enum for reset state instead of boolNameless
2023-05-06std.http.Server: use client recommendation for keepaliveNameless
2023-05-06std.http: add simple standalone http tests, add state check for http serverNameless
2023-04-28std: update to use `@memcpy` directlyAndrew Kelley
2023-04-24fix HTTP server to handle a chunked transfer coding requestRyo Ota
2023-04-21create std.http.Server.Response.deinit to handle keepalive connectionsRyo Ota
2023-04-21fix memory leaks and add an HTTP testRyo Ota
2023-04-20std.http: add missing InvalidTrailers to ReadErrorRyo Ota
2023-04-18std.http: pass Method to request directly, parse trailing headersNameless
2023-04-17std.http: curate some Server errors, fix reading chunked bodiesNameless
2023-04-17std.http: add HeadersNameless
2023-04-17HTTP client and server send "0\r\n\r\n" when chunked encodingRyo Ota
2023-04-08std.http: add documentationNameless
2023-04-08add buffering to connection instead of the http protocol, to allow passing ↵Nameless
through upgrades
2023-04-08std.http: add http serverNameless
* 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(); } } ```