* Write a single attribute or the IPP message header...
*/
-// ipp_state = ippWrite(HTTP(con), con->response);
- ipp_state = ippWriteIO(HTTP(con), (ipp_iocb_t)httpWrite2, 1, NULL,
- con->response);
+ ipp_state = ippWrite(HTTP(con), con->response);
/*
* If the write buffer has been flushed, stop buffering up attributes...
while (ipp_state != IPP_STATE_DATA && ipp_state != IPP_STATE_ERROR);
cupsdLogMessage(CUPSD_LOG_DEBUG,
- "[Client %d] Writing IPP response, ipp_state=%d, old "
- "wused=%d, new wused=%d", con->http.fd, ipp_state, wused,
- con->http.wused);
+ "[Client %d] Writing IPP response, ipp_state=%s, old "
+ "wused=%d, new wused=%d", con->http.fd,
+ ipp_state == IPP_STATE_ERROR ? "ERROR" :
+ ipp_state == IPP_STATE_IDLE ? "IDLE" :
+ ipp_state == IPP_STATE_HEADER ? "HEADER" :
+ ipp_state == IPP_STATE_ATTRIBUTE ? "ATTRIBUTE" : "DATA",
+ wused, con->http.wused);
if (con->http.wused > 0)
httpFlushWrite(HTTP(con));
bytes = ipp_state != IPP_STATE_ERROR &&
(con->file >= 0 || ipp_state != IPP_STATE_DATA);
+
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "[Client %d] bytes=%d, http_state=%d, "
+ "data_remaining=" CUPS_LLFMT,
+ con->http.fd, (int)bytes, con->http.state,
+ CUPS_LLCAST con->http.data_remaining);
}
else if ((bytes = read(con->file, con->header + con->header_used,
sizeof(con->header) - con->header_used)) > 0)
}
if (bytes <= 0 ||
- (con->http.state != HTTP_STATE_GET_SEND && con->http.state != HTTP_STATE_POST_SEND))
+ (con->http.state != HTTP_STATE_GET_SEND &&
+ con->http.state != HTTP_STATE_POST_SEND))
{
if (!con->sent_header && con->pipe_pid)
cupsdSendError(con, HTTP_SERVER_ERROR, CUPSD_AUTH_NONE);
httpFlushWrite(HTTP(con));
- if (con->http.data_encoding == HTTP_ENCODING_CHUNKED && con->sent_header == 1)
+ if (con->http.data_encoding == HTTP_ENCODING_CHUNKED &&
+ con->sent_header == 1)
{
if (httpWrite2(HTTP(con), "", 0) < 0)
{
>= IPP_BAD_REQUEST &&
con->response->request.status.status_code
!= IPP_NOT_FOUND ? CUPSD_LOG_ERROR : CUPSD_LOG_DEBUG,
- "Returning IPP %s for %s (%s) from %s",
+ "[Client %d] Returning IPP %s for %s (%s) from %s",
+ con->http.fd,
ippErrorString(con->response->request.status.status_code),
ippOpString(con->request->request.op.operation_id),
uri ? uri->values[0].string.text : "no URI",
con->http.hostname);
- if (LogLevel == CUPSD_LOG_DEBUG2)
- cupsdLogMessage(CUPSD_LOG_DEBUG2,
- "cupsdProcessIPPRequest: ippLength(response)=%ld",
- (long)ippLength(con->response));
-
if (cupsdSendHeader(con, HTTP_OK, "application/ipp", CUPSD_AUTH_NONE))
{
#ifdef CUPSD_USE_CHUNKING
if (con->http.version == HTTP_1_1)
{
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "[Client %d] Transfer-Encoding: chunked",
+ con->http.fd);
+
if (httpPrintf(HTTP(con), "Transfer-Encoding: chunked\r\n\r\n") < 0)
return (0);
length += fileinfo.st_size;
}
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
+ "[Client %d] Content-Length: " CUPS_LLFMT,
+ con->http.fd, CUPS_LLCAST length);
if (httpPrintf(HTTP(con), "Content-Length: " CUPS_LLFMT "\r\n\r\n",
CUPS_LLCAST length) < 0)
return (0);
uri = ippFindAttribute(con->request, "job-uri", IPP_TAG_URI);
cupsdLogMessage(status == HTTP_FORBIDDEN ? CUPSD_LOG_ERROR : CUPSD_LOG_DEBUG,
- "Returning HTTP %s for %s (%s) from %s",
- httpStatus(status),
+ "[Client %d] Returning HTTP %s for %s (%s) from %s",
+ con->http.fd, httpStatus(status),
con->request ?
ippOpString(con->request->request.op.operation_id) :
"no operation-id",