mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
std.http.Server: remove source code from doc comments
Documentation comments are not an appropriate place to put code samples.
This commit is contained in:
parent
50e2a5f673
commit
00acf8a66d
@ -2,43 +2,6 @@
|
|||||||
//!
|
//!
|
||||||
//! This server assumes clients are well behaved and standard compliant; it
|
//! This server assumes clients are well behaved and standard compliant; it
|
||||||
//! deadlocks if a client holds a connection open without sending a request.
|
//! deadlocks if a client holds a connection open without sending a request.
|
||||||
//!
|
|
||||||
//! Example usage:
|
|
||||||
//!
|
|
||||||
//! ```zig
|
|
||||||
//! var server = Server.init(.{ .reuse_address = true });
|
|
||||||
//! defer server.deinit();
|
|
||||||
//!
|
|
||||||
//! try server.listen(bind_addr);
|
|
||||||
//!
|
|
||||||
//! while (true) {
|
|
||||||
//! var res = try server.accept(.{ .allocator = gpa });
|
|
||||||
//! defer res.deinit();
|
|
||||||
//!
|
|
||||||
//! while (res.reset() != .closing) {
|
|
||||||
//! res.wait() catch |err| switch (err) {
|
|
||||||
//! error.HttpHeadersInvalid => break,
|
|
||||||
//! error.HttpHeadersOversize => {
|
|
||||||
//! res.status = .request_header_fields_too_large;
|
|
||||||
//! res.send() catch break;
|
|
||||||
//! break;
|
|
||||||
//! },
|
|
||||||
//! else => {
|
|
||||||
//! res.status = .bad_request;
|
|
||||||
//! res.send() catch break;
|
|
||||||
//! break;
|
|
||||||
//! },
|
|
||||||
//! }
|
|
||||||
//!
|
|
||||||
//! res.status = .ok;
|
|
||||||
//! res.transfer_encoding = .chunked;
|
|
||||||
//!
|
|
||||||
//! try res.send();
|
|
||||||
//! try res.writeAll("Hello, World!\n");
|
|
||||||
//! try res.finish();
|
|
||||||
//! }
|
|
||||||
//! }
|
|
||||||
//! ```
|
|
||||||
|
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const std = @import("../std.zig");
|
const std = @import("../std.zig");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user