Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/lavabit/magma.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjpadkins <jacobpadkins@gmail.com>2017-04-05 02:54:02 +0300
committerjpadkins <jacobpadkins@gmail.com>2017-04-05 02:54:02 +0300
commit2f9a70dcf95882c1cdeea6e6e18fad1bd72389db (patch)
tree5dc1fb8e89678c415c793e9fbbaec46f647d6687 /check/magma/servers/http/http_check_network.c
parent5a438a9d0a7a0f58a827184af64bd1cfabc8b7c1 (diff)
Dirty Commit: Added groundwork for camelface tests
Diffstat (limited to 'check/magma/servers/http/http_check_network.c')
-rw-r--r--check/magma/servers/http/http_check_network.c17
1 files changed, 8 insertions, 9 deletions
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;