+ {
+ if (localize)
+ {
+ /*
+ * Get the message catalog...
+ */
+
+ if (!cg->lang_default)
+ cg->lang_default = cupsLangDefault();
+
+ cg->last_status_message = _cupsStrAlloc(_cupsLangString(cg->lang_default,
+ message));
+ }
+ else
+ cg->last_status_message = _cupsStrAlloc(message);
+ }
+
+ DEBUG_printf(("4_cupsSetError: last_error=%s, last_status_message=\"%s\"",
+ ippErrorString(cg->last_error), cg->last_status_message));
+}
+
+
+/*
+ * '_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), 0);
+ break;
+
+ case HTTP_UNAUTHORIZED :
+ case HTTP_AUTHORIZATION_CANCELED :
+ _cupsSetError(IPP_NOT_AUTHORIZED, httpStatus(status), 0);
+ break;
+
+ case HTTP_FORBIDDEN :
+ _cupsSetError(IPP_FORBIDDEN, httpStatus(status), 0);
+ break;
+
+ case HTTP_BAD_REQUEST :
+ _cupsSetError(IPP_BAD_REQUEST, httpStatus(status), 0);
+ break;
+
+ case HTTP_REQUEST_TOO_LARGE :
+ _cupsSetError(IPP_REQUEST_VALUE, httpStatus(status), 0);
+ break;
+
+ case HTTP_NOT_IMPLEMENTED :
+ _cupsSetError(IPP_OPERATION_NOT_SUPPORTED, httpStatus(status), 0);
+ break;
+
+ case HTTP_NOT_SUPPORTED :
+ _cupsSetError(IPP_VERSION_NOT_SUPPORTED, httpStatus(status), 0);
+ break;
+
+ default :
+ DEBUG_printf(("4_cupsSetHTTPError: HTTP error %d mapped to "
+ "IPP_SERVICE_UNAVAILABLE!", status));
+ _cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status), 0);
+ break;
+ }