From 2f9a70dcf95882c1cdeea6e6e18fad1bd72389db Mon Sep 17 00:00:00 2001 From: jpadkins Date: Tue, 4 Apr 2017 18:54:02 -0500 Subject: Dirty Commit: Added groundwork for camelface tests --- check/magma/servers/http/http_check_network.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'check/magma/servers/http/http_check_network.c') diff --git a/check/magma/servers/http/http_check_network.c b/check/magma/servers/http/http_check_network.c index 5675d664..2b1e891c 100644 --- a/check/magma/servers/http/http_check_network.c +++ b/check/magma/servers/http/http_check_network.c @@ -30,25 +30,24 @@ bool_t check_http_read_to_empty(client_t *client) { * @param client A client_t containing the response of an HTTP request. * @return The value of Content-Length in the HTTP message header. */ -uint32_t check_http_content_length_get(client_t *client, stringer_t *errmsg) { +size_t check_http_content_length_get(client_t *client) { - size_t location = 0; - uint32_t content_length; + size_t location = 0, content_length; placer_t cl_placer = pl_null(); while (st_cmp_ci_starts(&(client->line), NULLER("Content-Length:")) != 0) client_read_line(client); if (!st_search_chr(&(client->line), ' ', &location)) { - st_sprint(errmsg, "The Content-Length line was improperly formed."); + //st_sprint(errmsg, "The Content-Length line was improperly formed."); } else if (pl_empty(cl_placer = pl_init(pl_data_get(client->line) + location, pl_length_get(client->line) - location))) { - st_sprint(errmsg, "Failed to initialize content length placer."); + //st_sprint(errmsg, "Failed to initialize content length placer."); } else if (!pl_inc(&cl_placer, pl_length_get(client->line) - location) || !(cl_placer.length = pl_length_get(cl_placer)-2)) { - st_sprint(errmsg, "Failed to increment placer to location of content-length value."); + //st_sprint(errmsg, "Failed to increment placer to location of content-length value."); } - else if (!uint32_conv_st(&cl_placer, &content_length)) { - st_sprint(errmsg, "Failed to convert the content-length string to a uint32"); + else if (!size_conv_bl(pl_char_get(cl_placer), pl_length_get(cl_placer), &content_length)) { + //st_sprint(errmsg, "Failed to convert the content-length string to a uint32"); } return content_length; @@ -118,7 +117,7 @@ bool_t check_http_network_basic_sthread(stringer_t *errmsg, uint32_t port, bool_ } // Test submitting a GET request. else if (client_write(client, PLACER("GET / HTTP/1.1\r\nHost: localhost\r\n\r\n", 35)) != 35 || - client_status(client) != 1 || !(content_length = check_http_content_length_get(client, errmsg))) { + client_status(client) != 1 || !(content_length = check_http_content_length_get(client))) { if (st_empty(errmsg)) st_sprint(errmsg, "Failed to return a valid GET response."); client_close(client); return false; -- cgit v1.2.3