this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

jetstream: simplify query params

+4 -9
+4 -9
src/jetstream.zig
··· 12 12 fd: posix.fd_t = -1, 13 13 bundle: std.crypto.Certificate.Bundle, 14 14 host: u2, 15 - path: []const u8, 15 + query: []const u8, 16 16 ctx: ourio.Context, 17 17 18 18 /// the expected Sec-WebSocket-Accept value ··· 122 122 } 123 123 try list.writer().print("cursor={d}", .{cursor}); 124 124 } 125 - 126 - const path: []const u8 = if (list.items.len > 0) 127 - try std.fmt.allocPrint(gpa, "?{s}", .{list.items}) 128 - else 129 - ""; 130 125 131 126 self.* = .{ 132 127 .gpa = gpa, ··· 135 130 .state = .dns, 136 131 .challenge = "", 137 132 .host = idx, 138 - .path = path, 133 + .query = try list.toOwnedSlice(), 139 134 .ctx = ctx, 140 135 }; 141 136 } 142 137 143 138 pub fn deinit(self: *Stream) void { 144 - self.gpa.free(self.path); 139 + self.gpa.free(self.query); 145 140 self.gpa.free(self.challenge); 146 141 switch (self.state) { 147 142 .dns => {}, ··· 239 234 240 235 // Write an upgrade request 241 236 var writer = conn.cleartext_buf.writer(self.gpa); 242 - try writer.print("GET /subscribe{s} HTTP/1.1\r\n", .{self.path}); 237 + try writer.print("GET /subscribe?{s} HTTP/1.1\r\n", .{self.query}); 243 238 try writer.print("Host: {s}\r\n", .{hosts[self.host]}); 244 239 try writer.writeAll("Upgrade: websocket\r\n"); 245 240 try writer.writeAll("Connection: Upgrade\r\n");