| ... | ... | @@ -4,6 +4,7 @@ reason: ?[]const u8, |
| 4 | 4 | transfer_encoding: ResponseTransfer, |
| 5 | 5 | keep_alive: bool, |
| 6 | 6 | connection: Connection, |
| 7 | connection_closing: bool, |
| 7 | 8 | |
| 8 | 9 | /// Externally-owned; must outlive the Server. |
| 9 | 10 | extra_headers: []const http.Header, |
| ... | ... | @@ -25,11 +26,11 @@ pub fn init(connection: std.net.Server.Connection, options: Server.Request.InitO |
| 25 | 26 | .connection = .{ |
| 26 | 27 | .stream = connection.stream, |
| 27 | 28 | .protocol = .plain, |
| 28 | | .closing = true, |
| 29 | 29 | .read_buf = undefined, |
| 30 | 30 | .read_start = 0, |
| 31 | 31 | .read_end = 0, |
| 32 | 32 | }, |
| 33 | .connection_closing = true, |
| 33 | 34 | .request = Server.Request.init(options), |
| 34 | 35 | .version = .@"HTTP/1.1", |
| 35 | 36 | .status = .ok, |
| ... | ... | @@ -232,7 +233,7 @@ pub fn reset(res: *Server) ResetState { |
| 232 | 233 | |
| 233 | 234 | if (!res.request.parser.done) { |
| 234 | 235 | // If the response wasn't fully read, then we need to close the connection. |
| 235 | | res.connection.closing = true; |
| 236 | res.connection_closing = true; |
| 236 | 237 | return .closing; |
| 237 | 238 | } |
| 238 | 239 | |
| ... | ... | @@ -240,7 +241,7 @@ pub fn reset(res: *Server) ResetState { |
| 240 | 241 | // and its value is not "close". The server and client must both agree. |
| 241 | 242 | // |
| 242 | 243 | // send() defaults to using keep-alive if the client requests it. |
| 243 | | res.connection.closing = !res.keep_alive or !res.request.keep_alive; |
| 244 | res.connection_closing = !res.keep_alive or !res.request.keep_alive; |
| 244 | 245 | |
| 245 | 246 | res.state = .start; |
| 246 | 247 | res.version = .@"HTTP/1.1"; |
| ... | ... | @@ -253,7 +254,7 @@ pub fn reset(res: *Server) ResetState { |
| 253 | 254 | .client_header_buffer = res.request.parser.header_bytes_buffer, |
| 254 | 255 | }); |
| 255 | 256 | |
| 256 | | return if (res.connection.closing) .closing else .reset; |
| 257 | return if (res.connection_closing) .closing else .reset; |
| 257 | 258 | } |
| 258 | 259 | |
| 259 | 260 | pub const SendError = Connection.WriteError || error{ |