diff options
author | Aritra Basu <aritrbas@cisco.com> | 2024-09-09 21:47:26 -0700 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-09-13 21:22:10 +0000 |
commit | 6f45f5465f219cb55f0f095c420aae469e550f7f (patch) | |
tree | baaa8a167db282951f1eae9cd6bea93272ff8080 /src/plugins/http | |
parent | 6fbe913e45ff252f5d6497eb81cdcf139afc0d5d (diff) |
http: update body_len from u32 to u64
Type: improvement
Change-Id: I381541fb180d6d6ba42e4d231d22a73c5d33ef65
Signed-off-by: Aritra Basu <aritrbas@cisco.com>
Diffstat (limited to 'src/plugins/http')
-rw-r--r-- | src/plugins/http/http.c | 15 | ||||
-rw-r--r-- | src/plugins/http/http.h | 6 | ||||
-rw-r--r-- | src/plugins/http/http_plugin.rst | 8 |
3 files changed, 15 insertions, 14 deletions
diff --git a/src/plugins/http/http.c b/src/plugins/http/http.c index d01ee7f0fc6..4f741c2e6b4 100644 --- a/src/plugins/http/http.c +++ b/src/plugins/http/http.c @@ -379,7 +379,7 @@ static const char *http_error_template = "HTTP/1.1 %s\r\n" static const char *http_response_template = "HTTP/1.1 %s\r\n" "Date: %U GMT\r\n" "Server: %v\r\n" - "Content-Length: %u\r\n" + "Content-Length: %llu\r\n" "%s"; /** @@ -393,7 +393,7 @@ static const char *http_get_request_template = "GET %s HTTP/1.1\r\n" static const char *http_post_request_template = "POST %s HTTP/1.1\r\n" "Host: %v\r\n" "User-Agent: %v\r\n" - "Content-Length: %u\r\n" + "Content-Length: %llu\r\n" "%s"; static u32 @@ -853,7 +853,7 @@ http_identify_message_body (http_conn_t *hc, http_status_code_t *ec) unformat_input_t input; int i, len; u8 *line; - u32 body_len; + u64 body_len; hc->body_len = 0; @@ -895,7 +895,7 @@ http_identify_message_body (http_conn_t *hc, http_status_code_t *ec) HTTP_DBG (0, "%v", line); unformat_init_vector (&input, line); - if (!unformat (&input, "%u", &body_len)) + if (!unformat (&input, "%llu", &body_len)) { clib_warning ("failed to unformat content length value"); *ec = HTTP_STATUS_BAD_REQUEST; @@ -905,7 +905,7 @@ http_identify_message_body (http_conn_t *hc, http_status_code_t *ec) hc->body_len = body_len; hc->body_offset = hc->headers_offset + hc->headers_len + 2; - HTTP_DBG (0, "body length: %u", hc->body_len); + HTTP_DBG (0, "body length: %llu", hc->body_len); HTTP_DBG (0, "body offset: %u", hc->body_offset); return 0; @@ -1013,7 +1013,8 @@ http_state_wait_client_method (http_conn_t *hc, transport_send_params_t *sp) http_msg_t msg; session_t *as; int rv; - u32 len, max_enq, max_deq, body_sent; + u32 len, max_enq, body_sent; + u64 max_deq; rv = http_read_message (hc); @@ -1429,7 +1430,7 @@ http_state_client_io_more_data (http_conn_t *hc, transport_send_params_t *sp) return HTTP_SM_ERROR; } hc->to_recv -= rv; - HTTP_DBG (1, "drained %d from ts; remains %d", rv, hc->to_recv); + HTTP_DBG (1, "drained %d from ts; remains %lu", rv, hc->to_recv); /* Finished transaction: * server back to HTTP_STATE_WAIT_APP_REPLY diff --git a/src/plugins/http/http.h b/src/plugins/http/http.h index 35e7d4dcfb6..5f74edb5e47 100644 --- a/src/plugins/http/http.h +++ b/src/plugins/http/http.h @@ -358,7 +358,7 @@ typedef struct http_msg_data_ u32 headers_offset; u32 headers_len; u32 body_offset; - u32 body_len; + u64 body_len; u8 data[0]; } http_msg_data_t; @@ -400,7 +400,7 @@ typedef struct http_tc_ u8 *rx_buf; u32 rx_buf_offset; http_buffer_t tx_buf; - u32 to_recv; + u64 to_recv; u32 bytes_dequeued; u32 control_data_len; /* start line + headers + empty line */ http_target_form_t target_form; @@ -411,7 +411,7 @@ typedef struct http_tc_ u32 headers_offset; u32 headers_len; u32 body_offset; - u32 body_len; + u64 body_len; u16 status_code; } http_conn_t; diff --git a/src/plugins/http/http_plugin.rst b/src/plugins/http/http_plugin.rst index feb2c7fe039..56da3a810b9 100644 --- a/src/plugins/http/http_plugin.rst +++ b/src/plugins/http/http_plugin.rst @@ -152,7 +152,7 @@ We will add following members to our session context structure: typedef struct { /* ... */ - u32 to_recv; + u64 to_recv; u8 *resp_body; } session_ctx_t; @@ -174,7 +174,7 @@ Now we can start reading body content, following block of code could be executed /* dequeue */ u32 n_deq = svm_fifo_max_dequeue (ts->rx_fifo); /* current offset */ - u32 curr = vec_len (ctx->resp_body); + u64 curr = vec_len (ctx->resp_body); rv = svm_fifo_dequeue (ts->rx_fifo, n_deq, ctx->resp_body + curr); ASSERT (rv == n_deq); /* update length of the vector */ @@ -464,7 +464,7 @@ We will add following members to our session context structure: typedef struct { /* ... */ - u32 to_recv; + u64 to_recv; u8 *resp_body; } session_ctx_t; @@ -487,7 +487,7 @@ Now we can start reading body content, following block of code could be executed u32 max_deq = svm_fifo_max_dequeue (ts->rx_fifo); u32 n_deq = clib_min (to_recv, max_deq); /* current offset */ - u32 curr = vec_len (ctx->resp_body); + u64 curr = vec_len (ctx->resp_body); rv = svm_fifo_dequeue (ts->rx_fifo, n_deq, ctx->resp_body + curr); if (rv < 0 || rv != n_deq) { |