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

Function get_document

scheduler/ipp.c:6513–6652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6511 */
6512
6513static void
6514get_document(cupsd_client_t *con, /* I - Client connection */
6515 ipp_attribute_t *uri) /* I - Job URI */
6516{
6517 http_status_t status; /* Policy status */
6518 ipp_attribute_t *attr; /* Current attribute */
6519 int jobid; /* Job ID */
6520 int docnum; /* Document number */
6521 cupsd_job_t *job; /* Current job */
6522 char scheme[HTTP_MAX_URI], /* Method portion of URI */
6523 username[HTTP_MAX_URI], /* Username portion of URI */
6524 host[HTTP_MAX_URI], /* Host portion of URI */
6525 resource[HTTP_MAX_URI]; /* Resource portion of URI */
6526 int port; /* Port portion of URI */
6527 char filename[1024], /* Filename for document */
6528 format[1024]; /* Format for document */
6529
6530
6531 cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_document(%p[%d], %s)", (void *)con,
6532 con->number, uri->values[0].string.text);
6533
6534 /*
6535 * See if we have a job URI or a printer URI...
6536 */
6537
6538 if (!strcmp(uri->name, "printer-uri"))
6539 {
6540 /*
6541 * Got a printer URI; see if we also have a job-id attribute...
6542 */
6543
6544 if ((attr = ippFindAttribute(con->request, "job-id",
6545 IPP_TAG_INTEGER)) == NULL)
6546 {
6547 send_ipp_status(con, IPP_BAD_REQUEST,
6548 _("Got a printer-uri attribute but no job-id."));
6549 return;
6550 }
6551
6552 jobid = attr->values[0].integer;
6553 }
6554 else
6555 {
6556 /*
6557 * Got a job URI; parse it to get the job ID...
6558 */
6559
6560 httpSeparateURI(HTTP_URI_CODING_ALL, uri->values[0].string.text, scheme,
6561 sizeof(scheme), username, sizeof(username), host,
6562 sizeof(host), &port, resource, sizeof(resource));
6563
6564 if (strncmp(resource, "/jobs/", 6))
6565 {
6566 /*
6567 * Not a valid URI!
6568 */
6569
6570 send_ipp_status(con, IPP_BAD_REQUEST, _("Bad job-uri \"%s\"."),

Callers 1

cupsdProcessIPPRequestFunction · 0.85

Calls 10

cupsdLogMessageFunction · 0.85
ippFindAttributeFunction · 0.85
send_ipp_statusFunction · 0.85
httpSeparateURIFunction · 0.85
cupsdFindJobFunction · 0.85
cupsdCheckPolicyFunction · 0.85
send_http_errorFunction · 0.85
cupsdLoadJobFunction · 0.85
ippAddStringFunction · 0.85
ippAddIntegerFunction · 0.85

Tested by

no test coverage detected