2 * "$Id: request.c 7946 2008-09-16 23:27:54Z mike $"
4 * IPP utilities for CUPS.
6 * Copyright 2007-2010 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products.
9 * These coded instructions, statements, and computer programs are the
10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
15 * This file is subject to the Apple OS-Developed Software exception.
19 * cupsDoFileRequest() - Do an IPP request with a file.
20 * cupsDoIORequest() - Do an IPP request with file descriptors.
21 * cupsDoRequest() - Do an IPP request.
22 * cupsGetResponse() - Get a response to an IPP request.
23 * cupsLastError() - Return the last IPP status code.
24 * cupsLastErrorString() - Return the last IPP status-message.
25 * cupsReadResponseData() - Read additional data after the IPP response.
26 * cupsSendRequest() - Send an IPP request.
27 * cupsWriteRequestData() - Write additional data after an IPP request.
28 * _cupsConnect() - Get the default server connection...
29 * _cupsSetError() - Set the last IPP status code and status-message.
30 * _cupsSetHTTPError() - Set the last error using the HTTP status.
34 * Include necessary headers...
37 #include "cups-private.h"
40 #if defined(WIN32) || defined(__EMX__)
44 #endif /* WIN32 || __EMX__ */
51 * 'cupsDoFileRequest()' - Do an IPP request with a file.
53 * This function sends the IPP request to the specified server, retrying
54 * and authenticating as necessary. The request is freed with @link ippDelete@
55 * after receiving a valid IPP response.
58 ipp_t
* /* O - Response data */
59 cupsDoFileRequest(http_t
*http
, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
60 ipp_t
*request
, /* I - IPP request */
61 const char *resource
, /* I - HTTP resource for POST */
62 const char *filename
) /* I - File to send or @code NULL@ for none */
64 ipp_t
*response
; /* IPP response data */
65 int infile
; /* Input file */
68 DEBUG_printf(("cupsDoFileRequest(http=%p, request=%p(%s), resource=\"%s\", "
69 "filename=\"%s\")", http
, request
,
70 request
? ippOpString(request
->request
.op
.operation_id
) : "?",
75 if ((infile
= open(filename
, O_RDONLY
| O_BINARY
)) < 0)
78 * Can't get file information!
81 _cupsSetError(errno
== ENOENT
? IPP_NOT_FOUND
: IPP_NOT_AUTHORIZED
,
92 response
= cupsDoIORequest(http
, request
, resource
, infile
, -1);
102 * 'cupsDoIORequest()' - Do an IPP request with file descriptors.
104 * This function sends the IPP request to the specified server, retrying
105 * and authenticating as necessary. The request is freed with ippDelete()
106 * after receiving a valid IPP response.
108 * If "infile" is a valid file descriptor, cupsDoIORequest() copies
109 * all of the data from the file after the IPP request message.
111 * If "outfile" is a valid file descriptor, cupsDoIORequest() copies
112 * all of the data after the IPP response message to the file.
114 * @since CUPS 1.3/Mac OS X 10.5@
117 ipp_t
* /* O - Response data */
118 cupsDoIORequest(http_t
*http
, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
119 ipp_t
*request
, /* I - IPP request */
120 const char *resource
, /* I - HTTP resource for POST */
121 int infile
, /* I - File to read from or -1 for none */
122 int outfile
) /* I - File to write to or -1 for none */
124 ipp_t
*response
= NULL
; /* IPP response data */
125 size_t length
= 0; /* Content-Length value */
126 http_status_t status
; /* Status of HTTP request */
127 struct stat fileinfo
; /* File information */
128 int bytes
; /* Number of bytes read/written */
129 char buffer
[32768]; /* Output buffer */
132 DEBUG_printf(("cupsDoIORequest(http=%p, request=%p(%s), resource=\"%s\", "
133 "infile=%d, outfile=%d)", http
, request
,
134 request
? ippOpString(request
->request
.op
.operation_id
) : "?",
135 resource
, infile
, outfile
));
138 * Range check input...
141 if (!request
|| !resource
)
145 _cupsSetError(IPP_INTERNAL_ERROR
, strerror(EINVAL
), 0);
151 * Get the default connection as needed...
155 if ((http
= _cupsConnect()) == NULL
)
159 * See if we have a file to send...
164 if (fstat(infile
, &fileinfo
))
167 * Can't get file information!
170 _cupsSetError(errno
== EBADF
? IPP_NOT_FOUND
: IPP_NOT_AUTHORIZED
,
179 if (fileinfo
.st_mode
& _S_IFDIR
)
181 if (S_ISDIR(fileinfo
.st_mode
))
185 * Can't send a directory...
190 _cupsSetError(IPP_NOT_POSSIBLE
, strerror(EISDIR
), 0);
196 if (!S_ISREG(fileinfo
.st_mode
))
197 length
= 0; /* Chunk when piping */
200 length
= ippLength(request
) + fileinfo
.st_size
;
203 length
= ippLength(request
);
205 DEBUG_printf(("2cupsDoIORequest: Request length=%ld, total length=%ld",
206 (long)ippLength(request
), (long)length
));
209 * Clear any "Local" authentication data since it is probably stale...
212 if (http
->authstring
&& !strncmp(http
->authstring
, "Local ", 6))
213 httpSetAuthString(http
, NULL
, NULL
);
216 * Loop until we can send the request without authorization problems.
219 while (response
== NULL
)
221 DEBUG_puts("2cupsDoIORequest: setup...");
224 * Send the request...
227 status
= cupsSendRequest(http
, request
, resource
, length
);
229 DEBUG_printf(("2cupsDoIORequest: status=%d", status
));
231 if (status
== HTTP_CONTINUE
&& request
->state
== IPP_DATA
&& infile
>= 0)
233 DEBUG_puts("2cupsDoIORequest: file write...");
236 * Send the file with the request...
240 if (S_ISREG(fileinfo
.st_mode
))
242 lseek(infile
, 0, SEEK_SET
);
244 while ((bytes
= (int)read(infile
, buffer
, sizeof(buffer
))) > 0)
248 if ((status
= httpUpdate(http
)) != HTTP_CONTINUE
)
252 if (httpWrite2(http
, buffer
, bytes
) < bytes
)
258 * Get the server's response...
261 if (status
== HTTP_CONTINUE
|| status
== HTTP_OK
)
263 response
= cupsGetResponse(http
, resource
);
264 status
= http
->status
;
269 DEBUG_printf(("2cupsDoIORequest: status=%d", status
));
271 if (status
== HTTP_ERROR
||
272 (status
>= HTTP_BAD_REQUEST
&& status
!= HTTP_UNAUTHORIZED
&&
273 status
!= HTTP_UPGRADE_REQUIRED
))
275 _cupsSetHTTPError(status
);
284 * Write trailing data to file...
287 while ((bytes
= (int)httpRead2(http
, buffer
, sizeof(buffer
))) > 0)
288 if (write(outfile
, buffer
, bytes
) < bytes
)
294 * Flush any remaining data...
303 * Delete the original request and return the response...
313 * 'cupsDoRequest()' - Do an IPP request.
315 * This function sends the IPP request to the specified server, retrying
316 * and authenticating as necessary. The request is freed with ippDelete()
317 * after receiving a valid IPP response.
320 ipp_t
* /* O - Response data */
321 cupsDoRequest(http_t
*http
, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
322 ipp_t
*request
, /* I - IPP request */
323 const char *resource
) /* I - HTTP resource for POST */
325 DEBUG_printf(("cupsDoRequest(http=%p, request=%p(%s), resource=\"%s\")",
327 request
? ippOpString(request
->request
.op
.operation_id
) : "?",
330 return (cupsDoIORequest(http
, request
, resource
, -1, -1));
335 * 'cupsGetResponse()' - Get a response to an IPP request.
337 * Use this function to get the response for an IPP request sent using
338 * cupsSendDocument() or cupsSendRequest(). For requests that return
339 * additional data, use httpRead() after getting a successful response.
341 * @since CUPS 1.4/Mac OS X 10.6@
344 ipp_t
* /* O - Response or @code NULL@ on HTTP error */
345 cupsGetResponse(http_t
*http
, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
346 const char *resource
) /* I - HTTP resource for POST */
348 http_status_t status
; /* HTTP status */
349 ipp_state_t state
; /* IPP read state */
350 ipp_t
*response
= NULL
; /* IPP response */
353 DEBUG_printf(("cupsGetResponse(http=%p, resource=\"%s\")", http
, resource
));
356 * Connect to the default server as needed...
360 http
= _cupsConnect();
362 if (!http
|| (http
->state
!= HTTP_POST_RECV
&& http
->state
!= HTTP_POST_SEND
))
366 * Check for an unfinished chunked request...
369 if (http
->data_encoding
== HTTP_ENCODE_CHUNKED
)
372 * Send a 0-length chunk to finish off the request...
375 DEBUG_puts("2cupsGetResponse: Finishing chunked POST...");
377 if (httpWrite2(http
, "", 0) < 0)
382 * Wait for a response from the server...
385 DEBUG_printf(("2cupsGetResponse: Update loop, http->status=%d...",
388 status
= http
->status
;
389 while (status
== HTTP_CONTINUE
)
390 status
= httpUpdate(http
);
392 DEBUG_printf(("2cupsGetResponse: status=%d", status
));
394 if (status
== HTTP_OK
)
397 * Get the IPP response...
402 while ((state
= ippRead(http
, response
)) != IPP_DATA
)
403 if (state
== IPP_ERROR
)
406 if (state
== IPP_ERROR
)
409 * Delete the response...
412 DEBUG_puts("1cupsGetResponse: IPP read error!");
417 _cupsSetError(IPP_SERVICE_UNAVAILABLE
, NULL
, 0);
420 else if (status
!= HTTP_ERROR
)
423 * Flush any error message...
429 * Then handle encryption and authentication...
432 if (status
== HTTP_UNAUTHORIZED
)
435 * See if we can do authentication...
438 DEBUG_puts("2cupsGetResponse: Need authorization...");
440 if (!cupsDoAuthentication(http
, "POST", resource
))
443 status
= HTTP_AUTHORIZATION_CANCELED
;
447 else if (status
== HTTP_UPGRADE_REQUIRED
)
450 * Force a reconnect with encryption...
453 DEBUG_puts("2cupsGetResponse: Need encryption...");
455 if (!httpReconnect(http
))
456 httpEncryption(http
, HTTP_ENCRYPT_REQUIRED
);
458 #endif /* HAVE_SSL */
463 ipp_attribute_t
*attr
; /* status-message attribute */
466 attr
= ippFindAttribute(response
, "status-message", IPP_TAG_TEXT
);
468 DEBUG_printf(("1cupsGetResponse: status-code=%s, status-message=\"%s\"",
469 ippErrorString(response
->request
.status
.status_code
),
470 attr
? attr
->values
[0].string
.text
: ""));
472 _cupsSetError(response
->request
.status
.status_code
,
473 attr
? attr
->values
[0].string
.text
:
474 ippErrorString(response
->request
.status
.status_code
), 0);
476 else if (status
!= HTTP_OK
)
477 _cupsSetHTTPError(status
);
484 * 'cupsLastError()' - Return the last IPP status code.
487 ipp_status_t
/* O - IPP status code from last request */
490 return (_cupsGlobals()->last_error
);
495 * 'cupsLastErrorString()' - Return the last IPP status-message.
497 * @since CUPS 1.2/Mac OS X 10.5@
500 const char * /* O - status-message text from last request */
501 cupsLastErrorString(void)
503 return (_cupsGlobals()->last_status_message
);
508 * 'cupsReadResponseData()' - Read additional data after the IPP response.
510 * This function is used after cupsGetResponse() to read the PPD or document
511 * files for CUPS_GET_PPD and CUPS_GET_DOCUMENT requests, respectively.
513 * @since CUPS 1.4/Mac OS X 10.6@
516 ssize_t
/* O - Bytes read, 0 on EOF, -1 on error */
517 cupsReadResponseData(
518 http_t
*http
, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
519 char *buffer
, /* I - Buffer to use */
520 size_t length
) /* I - Number of bytes to read */
523 * Get the default connection as needed...
526 DEBUG_printf(("cupsReadResponseData(http=%p, buffer=%p, "
527 "length=" CUPS_LLFMT
")", http
, buffer
, CUPS_LLCAST length
));
531 _cups_globals_t
*cg
= _cupsGlobals();
532 /* Pointer to library globals */
534 if ((http
= cg
->http
) == NULL
)
536 _cupsSetError(IPP_INTERNAL_ERROR
, _("No active connection"), 1);
542 * Then read from the HTTP connection...
545 return (httpRead2(http
, buffer
, length
));
550 * 'cupsSendRequest()' - Send an IPP request.
552 * Use httpWrite() to write any additional data (document, PPD file, etc.)
553 * for the request, cupsGetResponse() to get the IPP response, and httpRead()
554 * to read any additional data following the response. Only one request can be
555 * sent/queued at a time.
557 * Unlike cupsDoFileRequest(), cupsDoIORequest(), and cupsDoRequest(), the
558 * request is not freed.
560 * @since CUPS 1.4/Mac OS X 10.6@
563 http_status_t
/* O - Initial HTTP status */
564 cupsSendRequest(http_t
*http
, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
565 ipp_t
*request
, /* I - IPP request */
566 const char *resource
, /* I - Resource path */
567 size_t length
) /* I - Length of data to follow or @code CUPS_LENGTH_VARIABLE@ */
569 http_status_t status
; /* Status of HTTP request */
570 int got_status
; /* Did we get the status? */
571 ipp_state_t state
; /* State of IPP processing */
572 http_status_t expect
; /* Expect: header to use */
575 DEBUG_printf(("cupsSendRequest(http=%p, request=%p(%s), resource=\"%s\", "
576 "length=" CUPS_LLFMT
")", http
, request
,
577 request
? ippOpString(request
->request
.op
.operation_id
) : "?",
578 resource
, CUPS_LLCAST length
));
581 * Range check input...
584 if (!request
|| !resource
)
586 _cupsSetError(IPP_INTERNAL_ERROR
, strerror(EINVAL
), 0);
592 * Get the default connection as needed...
596 if ((http
= _cupsConnect()) == NULL
)
597 return (HTTP_SERVICE_UNAVAILABLE
);
601 * See if we have an auth-info attribute and are communicating over
602 * a non-local link. If so, encrypt the link so that we can pass
603 * the authentication information securely...
606 if (ippFindAttribute(request
, "auth-info", IPP_TAG_TEXT
) &&
607 !httpAddrLocalhost(http
->hostaddr
) && !http
->tls
&&
608 httpEncryption(http
, HTTP_ENCRYPT_REQUIRED
))
610 _cupsSetError(IPP_SERVICE_UNAVAILABLE
, NULL
, 0);
611 return (HTTP_SERVICE_UNAVAILABLE
);
613 #endif /* HAVE_SSL */
616 * Reconnect if the last response had a "Connection: close"...
619 if (!strcasecmp(http
->fields
[HTTP_FIELD_CONNECTION
], "close"))
620 if (httpReconnect(http
))
622 _cupsSetError(IPP_SERVICE_UNAVAILABLE
, NULL
, 0);
623 return (HTTP_SERVICE_UNAVAILABLE
);
627 * Loop until we can send the request without authorization problems.
630 expect
= HTTP_CONTINUE
;
634 DEBUG_puts("2cupsSendRequest: Setup...");
637 * Setup the HTTP variables needed...
640 httpClearFields(http
);
641 httpSetExpect(http
, expect
);
642 httpSetField(http
, HTTP_FIELD_CONTENT_TYPE
, "application/ipp");
643 httpSetLength(http
, length
);
646 if (http
->authstring
&& !strncmp(http
->authstring
, "Negotiate", 9))
649 * Do not use cached Kerberos credentials since they will look like a
653 cupsDoAuthentication(http
, "POST", resource
);
656 #endif /* HAVE_GSSAPI */
657 httpSetField(http
, HTTP_FIELD_AUTHORIZATION
, http
->authstring
);
659 DEBUG_printf(("2cupsSendRequest: authstring=\"%s\"", http
->authstring
));
665 DEBUG_puts("2cupsSendRequest: Sending HTTP POST...");
667 if (httpPost(http
, resource
))
669 if (httpReconnect(http
))
671 _cupsSetError(IPP_SERVICE_UNAVAILABLE
, NULL
, 0);
672 return (HTTP_SERVICE_UNAVAILABLE
);
679 * Send the IPP data...
682 DEBUG_puts("2cupsSendRequest: Writing IPP request...");
684 request
->state
= IPP_IDLE
;
685 status
= HTTP_CONTINUE
;
688 while ((state
= ippWrite(http
, request
)) != IPP_DATA
)
689 if (state
== IPP_ERROR
)
691 else if (httpCheck(http
))
695 if ((status
= httpUpdate(http
)) != HTTP_CONTINUE
)
700 * Wait up to 1 second to get the 100-continue response as needed...
703 if (!got_status
&& expect
== HTTP_CONTINUE
)
705 DEBUG_puts("2cupsSendRequest: Waiting for 100-continue...");
707 if (httpWait(http
, 1000))
708 status
= httpUpdate(http
);
710 else if (httpCheck(http
))
711 status
= httpUpdate(http
);
713 DEBUG_printf(("2cupsSendRequest: status=%d", status
));
716 * Process the current HTTP status...
719 if (status
>= HTTP_BAD_REQUEST
)
729 case HTTP_UNAUTHORIZED
:
730 if (cupsDoAuthentication(http
, "POST", resource
))
731 return (HTTP_AUTHORIZATION_CANCELED
);
733 if (httpReconnect(http
))
735 _cupsSetError(IPP_SERVICE_UNAVAILABLE
, NULL
, 0);
736 return (HTTP_SERVICE_UNAVAILABLE
);
741 case HTTP_UPGRADE_REQUIRED
:
743 * Flush any error message, reconnect, and then upgrade with
747 if (httpReconnect(http
))
749 _cupsSetError(IPP_SERVICE_UNAVAILABLE
, NULL
, 0);
750 return (HTTP_SERVICE_UNAVAILABLE
);
753 if (httpEncryption(http
, HTTP_ENCRYPT_REQUIRED
))
755 _cupsSetError(IPP_SERVICE_UNAVAILABLE
, NULL
, 0);
756 return (HTTP_SERVICE_UNAVAILABLE
);
759 #endif /* HAVE_SSL */
761 case HTTP_EXPECTATION_FAILED
:
763 * Don't try using the Expect: header the next time around...
766 expect
= (http_status_t
)0;
768 if (httpReconnect(http
))
770 _cupsSetError(IPP_SERVICE_UNAVAILABLE
, NULL
, 0);
771 return (HTTP_SERVICE_UNAVAILABLE
);
777 * Some other error...
787 * 'cupsWriteRequestData()' - Write additional data after an IPP request.
789 * This function is used after @link cupsSendRequest@ to provide a PPD and
790 * after @link cupsStartDocument@ to provide a document file.
792 * @since CUPS 1.4/Mac OS X 10.6@
795 http_status_t
/* O - @code HTTP_CONTINUE@ if OK or HTTP status on error */
796 cupsWriteRequestData(
797 http_t
*http
, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
798 const char *buffer
, /* I - Bytes to write */
799 size_t length
) /* I - Number of bytes to write */
801 int wused
; /* Previous bytes in buffer */
805 * Get the default connection as needed...
808 DEBUG_printf(("cupsWriteRequestData(http=%p, buffer=%p, "
809 "length=" CUPS_LLFMT
")", http
, buffer
, CUPS_LLCAST length
));
813 _cups_globals_t
*cg
= _cupsGlobals();
814 /* Pointer to library globals */
816 if ((http
= cg
->http
) == NULL
)
818 _cupsSetError(IPP_INTERNAL_ERROR
, _("No active connection"), 1);
819 DEBUG_puts("1cupsWriteRequestData: Returning HTTP_ERROR.");
825 * Then write to the HTTP connection...
830 if (httpWrite2(http
, buffer
, length
) < 0)
832 DEBUG_puts("1cupsWriteRequestData: Returning HTTP_ERROR.");
833 _cupsSetError(IPP_INTERNAL_ERROR
, strerror(http
->error
), 0);
838 * Finally, check if we have any pending data from the server...
841 if (length
>= HTTP_MAX_BUFFER
||
842 http
->wused
< wused
||
843 (wused
> 0 && http
->wused
== length
))
846 * We've written something to the server, so check for response data...
849 if (_httpWait(http
, 0, 1))
851 http_status_t status
; /* Status from httpUpdate */
853 if ((status
= httpUpdate(http
)) >= HTTP_BAD_REQUEST
)
855 _cupsSetHTTPError(status
);
859 DEBUG_printf(("1cupsWriteRequestData: Returning %d.\n", status
));
864 DEBUG_puts("1cupsWriteRequestData: Returning HTTP_CONTINUE.");
865 return (HTTP_CONTINUE
);
870 * '_cupsConnect()' - Get the default server connection...
873 http_t
* /* O - HTTP connection */
876 _cups_globals_t
*cg
= _cupsGlobals(); /* Pointer to library globals */
880 * See if we are connected to the same server...
886 * Compare the connection hostname, port, and encryption settings to
887 * the cached defaults; these were initialized the first time we
891 if (strcmp(cg
->http
->hostname
, cg
->server
) ||
892 cg
->ipp_port
!= _httpAddrPort(cg
->http
->hostaddr
) ||
893 (cg
->http
->encryption
!= cg
->encryption
&&
894 cg
->http
->encryption
== HTTP_ENCRYPT_NEVER
))
897 * Need to close the current connection because something has changed...
906 * (Re)connect as needed...
911 if ((cg
->http
= httpConnectEncrypt(cupsServer(), ippPort(),
912 cupsEncryption())) == NULL
)
915 _cupsSetError(IPP_SERVICE_UNAVAILABLE
, NULL
, 0);
917 _cupsSetError(IPP_SERVICE_UNAVAILABLE
,
918 _("Unable to connect to host."), 1);
923 * Return the cached connection...
931 * '_cupsSetError()' - Set the last IPP status code and status-message.
935 _cupsSetError(ipp_status_t status
, /* I - IPP status code */
936 const char *message
, /* I - status-message value */
937 int localize
) /* I - Localize the message? */
939 _cups_globals_t
*cg
; /* Global data */
942 if (!message
&& errno
)
944 message
= strerror(errno
);
949 cg
->last_error
= status
;
951 if (cg
->last_status_message
)
953 _cupsStrFree(cg
->last_status_message
);
955 cg
->last_status_message
= NULL
;
963 * Get the message catalog...
966 if (!cg
->lang_default
)
967 cg
->lang_default
= cupsLangDefault();
969 cg
->last_status_message
= _cupsStrAlloc(_cupsLangString(cg
->lang_default
,
973 cg
->last_status_message
= _cupsStrAlloc(message
);
976 DEBUG_printf(("4_cupsSetError: last_error=%s, last_status_message=\"%s\"",
977 ippErrorString(cg
->last_error
), cg
->last_status_message
));
982 * '_cupsSetHTTPError()' - Set the last error using the HTTP status.
986 _cupsSetHTTPError(http_status_t status
) /* I - HTTP status code */
990 case HTTP_NOT_FOUND
:
991 _cupsSetError(IPP_NOT_FOUND
, httpStatus(status
), 0);
994 case HTTP_UNAUTHORIZED
:
995 _cupsSetError(IPP_NOT_AUTHENTICATED
, httpStatus(status
), 0);
998 case HTTP_AUTHORIZATION_CANCELED
:
999 _cupsSetError(IPP_AUTHENTICATION_CANCELED
, httpStatus(status
), 0);
1002 case HTTP_FORBIDDEN
:
1003 _cupsSetError(IPP_FORBIDDEN
, httpStatus(status
), 0);
1006 case HTTP_BAD_REQUEST
:
1007 _cupsSetError(IPP_BAD_REQUEST
, httpStatus(status
), 0);
1010 case HTTP_REQUEST_TOO_LARGE
:
1011 _cupsSetError(IPP_REQUEST_VALUE
, httpStatus(status
), 0);
1014 case HTTP_NOT_IMPLEMENTED
:
1015 _cupsSetError(IPP_OPERATION_NOT_SUPPORTED
, httpStatus(status
), 0);
1018 case HTTP_NOT_SUPPORTED
:
1019 _cupsSetError(IPP_VERSION_NOT_SUPPORTED
, httpStatus(status
), 0);
1022 case HTTP_UPGRADE_REQUIRED
:
1023 _cupsSetError(IPP_UPGRADE_REQUIRED
, httpStatus(status
), 0);
1026 case HTTP_PKI_ERROR
:
1027 _cupsSetError(IPP_PKI_ERROR
, httpStatus(status
), 0);
1031 _cupsSetError(IPP_INTERNAL_ERROR
, httpStatus(status
), 0);
1035 DEBUG_printf(("4_cupsSetHTTPError: HTTP error %d mapped to "
1036 "IPP_SERVICE_UNAVAILABLE!", status
));
1037 _cupsSetError(IPP_SERVICE_UNAVAILABLE
, httpStatus(status
), 0);
1044 * End of "$Id: request.c 7946 2008-09-16 23:27:54Z mike $".