]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/request.c
Merge changes from CUPS 1.4svn-r7851.
[thirdparty/cups.git] / cups / request.c
1 /*
2 * "$Id: request.c 7460 2008-04-16 02:19:54Z mike $"
3 *
4 * IPP utilities for the Common UNIX Printing System (CUPS).
5 *
6 * Copyright 2007-2008 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products.
8 *
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/".
14 *
15 * This file is subject to the Apple OS-Developed Software exception.
16 *
17 * Contents:
18 *
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 * cupsReadResponseData() - Read additional data after the IPP response.
24 * cupsSendRequest() - Send an IPP request.
25 * cupsWriteRequestData() - Write additional data after an IPP request.
26 * _cupsSetError() - Set the last IPP status code and status-message.
27 * _cupsSetHTTPError() - Set the last error using the HTTP status.
28 */
29
30 /*
31 * Include necessary headers...
32 */
33
34 #include "globals.h"
35 #include "debug.h"
36 #include <stdlib.h>
37 #include <errno.h>
38 #include <fcntl.h>
39 #include <sys/stat.h>
40 #if defined(WIN32) || defined(__EMX__)
41 # include <io.h>
42 #else
43 # include <unistd.h>
44 #endif /* WIN32 || __EMX__ */
45 #ifndef O_BINARY
46 # define O_BINARY 0
47 #endif /* O_BINARY */
48
49
50 /*
51 * 'cupsDoFileRequest()' - Do an IPP request with a file.
52 *
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.
56 */
57
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 */
63 {
64 ipp_t *response; /* IPP response data */
65 int infile; /* Input file */
66
67
68 DEBUG_printf(("cupsDoFileRequest(http=%p, request=%p(%s), resource=\"%s\", "
69 "filename=\"%s\")\n", http, request,
70 request ? ippOpString(request->request.op.operation_id) : "?",
71 resource ? resource : "(null)",
72 filename ? filename : "(null)"));
73
74 if (filename)
75 {
76 if ((infile = open(filename, O_RDONLY | O_BINARY)) < 0)
77 {
78 /*
79 * Can't get file information!
80 */
81
82 _cupsSetError(errno == ENOENT ? IPP_NOT_FOUND : IPP_NOT_AUTHORIZED,
83 NULL, 0);
84
85 ippDelete(request);
86
87 return (NULL);
88 }
89 }
90 else
91 infile = -1;
92
93 response = cupsDoIORequest(http, request, resource, infile, -1);
94
95 if (infile >= 0)
96 close(infile);
97
98 return (response);
99 }
100
101
102 /*
103 * 'cupsDoIORequest()' - Do an IPP request with file descriptors.
104 *
105 * This function sends the IPP request to the specified server, retrying
106 * and authenticating as necessary. The request is freed with ippDelete()
107 * after receiving a valid IPP response.
108 *
109 * If "infile" is a valid file descriptor, cupsDoIORequest() copies
110 * all of the data from the file after the IPP request message.
111 *
112 * If "outfile" is a valid file descriptor, cupsDoIORequest() copies
113 * all of the data after the IPP response message to the file.
114 *
115 * @since CUPS 1.3@
116 */
117
118 ipp_t * /* O - Response data */
119 cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
120 ipp_t *request, /* I - IPP request */
121 const char *resource, /* I - HTTP resource for POST */
122 int infile, /* I - File to read from or -1 for none */
123 int outfile) /* I - File to write to or -1 for none */
124 {
125 ipp_t *response = NULL; /* IPP response data */
126 size_t length = 0; /* Content-Length value */
127 http_status_t status; /* Status of HTTP request */
128 struct stat fileinfo; /* File information */
129 int bytes; /* Number of bytes read/written */
130 char buffer[32768]; /* Output buffer */
131
132
133 DEBUG_printf(("cupsDoIORequest(http=%p, request=%p(%s), resource=\"%s\", "
134 "infile=%d, outfile=%d)\n", http, request,
135 request ? ippOpString(request->request.op.operation_id) : "?",
136 resource ? resource : "(null)", infile, outfile));
137
138 /*
139 * Range check input...
140 */
141
142 if (!request || !resource)
143 {
144 ippDelete(request);
145
146 _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
147
148 return (NULL);
149 }
150
151 /*
152 * Get the default connection as needed...
153 */
154
155 if (!http)
156 if ((http = _cupsConnect()) == NULL)
157 return (NULL);
158
159 /*
160 * See if we have a file to send...
161 */
162
163 if (infile >= 0)
164 {
165 if (fstat(infile, &fileinfo))
166 {
167 /*
168 * Can't get file information!
169 */
170
171 _cupsSetError(errno == EBADF ? IPP_NOT_FOUND : IPP_NOT_AUTHORIZED,
172 NULL, 0);
173
174 ippDelete(request);
175
176 return (NULL);
177 }
178
179 #ifdef WIN32
180 if (fileinfo.st_mode & _S_IFDIR)
181 #else
182 if (S_ISDIR(fileinfo.st_mode))
183 #endif /* WIN32 */
184 {
185 /*
186 * Can't send a directory...
187 */
188
189 ippDelete(request);
190
191 _cupsSetError(IPP_NOT_POSSIBLE, strerror(EISDIR), 0);
192
193 return (NULL);
194 }
195
196 #ifndef WIN32
197 if (!S_ISREG(fileinfo.st_mode))
198 length = 0; /* Chunk when piping */
199 else
200 #endif /* !WIN32 */
201 length = ippLength(request) + fileinfo.st_size;
202 }
203 else
204 length = ippLength(request);
205
206 /*
207 * Loop until we can send the request without authorization problems.
208 */
209
210 while (response == NULL)
211 {
212 DEBUG_puts("cupsDoFileRequest: setup...");
213
214 /*
215 * Send the request...
216 */
217
218 status = cupsSendRequest(http, request, resource, length);
219
220 DEBUG_printf(("cupsDoFileRequest: status=%d\n", status));
221
222 if (status == HTTP_CONTINUE && request->state == IPP_DATA && infile >= 0)
223 {
224 DEBUG_puts("cupsDoFileRequest: file write...");
225
226 /*
227 * Send the file with the request...
228 */
229
230 #ifndef WIN32
231 if (S_ISREG(fileinfo.st_mode))
232 #endif /* WIN32 */
233 lseek(infile, 0, SEEK_SET);
234
235 while ((bytes = (int)read(infile, buffer, sizeof(buffer))) > 0)
236 {
237 if (httpCheck(http))
238 {
239 if ((status = httpUpdate(http)) != HTTP_CONTINUE)
240 break;
241 }
242
243 if (httpWrite2(http, buffer, bytes) < bytes)
244 break;
245 }
246 }
247
248 /*
249 * Get the server's response...
250 */
251
252 if (status == HTTP_CONTINUE || status == HTTP_OK)
253 {
254 response = cupsGetResponse(http, resource);
255 status = http->status;
256 }
257
258 if (status == HTTP_FORBIDDEN || status == HTTP_ERROR ||
259 status == HTTP_SERVICE_UNAVAILABLE)
260 {
261 _cupsSetHTTPError(status);
262 break;
263 }
264
265 if (response)
266 {
267 if (outfile >= 0)
268 {
269 /*
270 * Write trailing data to file...
271 */
272
273 while ((bytes = (int)httpRead2(http, buffer, sizeof(buffer))) > 0)
274 if (write(outfile, buffer, bytes) < bytes)
275 break;
276 }
277 else
278 {
279 /*
280 * Flush any remaining data...
281 */
282
283 httpFlush(http);
284 }
285 }
286 }
287
288 /*
289 * Delete the original request and return the response...
290 */
291
292 ippDelete(request);
293
294 return (response);
295 }
296
297
298 /*
299 * 'cupsDoRequest()' - Do an IPP request.
300 *
301 * This function sends the IPP request to the specified server, retrying
302 * and authenticating as necessary. The request is freed with ippDelete()
303 * after receiving a valid IPP response.
304 */
305
306 ipp_t * /* O - Response data */
307 cupsDoRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
308 ipp_t *request, /* I - IPP request */
309 const char *resource) /* I - HTTP resource for POST */
310 {
311 DEBUG_printf(("cupsDoRequest(http=%p, request=%p(%s), resource=\"%s\")\n",
312 http, request,
313 request ? ippOpString(request->request.op.operation_id) : "?",
314 resource ? resource : "(null)"));
315
316 return (cupsDoFileRequest(http, request, resource, NULL));
317 }
318
319
320 /*
321 * 'cupsGetResponse()' - Get a response to an IPP request.
322 *
323 * Use this function to get the response for an IPP request sent using
324 * cupsSendDocument() or cupsSendRequest(). For requests that return
325 * additional data, use httpRead() after getting a successful response.
326 *
327 * @since CUPS 1.4@
328 */
329
330 ipp_t * /* O - Response or @code NULL@ on HTTP error */
331 cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
332 const char *resource) /* I - HTTP resource for POST */
333 {
334 http_status_t status; /* HTTP status */
335 ipp_state_t state; /* IPP read state */
336 ipp_t *response = NULL; /* IPP response */
337
338
339 DEBUG_printf(("cupsGetReponse(http=%p, resource=\"%s\")\n", http,
340 resource ? resource : "(null)"));
341
342 /*
343 * Connect to the default server as needed...
344 */
345
346 if (!http)
347 http = _cupsConnect();
348
349 if (!http || (http->state != HTTP_POST_RECV && http->state != HTTP_POST_SEND))
350 return (NULL);
351
352 /*
353 * Check for an unfinished chunked request...
354 */
355
356 if (http->data_encoding == HTTP_ENCODE_CHUNKED)
357 {
358 /*
359 * Send a 0-length chunk to finish off the request...
360 */
361
362 DEBUG_puts("cupsGetResponse: Finishing chunked POST...");
363
364 if (httpWrite2(http, "", 0) < 0)
365 return (NULL);
366 }
367
368 /*
369 * Wait for a response from the server...
370 */
371
372 DEBUG_printf(("cupsGetResponse: Update loop, http->status=%d...\n",
373 http->status));
374
375 status = http->status;
376 while (status == HTTP_CONTINUE)
377 status = httpUpdate(http);
378
379 DEBUG_printf(("cupsGetResponse: status=%d\n", status));
380
381 if (status == HTTP_OK)
382 {
383 /*
384 * Get the IPP response...
385 */
386
387 response = ippNew();
388
389 while ((state = ippRead(http, response)) != IPP_DATA)
390 if (state == IPP_ERROR)
391 break;
392
393 if (state == IPP_ERROR)
394 {
395 /*
396 * Delete the response...
397 */
398
399 DEBUG_puts("cupsGetResponse: IPP read error!");
400
401 ippDelete(response);
402 response = NULL;
403
404 _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
405 }
406 }
407 else if (status != HTTP_ERROR)
408 {
409 /*
410 * Flush any error message...
411 */
412
413 httpFlush(http);
414
415 /*
416 * Then handle encryption and authentication...
417 */
418
419 if (status == HTTP_UNAUTHORIZED)
420 {
421 /*
422 * See if we can do authentication...
423 */
424
425 int auth_result;
426
427 DEBUG_puts("cupsGetResponse: Need authorization...");
428
429 if ((auth_result = cupsDoAuthentication(http, "POST", resource)) == 0)
430 httpReconnect(http);
431 else if (auth_result < 0)
432 http->status = status = HTTP_FORBIDDEN;
433 }
434
435 #ifdef HAVE_SSL
436 else if (status == HTTP_UPGRADE_REQUIRED)
437 {
438 /*
439 * Force a reconnect with encryption...
440 */
441
442 DEBUG_puts("cupsGetResponse: Need encryption...");
443
444 if (!httpReconnect(http))
445 httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
446 }
447 #endif /* HAVE_SSL */
448 }
449
450 if (response)
451 {
452 ipp_attribute_t *attr; /* status-message attribute */
453
454
455 attr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT);
456
457 DEBUG_printf(("cupsGetResponse: status-code=%s, status-message=\"%s\"\n",
458 ippErrorString(response->request.status.status_code),
459 attr ? attr->values[0].string.text : ""));
460
461 _cupsSetError(response->request.status.status_code,
462 attr ? attr->values[0].string.text :
463 ippErrorString(response->request.status.status_code), 0);
464 }
465 else if (status != HTTP_OK)
466 _cupsSetHTTPError(status);
467
468 return (response);
469 }
470
471
472 /*
473 * 'cupsReadResponseData()' - Read additional data after the IPP response.
474 *
475 * This function is used after cupsGetResponse() to read the PPD or document
476 * files for CUPS_GET_PPD and CUPS_GET_DOCUMENT requests, respectively.
477 *
478 * @since CUPS 1.4@
479 */
480
481 ssize_t /* O - Bytes read, 0 on EOF, -1 on error */
482 cupsReadResponseData(
483 http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
484 char *buffer, /* I - Buffer to use */
485 size_t length) /* I - Number of bytes to read */
486 {
487 /*
488 * Get the default connection as needed...
489 */
490
491 DEBUG_printf(("cupsReadResponseData(http=%p, buffer=%p, "
492 "length=" CUPS_LLFMT ")\n", http, buffer, CUPS_LLCAST length));
493
494 if (!http)
495 {
496 _cups_globals_t *cg = _cupsGlobals();
497 /* Pointer to library globals */
498
499 if ((http = cg->http) == NULL)
500 {
501 _cupsSetError(IPP_INTERNAL_ERROR, _("No active connection"), 1);
502 return (-1);
503 }
504 }
505
506 /*
507 * Then read from the HTTP connection...
508 */
509
510 return (httpRead2(http, buffer, length));
511 }
512
513
514 /*
515 * 'cupsSendRequest()' - Send an IPP request.
516 *
517 * Use httpWrite() to write any additional data (document, PPD file, etc.)
518 * for the request, cupsGetResponse() to get the IPP response, and httpRead()
519 * to read any additional data following the response. Only one request can be
520 * sent/queued at a time.
521 *
522 * Unlike cupsDoFileRequest(), cupsDoIORequest(), and cupsDoRequest(), the
523 * request is not freed.
524 *
525 * @since CUPS 1.4@
526 */
527
528 http_status_t /* O - Initial HTTP status */
529 cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
530 ipp_t *request, /* I - IPP request */
531 const char *resource, /* I - Resource path */
532 size_t length) /* I - Length of data to follow or @code CUPS_LENGTH_VARIABLE@ */
533 {
534 http_status_t status; /* Status of HTTP request */
535 int got_status; /* Did we get the status? */
536 ipp_state_t state; /* State of IPP processing */
537 http_status_t expect; /* Expect: header to use */
538
539
540 DEBUG_printf(("cupsSendRequest(http=%p, request=%p(%s), resource=\"%s\", "
541 "length=" CUPS_LLFMT ")\n", http, request,
542 request ? ippOpString(request->request.op.operation_id) : "?",
543 resource ? resource : "(null)", CUPS_LLCAST length));
544
545 /*
546 * Range check input...
547 */
548
549 if (!request || !resource)
550 {
551 _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
552
553 return (HTTP_ERROR);
554 }
555
556 /*
557 * Get the default connection as needed...
558 */
559
560 if (!http)
561 if ((http = _cupsConnect()) == NULL)
562 return (HTTP_SERVICE_UNAVAILABLE);
563
564 #ifdef HAVE_SSL
565 /*
566 * See if we have an auth-info attribute and are communicating over
567 * a non-local link. If so, encrypt the link so that we can pass
568 * the authentication information securely...
569 */
570
571 if (ippFindAttribute(request, "auth-info", IPP_TAG_TEXT) &&
572 !httpAddrLocalhost(http->hostaddr) && !http->tls &&
573 httpEncryption(http, HTTP_ENCRYPT_REQUIRED))
574 return (HTTP_SERVICE_UNAVAILABLE);
575 #endif /* HAVE_SSL */
576
577 /*
578 * Reconnect if the last response had a "Connection: close"...
579 */
580
581 if (!strcasecmp(http->fields[HTTP_FIELD_CONNECTION], "close"))
582 if (httpReconnect(http))
583 return (HTTP_SERVICE_UNAVAILABLE);
584
585 /*
586 * Loop until we can send the request without authorization problems.
587 */
588
589 expect = HTTP_CONTINUE;
590
591 for (;;)
592 {
593 DEBUG_puts("cupsSendRequest: Setup...");
594
595 /*
596 * Setup the HTTP variables needed...
597 */
598
599 httpClearFields(http);
600 httpSetLength(http, length);
601 httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
602 httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
603 httpSetExpect(http, expect);
604
605 DEBUG_printf(("cupsSendRequest: authstring=\"%s\"\n", http->authstring));
606
607 /*
608 * Try the request...
609 */
610
611 DEBUG_puts("cupsSendRequest: Sending HTTP POST...");
612
613 if (httpPost(http, resource))
614 {
615 if (httpReconnect(http))
616 return (HTTP_SERVICE_UNAVAILABLE);
617 else
618 continue;
619 }
620
621 /*
622 * Send the IPP data...
623 */
624
625 DEBUG_puts("cupsSendRequest: Writing IPP request...");
626
627 request->state = IPP_IDLE;
628 status = HTTP_CONTINUE;
629 got_status = 0;
630
631 while ((state = ippWrite(http, request)) != IPP_DATA)
632 if (state == IPP_ERROR)
633 break;
634 else if (httpCheck(http))
635 {
636 got_status = 1;
637
638 if ((status = httpUpdate(http)) != HTTP_CONTINUE)
639 break;
640 }
641
642 /*
643 * Wait up to 1 second to get the 100-continue response as needed...
644 */
645
646 if (!got_status && expect == HTTP_CONTINUE)
647 {
648 DEBUG_puts("cupsSendRequest: Waiting for 100-continue...");
649
650 if (httpWait(http, 1000))
651 status = httpUpdate(http);
652 else
653 status = HTTP_EXPECTATION_FAILED;
654 }
655 else if (httpCheck(http))
656 status = httpUpdate(http);
657
658 DEBUG_printf(("cupsSendRequest: status=%d\n", status));
659
660 /*
661 * Process the current HTTP status...
662 */
663
664 switch (status)
665 {
666 case HTTP_ERROR :
667 case HTTP_CONTINUE :
668 case HTTP_OK :
669 return (status);
670
671 case HTTP_UNAUTHORIZED :
672 if (!cupsDoAuthentication(http, "POST", resource))
673 if (httpReconnect(http))
674 return (HTTP_ERROR);
675
676 return (status);
677
678 #ifdef HAVE_SSL
679 case HTTP_UPGRADE_REQUIRED :
680 /*
681 * Flush any error message, reconnect, and then upgrade with
682 * encryption...
683 */
684
685 if (httpReconnect(http))
686 return (HTTP_ERROR);
687
688 httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
689
690 return (status);
691 #endif /* HAVE_SSL */
692
693 case HTTP_EXPECTATION_FAILED :
694 /*
695 * Don't try using the Expect: header the next time around...
696 */
697
698 expect = (http_status_t)0;
699 break;
700
701 default :
702 /*
703 * Some other error...
704 */
705
706 return (status);
707 }
708 }
709 }
710
711
712 /*
713 * 'cupsWriteRequestData()' - Write additional data after an IPP request.
714 *
715 * This function is used after @link cupsSendRequest@ to provide a PPD and
716 * after @link cupsStartDocument@ to provide a document file.
717 *
718 * @since CUPS 1.4@
719 */
720
721 http_status_t /* O - @code HTTP_CONTINUE@ if OK or HTTP status on error */
722 cupsWriteRequestData(
723 http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
724 const char *buffer, /* I - Bytes to write */
725 size_t length) /* I - Number of bytes to write */
726 {
727 /*
728 * Get the default connection as needed...
729 */
730
731 DEBUG_printf(("cupsWriteRequestData(http=%p, buffer=%p, "
732 "length=" CUPS_LLFMT ")\n", http, buffer, CUPS_LLCAST length));
733
734 if (!http)
735 {
736 _cups_globals_t *cg = _cupsGlobals();
737 /* Pointer to library globals */
738
739 if ((http = cg->http) == NULL)
740 {
741 _cupsSetError(IPP_INTERNAL_ERROR, _("No active connection"), 1);
742 return (HTTP_ERROR);
743 }
744 }
745
746 /*
747 * Then write to the HTTP connection...
748 */
749
750 if (httpWrite2(http, buffer, length) < 0)
751 return (HTTP_ERROR);
752
753 /*
754 * Finally, check if we have any pending data from the server...
755 */
756
757 if (httpCheck(http))
758 return (httpUpdate(http));
759 else
760 return (HTTP_CONTINUE);
761 }
762
763
764 /*
765 * '_cupsSetError()' - Set the last IPP status code and status-message.
766 */
767
768 void
769 _cupsSetError(ipp_status_t status, /* I - IPP status code */
770 const char *message, /* I - status-message value */
771 int localize) /* I - Localize the message? */
772 {
773 _cups_globals_t *cg; /* Global data */
774
775
776 if (!message && errno)
777 {
778 message = strerror(errno);
779 localize = 0;
780 }
781
782 cg = _cupsGlobals();
783 cg->last_error = status;
784
785 if (cg->last_status_message)
786 {
787 _cupsStrFree(cg->last_status_message);
788
789 cg->last_status_message = NULL;
790 }
791
792 if (message)
793 {
794 if (localize)
795 {
796 /*
797 * Get the message catalog...
798 */
799
800 if (!cg->lang_default)
801 cg->lang_default = cupsLangDefault();
802
803 cg->last_status_message = _cupsStrAlloc(_cupsLangString(cg->lang_default,
804 message));
805 }
806 else
807 cg->last_status_message = _cupsStrAlloc(message);
808 }
809
810 DEBUG_printf(("_cupsSetError: last_error=%s, last_status_message=\"%s\"\n",
811 ippErrorString(cg->last_error),
812 cg->last_status_message ? cg->last_status_message : ""));
813 }
814
815
816 /*
817 * '_cupsSetHTTPError()' - Set the last error using the HTTP status.
818 */
819
820 void
821 _cupsSetHTTPError(http_status_t status) /* I - HTTP status code */
822 {
823 switch (status)
824 {
825 case HTTP_NOT_FOUND :
826 _cupsSetError(IPP_NOT_FOUND, httpStatus(status), 0);
827 break;
828
829 case HTTP_UNAUTHORIZED :
830 _cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status), 0);
831 break;
832
833 case HTTP_FORBIDDEN :
834 _cupsSetError(IPP_FORBIDDEN, httpStatus(status), 0);
835 break;
836
837 case HTTP_BAD_REQUEST :
838 _cupsSetError(IPP_BAD_REQUEST, httpStatus(status), 0);
839 break;
840
841 case HTTP_REQUEST_TOO_LARGE :
842 _cupsSetError(IPP_REQUEST_VALUE, httpStatus(status), 0);
843 break;
844
845 case HTTP_NOT_IMPLEMENTED :
846 _cupsSetError(IPP_OPERATION_NOT_SUPPORTED, httpStatus(status), 0);
847 break;
848
849 case HTTP_NOT_SUPPORTED :
850 _cupsSetError(IPP_VERSION_NOT_SUPPORTED, httpStatus(status), 0);
851 break;
852
853 default :
854 DEBUG_printf(("HTTP error %d mapped to IPP_SERVICE_UNAVAILABLE!\n",
855 status));
856 _cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status), 0);
857 break;
858 }
859 }
860
861
862 /*
863 * End of "$Id: request.c 7460 2008-04-16 02:19:54Z mike $".
864 */