| ... | @@ -19,6 +19,8 @@ pub const Method = enum { | ... | @@ -19,6 +19,8 @@ pub const Method = enum { |
| 19 | }; | 19 | }; |
| 20 | | 20 | |
| 21 | pub const Status = enum(u10) { | 21 | pub const Status = enum(u10) { |
| | 22 | invalid = 0, |
| | 23 | |
| 22 | @"continue" = 100, // RFC7231, Section 6.2.1 | 24 | @"continue" = 100, // RFC7231, Section 6.2.1 |
| 23 | switching_protocols = 101, // RFC7231, Section 6.2.2 | 25 | switching_protocols = 101, // RFC7231, Section 6.2.2 |
| 24 | processing = 102, // RFC2518 | 26 | processing = 102, // RFC2518 |
| ... | @@ -175,7 +177,7 @@ pub fn open(allocator: std.mem.Allocator, method: Method, input: []const u8) !Cl | ... | @@ -175,7 +177,7 @@ pub fn open(allocator: std.mem.Allocator, method: Method, input: []const u8) !Cl |
| 175 | const u = try url.URL.parse(allocator, input, null); | 177 | const u = try url.URL.parse(allocator, input, null); |
| 176 | defer allocator.free(u.href); | 178 | defer allocator.free(u.href); |
| 177 | | 179 | |
| 178 | const addr: net.Address = .fromUrl(&u, allocator); | 180 | const addr: net.Address = try .fromUrl(&u, allocator); |
| 179 | | 181 | |
| 180 | const conn = try addr.tcpConnect(); | 182 | const conn = try addr.tcpConnect(); |
| 181 | errdefer conn.close(); | 183 | errdefer conn.close(); |
| ... | @@ -202,7 +204,7 @@ pub fn open(allocator: std.mem.Allocator, method: Method, input: []const u8) !Cl | ... | @@ -202,7 +204,7 @@ pub fn open(allocator: std.mem.Allocator, method: Method, input: []const u8) !Cl |
| 202 | .stream = conn, | 204 | .stream = conn, |
| 203 | .writer = bufw, | 205 | .writer = bufw, |
| 204 | .reader = .init(conn), | 206 | .reader = .init(conn), |
| 205 | .status = @enumFromInt(0), | 207 | .status = .invalid, |
| 206 | .headers = .init(allocator), | 208 | .headers = .init(allocator), |
| 207 | }; | 209 | }; |
| 208 | } | 210 | } |