MCPcopy Create free account
hub / github.com/OpenPrinting/cups / http_set_length

Function http_set_length

cups/http.c:4553–4594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4551 */
4552
4553static off_t /* O - Remainder or -1 on error */
4554http_set_length(http_t *http) /* I - Connection */
4555{
4556 off_t remaining; /* Remainder */
4557
4558
4559 DEBUG_printf(("4http_set_length(http=%p) mode=%d state=%s", (void *)http, http->mode, httpStateString(http->state)));
4560
4561 if ((remaining = httpGetLength2(http)) >= 0)
4562 {
4563 if (http->mode == _HTTP_MODE_SERVER &&
4564 http->state != HTTP_STATE_GET_SEND &&
4565 http->state != HTTP_STATE_PUT &&
4566 http->state != HTTP_STATE_POST &&
4567 http->state != HTTP_STATE_POST_SEND)
4568 {
4569 DEBUG_puts("5http_set_length: Not setting data_encoding/remaining.");
4570 return (remaining);
4571 }
4572
4573 if (!_cups_strcasecmp(httpGetField(http, HTTP_FIELD_TRANSFER_ENCODING), "chunked"))
4574 {
4575 DEBUG_puts("5http_set_length: Setting data_encoding to HTTP_ENCODING_CHUNKED.");
4576 http->data_encoding = HTTP_ENCODING_CHUNKED;
4577 }
4578 else
4579 {
4580 DEBUG_puts("5http_set_length: Setting data_encoding to HTTP_ENCODING_LENGTH.");
4581 http->data_encoding = HTTP_ENCODING_LENGTH;
4582 }
4583
4584 DEBUG_printf(("5http_set_length: Setting data_remaining to " CUPS_LLFMT ".", CUPS_LLCAST remaining));
4585 http->data_remaining = remaining;
4586
4587 if (remaining <= INT_MAX)
4588 http->_data_remaining = (int)remaining;
4589 else
4590 http->_data_remaining = INT_MAX;
4591 }
4592
4593 return (remaining);
4594}
4595
4596/*
4597 * 'http_set_timeout()' - Set the socket timeout values.

Callers 3

_httpUpdateFunction · 0.85
httpWriteResponseFunction · 0.85
http_sendFunction · 0.85

Calls 4

httpStateStringFunction · 0.85
httpGetLength2Function · 0.85
_cups_strcasecmpFunction · 0.85
httpGetFieldFunction · 0.85

Tested by

no test coverage detected