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

Function cupsdWriteClient

scheduler/client.c:2314–2648  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2312 */
2313
2314void
2315cupsdWriteClient(cupsd_client_t *con) /* I - Client connection */
2316{
2317 int bytes, /* Number of bytes written */
2318 field_col; /* Current column */
2319 char *bufptr, /* Pointer into buffer */
2320 *bufend; /* Pointer to end of buffer */
2321 ipp_state_t ipp_state; /* IPP state value */
2322
2323
2324 cupsdLogClient(con, CUPSD_LOG_DEBUG, "con->http=%p", con->http);
2325 cupsdLogClient(con, CUPSD_LOG_DEBUG,
2326 "cupsdWriteClient "
2327 "error=%d, "
2328 "used=%d, "
2329 "state=%s, "
2330 "data_encoding=HTTP_ENCODING_%s, "
2331 "data_remaining=" CUPS_LLFMT ", "
2332 "response=%p(%s), "
2333 "pipe_pid=%d, "
2334 "file=%d",
2335 httpError(con->http), (int)httpGetReady(con->http),
2336 httpStateString(httpGetState(con->http)),
2337 httpIsChunked(con->http) ? "CHUNKED" : "LENGTH",
2338 CUPS_LLCAST httpGetLength2(con->http),
2339 con->response,
2340 con->response ? ippStateString(ippGetState(con->request)) : "",
2341 con->pipe_pid, con->file);
2342
2343 if (httpGetState(con->http) != HTTP_STATE_GET_SEND &&
2344 httpGetState(con->http) != HTTP_STATE_POST_SEND)
2345 {
2346 /*
2347 * If we get called in the wrong state, then something went wrong with the
2348 * connection and we need to shut it down...
2349 */
2350
2351 cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing on unexpected HTTP write state %s.",
2352 httpStateString(httpGetState(con->http)));
2353 cupsdCloseClient(con);
2354 return;
2355 }
2356
2357 if (con->pipe_pid)
2358 {
2359 /*
2360 * Make sure we select on the CGI output...
2361 */
2362
2363 cupsdAddSelect(con->file, (cupsd_selfunc_t)write_pipe, NULL, con);
2364
2365 cupsdLogClient(con, CUPSD_LOG_DEBUG, "Waiting for CGI data.");
2366
2367 if (!con->file_ready)
2368 {
2369 /*
2370 * Try again later when there is CGI output available...
2371 */

Callers

nothing calls this directly

Calls 15

cupsdLogClientFunction · 0.85
httpErrorFunction · 0.85
httpGetReadyFunction · 0.85
httpStateStringFunction · 0.85
httpGetStateFunction · 0.85
httpIsChunkedFunction · 0.85
httpGetLength2Function · 0.85
ippStateStringFunction · 0.85
ippGetStateFunction · 0.85
cupsdCloseClientFunction · 0.85
cupsdAddSelectFunction · 0.85
cupsdRemoveSelectFunction · 0.85

Tested by

no test coverage detected