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

Function cupsDoFileRequest

cups/request.c:43–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41 */
42
43ipp_t * /* O - Response data */
44cupsDoFileRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
45 ipp_t *request, /* I - IPP request */
46 const char *resource, /* I - HTTP resource for POST */
47 const char *filename) /* I - File to send or @code NULL@ for none */
48{
49 ipp_t *response; /* IPP response data */
50 int infile; /* Input file */
51
52
53 DEBUG_printf(("cupsDoFileRequest(http=%p, request=%p(%s), resource=\"%s\", filename=\"%s\")", (void *)http, (void *)request, request ? ippOpString(request->request.op.operation_id) : "?", resource, filename));
54
55 if (filename)
56 {
57 if ((infile = open(filename, O_RDONLY | O_BINARY)) < 0)
58 {
59 /*
60 * Can't get file information!
61 */
62
63 _cupsSetError(errno == ENOENT ? IPP_STATUS_ERROR_NOT_FOUND : IPP_STATUS_ERROR_NOT_AUTHORIZED,
64 NULL, 0);
65
66 ippDelete(request);
67
68 return (NULL);
69 }
70 }
71 else
72 infile = -1;
73
74 response = cupsDoIORequest(http, request, resource, infile, -1);
75
76 if (infile >= 0)
77 close(infile);
78
79 return (response);
80}
81
82
83/*

Callers 7

do_testFunction · 0.85
print_fileFunction · 0.85
cgiPrintTestPageFunction · 0.85
do_am_printerFunction · 0.85
do_set_optionsFunction · 0.85
set_printer_optionsFunction · 0.85
run_clientFunction · 0.85

Calls 4

ippOpStringFunction · 0.85
_cupsSetErrorFunction · 0.85
ippDeleteFunction · 0.85
cupsDoIORequestFunction · 0.85

Tested by 2

do_testFunction · 0.68
run_clientFunction · 0.68