summaryrefslogtreecommitdiffstats
path: root/src/plugins/hs_apps/http_simple_post.c
diff options
context:
space:
mode:
authorAritra Basu <aritrbas@cisco.com>2024-09-09 21:47:26 -0700
committerFlorin Coras <florin.coras@gmail.com>2024-09-13 21:22:10 +0000
commit6f45f5465f219cb55f0f095c420aae469e550f7f (patch)
treebaaa8a167db282951f1eae9cd6bea93272ff8080 /src/plugins/hs_apps/http_simple_post.c
parent6fbe913e45ff252f5d6497eb81cdcf139afc0d5d (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/hs_apps/http_simple_post.c')
-rw-r--r--src/plugins/hs_apps/http_simple_post.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/plugins/hs_apps/http_simple_post.c b/src/plugins/hs_apps/http_simple_post.c
index 0c2b30ad25c..6212eac1c97 100644
--- a/src/plugins/hs_apps/http_simple_post.c
+++ b/src/plugins/hs_apps/http_simple_post.c
@@ -36,7 +36,7 @@ typedef struct
u8 *target;
u8 *headers_buf;
u8 *data;
- u32 data_offset;
+ u64 data_offset;
hsp_worker_t *wrk;
u8 *http_response;
u8 is_file;
@@ -86,6 +86,8 @@ hsp_session_connected_callback (u32 app_index, u32 hsp_session_index,
hsp_worker_t *wrk;
http_header_t *headers = 0;
http_msg_t msg;
+ u64 to_send;
+ u32 n_enq;
int rv;
if (err)
@@ -166,8 +168,12 @@ hsp_session_connected_callback (u32 app_index, u32 hsp_session_index,
hspm->headers_buf);
ASSERT (rv == msg.data.headers_len);
- rv = svm_fifo_enqueue (s->tx_fifo, vec_len (hspm->data), hspm->data);
- if (rv != vec_len (hspm->data))
+ to_send = vec_len (hspm->data);
+ n_enq = clib_min (svm_fifo_size (s->tx_fifo), to_send);
+
+ rv = svm_fifo_enqueue (s->tx_fifo, n_enq, hspm->data);
+
+ if (rv < to_send)
{
hspm->data_offset = (rv > 0) ? rv : 0;
svm_fifo_add_want_deq_ntf (s->tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
@@ -263,11 +269,14 @@ static int
hsp_tx_callback (session_t *s)
{
hsp_main_t *hspm = &hsp_main;
- u32 to_send;
+ u64 to_send;
+ u32 n_enq;
int rv;
to_send = vec_len (hspm->data) - hspm->data_offset;
- rv = svm_fifo_enqueue (s->tx_fifo, to_send, hspm->data + hspm->data_offset);
+ n_enq = clib_min (svm_fifo_size (s->tx_fifo), to_send);
+
+ rv = svm_fifo_enqueue (s->tx_fifo, n_enq, hspm->data + hspm->data_offset);
if (rv <= 0)
{