]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/request.c
Merge changes from CUPS trunk, r6739.
[thirdparty/cups.git] / cups / request.c
index 5603679018ace05239c94f7a140d4880a275036f..cee2436873f8437d1bf17002f92c2409b77bfcd9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: request.c 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id: request.c 6712 2007-07-24 00:13:05Z mike $"
  *
  *   IPP utilities for the Common UNIX Printing System (CUPS).
  *
@@ -19,6 +19,7 @@
  *   cupsDoFileRequest() - Do an IPP request with a file.
  *   cupsDoRequest()     - Do an IPP request.
  *   _cupsSetError()     - Set the last IPP status code and status-message.
+ *   _cupsSetHTTPError() - Set the last error using the HTTP status.
  */
 
 /*
@@ -455,44 +456,7 @@ cupsDoIORequest(http_t     *http,  /* I - HTTP connection to server */
                       ippErrorString(response->request.status.status_code));
   }
   else if (status != HTTP_OK)
-  {
-    switch (status)
-    {
-      case HTTP_NOT_FOUND :
-          _cupsSetError(IPP_NOT_FOUND, httpStatus(status));
-         break;
-
-      case HTTP_UNAUTHORIZED :
-          _cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status));
-         break;
-
-      case HTTP_FORBIDDEN :
-          _cupsSetError(IPP_FORBIDDEN, httpStatus(status));
-         break;
-
-      case HTTP_BAD_REQUEST :
-          _cupsSetError(IPP_BAD_REQUEST, httpStatus(status));
-         break;
-
-      case HTTP_REQUEST_TOO_LARGE :
-          _cupsSetError(IPP_REQUEST_VALUE, httpStatus(status));
-         break;
-
-      case HTTP_NOT_IMPLEMENTED :
-          _cupsSetError(IPP_OPERATION_NOT_SUPPORTED, httpStatus(status));
-         break;
-
-      case HTTP_NOT_SUPPORTED :
-          _cupsSetError(IPP_VERSION_NOT_SUPPORTED, httpStatus(status));
-         break;
-
-      default :
-         DEBUG_printf(("HTTP error %d mapped to IPP_SERVICE_UNAVAILABLE!\n",
-                       status));
-         _cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status));
-         break;
-    }
-  }
+    _cupsSetHTTPError(status);
 
   return (response);
 }
@@ -542,5 +506,51 @@ _cupsSetError(ipp_status_t status, /* I - IPP status code */
 
 
 /*
- * End of "$Id: request.c 6649 2007-07-11 21:46:42Z mike $".
+ * '_cupsSetHTTPError()' - Set the last error using the HTTP status.
+ */
+
+void
+_cupsSetHTTPError(http_status_t status)        /* I - HTTP status code */
+{
+  switch (status)
+  {
+    case HTTP_NOT_FOUND :
+       _cupsSetError(IPP_NOT_FOUND, httpStatus(status));
+       break;
+
+    case HTTP_UNAUTHORIZED :
+       _cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status));
+       break;
+
+    case HTTP_FORBIDDEN :
+       _cupsSetError(IPP_FORBIDDEN, httpStatus(status));
+       break;
+
+    case HTTP_BAD_REQUEST :
+       _cupsSetError(IPP_BAD_REQUEST, httpStatus(status));
+       break;
+
+    case HTTP_REQUEST_TOO_LARGE :
+       _cupsSetError(IPP_REQUEST_VALUE, httpStatus(status));
+       break;
+
+    case HTTP_NOT_IMPLEMENTED :
+       _cupsSetError(IPP_OPERATION_NOT_SUPPORTED, httpStatus(status));
+       break;
+
+    case HTTP_NOT_SUPPORTED :
+       _cupsSetError(IPP_VERSION_NOT_SUPPORTED, httpStatus(status));
+       break;
+
+    default :
+       DEBUG_printf(("HTTP error %d mapped to IPP_SERVICE_UNAVAILABLE!\n",
+                     status));
+       _cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status));
+       break;
+  }
+}
+
+
+/*
+ * End of "$Id: request.c 6712 2007-07-24 00:13:05Z mike $".
  */