feat: remove \r from strings

This commit is contained in:
2025-05-22 15:04:49 +02:00
parent c8be63e589
commit d92ee9c10c

View File

@@ -72,10 +72,10 @@ fn send_http_request(pcb: ?*cNet.tcp_pcb, context: *HttpContext) !void {
for (context.request.headers) |header| {
const old_header_content = header_content;
header_content = try std.fmt.allocPrint(context.client.allocator, "{s}{s}: {s}\r\n", .{ header_content, header.name, header.value });
header_content = try std.fmt.allocPrint(context.client.allocator, "{s}{s}: {s}\n", .{ header_content, header.name, header.value });
context.client.allocator.free(old_header_content);
}
const final_header_content = std.mem.trimRight(u8, header_content, "\r\n");
const final_header_content = std.mem.trimRight(u8, header_content, "\n");
const request_data = .{
.method = @tagName(context.request.method),
@@ -86,15 +86,12 @@ fn send_http_request(pcb: ?*cNet.tcp_pcb, context: *HttpContext) !void {
.content = context.request.body,
};
// \\Title: Csengo\r
// \\Priority: 5\r
// \\X-Tags: bell\r
const template =
\\{[method]s} {[path]s} HTTP/1.1\r
\\Host: {[host]s}\r
\\{[headers]s}\r
\\Content-Length: {[content_length]}\r
\\\r
\\{[method]s} {[path]s} HTTP/1.1
\\Host: {[host]s}
\\{[headers]s}
\\Content-Length: {[content_length]}
\\
\\{[content]s}
;
const raw_request = try std.fmt.allocPrint(