u32 thread_index;
u32 rx_offset;
u32 vpp_session_index;
- u32 to_recv;
+ u64 to_recv;
u8 is_closed;
http_header_t *req_headers;
} hcc_session_t;
u32 max_deq = svm_fifo_max_dequeue (ts->rx_fifo);
u32 n_deq = clib_min (hs->to_recv, max_deq);
- u32 curr = vec_len (hcm->http_response);
+ u64 curr = vec_len (hcm->http_response);
rv = svm_fifo_dequeue (ts->rx_fifo, n_deq, hcm->http_response + curr);
if (rv < 0)
{
vec_set_len (hcm->http_response, curr + n_deq);
ASSERT (hs->to_recv >= rv);
hs->to_recv -= rv;
- HCC_DBG ("app rcvd %d, remains %d", rv, hs->to_recv);
+ HCC_DBG ("app rcvd %d, remains %llu", rv, hs->to_recv);
done:
if (hs->to_recv == 0)
u8 *target;
u8 *headers_buf;
u8 *data;
- u32 data_offset;
+ u64 data_offset;
hsp_worker_t *wrk;
u8 *http_response;
u8 is_file;
hsp_worker_t *wrk;
http_header_t *headers = 0;
http_msg_t msg;
+ u64 to_send;
+ u32 n_enq;
int rv;
if (err)
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);
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)
{
u64 data_len;
u64 data_offset;
u32 vpp_session_index;
- u32 left_recv;
- u32 total_recv;
+ u64 left_recv;
+ u64 total_recv;
union
{
/** threshold after which connection is closed */
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";
/**
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
unformat_input_t input;
int i, len;
u8 *line;
- u32 body_len;
+ u64 body_len;
hc->body_len = 0;
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;
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;
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);
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
u32 headers_offset;
u32 headers_len;
u32 body_offset;
- u32 body_len;
+ u64 body_len;
u8 data[0];
} http_msg_data_t;
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;
u32 headers_offset;
u32 headers_len;
u32 body_offset;
- u32 body_len;
+ u64 body_len;
u16 status_code;
} http_conn_t;
typedef struct
{
/* ... */
- u32 to_recv;
+ u64 to_recv;
u8 *resp_body;
} session_ctx_t;
/* 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 */
typedef struct
{
/* ... */
- u32 to_recv;
+ u64 to_recv;
u8 *resp_body;
} session_ctx_t;
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)
{
/** Data length */
u64 data_len;
/** Current data send offset */
- u32 data_offset;
+ u64 data_offset;
/** Need to free data in detach_cache_entry */
int free_data;
/** File cache pool index */
http_msg_t msg;
session_t *ts;
u8 *headers_buf = 0;
+ u32 n_enq;
+ u64 to_send;
int rv;
ts = session_get (hs->vpp_session_index, hs->thread_index);
if (!msg.data.body_len)
goto done;
- rv = svm_fifo_enqueue (ts->tx_fifo, hs->data_len, hs->data);
+ to_send = hs->data_len;
+ n_enq = clib_min (svm_fifo_size (ts->tx_fifo), to_send);
- if (rv != hs->data_len)
+ rv = svm_fifo_enqueue (ts->tx_fifo, n_enq, hs->data);
+
+ if (rv < to_send)
{
hs->data_offset = (rv > 0) ? rv : 0;
svm_fifo_add_want_deq_ntf (ts->tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
hss_ts_tx_callback (session_t *ts)
{
hss_session_t *hs;
- u32 to_send;
+ u32 n_enq;
+ u64 to_send;
int rv;
hs = hss_session_get (ts->thread_index, ts->opaque);
return 0;
to_send = hs->data_len - hs->data_offset;
- rv = svm_fifo_enqueue (ts->tx_fifo, to_send, hs->data + hs->data_offset);
+ n_enq = clib_min (svm_fifo_size (ts->tx_fifo), to_send);
+
+ rv = svm_fifo_enqueue (ts->tx_fifo, n_enq, hs->data + hs->data_offset);
if (rv <= 0)
{
hss_session_t *hs = va_arg (*args, hss_session_t *);
int __clib_unused verbose = va_arg (*args, int);
- s = format (s, "\n path %s, data length %u, data_offset %u",
+ s = format (s, "\n path %s, data length %llu, data_offset %llu",
hs->path ? hs->path : (u8 *) "[none]", hs->data_len,
hs->data_offset);
return s;