From 853382dcda9ee29bd95ab8d3f02fa4e7c313cd9c Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Fri, 24 Jul 2020 11:33:24 -0400 Subject: [PATCH] fix: correct HTTP response syntax --- runtime/include/types.h | 6 +++--- runtime/src/sandbox.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/include/types.h b/runtime/include/types.h index f1f2d82..81f5c3c 100644 --- a/runtime/include/types.h +++ b/runtime/include/types.h @@ -105,11 +105,11 @@ typedef void (*mod_libc_fn_t)(int32_t, int32_t); #define HTTP_MAX_HEADER_VALUE_LENGTH 64 #define HTTP_RESPONSE_200_OK "HTTP/1.1 200 OK\r\n" -#define HTTP_RESPONSE_CONTENT_LENGTH "Content-length: " -#define HTTP_RESPONSE_CONTENT_LENGTH_TERMINATOR " \r\n\r\n" /* content body follows this */ +#define HTTP_RESPONSE_CONTENT_LENGTH "Content-Length: " +#define HTTP_RESPONSE_CONTENT_LENGTH_TERMINATOR "\r\n\r\n" /* content body follows this */ -#define HTTP_RESPONSE_CONTENT_TYPE "Content-type: " +#define HTTP_RESPONSE_CONTENT_TYPE "Content-Type: " #define HTTP_RESPONSE_CONTENT_TYPE_PLAIN "text/plain" #define HTTP_RESPONSE_CONTENT_TYPE_TERMINATOR " \r\n" diff --git a/runtime/src/sandbox.c b/runtime/src/sandbox.c index 4257720..7376918 100644 --- a/runtime/src/sandbox.c +++ b/runtime/src/sandbox.c @@ -181,7 +181,7 @@ sandbox_build_and_send_client_response(struct sandbox *sandbox) assert(response_cursor < sandbox->request_length); /* Move the Sandbox's Data after the HTTP Response Data */ - memmove(sandbox->request_response_data + response_cursor - 1, + memmove(sandbox->request_response_data + response_cursor, sandbox->request_response_data + sandbox->request_length, body_size); response_cursor += body_size;