feat: remove \r from strings
This commit is contained in:
@@ -72,10 +72,10 @@ fn send_http_request(pcb: ?*cNet.tcp_pcb, context: *HttpContext) !void {
|
|||||||
|
|
||||||
for (context.request.headers) |header| {
|
for (context.request.headers) |header| {
|
||||||
const old_header_content = header_content;
|
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);
|
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 = .{
|
const request_data = .{
|
||||||
.method = @tagName(context.request.method),
|
.method = @tagName(context.request.method),
|
||||||
@@ -86,15 +86,12 @@ fn send_http_request(pcb: ?*cNet.tcp_pcb, context: *HttpContext) !void {
|
|||||||
.content = context.request.body,
|
.content = context.request.body,
|
||||||
};
|
};
|
||||||
|
|
||||||
// \\Title: Csengo\r
|
|
||||||
// \\Priority: 5\r
|
|
||||||
// \\X-Tags: bell\r
|
|
||||||
const template =
|
const template =
|
||||||
\\{[method]s} {[path]s} HTTP/1.1\r
|
\\{[method]s} {[path]s} HTTP/1.1
|
||||||
\\Host: {[host]s}\r
|
\\Host: {[host]s}
|
||||||
\\{[headers]s}\r
|
\\{[headers]s}
|
||||||
\\Content-Length: {[content_length]}\r
|
\\Content-Length: {[content_length]}
|
||||||
\\\r
|
\\
|
||||||
\\{[content]s}
|
\\{[content]s}
|
||||||
;
|
;
|
||||||
const raw_request = try std.fmt.allocPrint(
|
const raw_request = try std.fmt.allocPrint(
|
||||||
|
|||||||
Reference in New Issue
Block a user