]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/http-support.c
Merge changes from CUPS 1.5svn-r9641
[thirdparty/cups.git] / cups / http-support.c
index 452a946f3adf51683f536b8ee79ce95ebeb4009b..1d73f7d4887e8767cbfbb71ff56508a103a682aa 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   HTTP support routines for CUPS.
  *
- *   Copyright 2007-2010 by Apple Inc.
+ *   Copyright 2007-2011 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -36,6 +36,7 @@
  *   httpStatus()         - Return a short string describing a HTTP status code.
  *   _cups_hstrerror()    - hstrerror() emulation function for Solaris and
  *                          others...
+ *   _httpDecodeURI()     - Percent-decode a HTTP request URI.
  *   _httpEncodeURI()     - Percent-encode a HTTP request URI.
  *   _httpResolveURI()    - Resolve a DNS-SD URI.
  *   http_copy_decode()   - Copy and decode a URI.
@@ -1252,6 +1253,9 @@ httpStatus(http_status_t status)  /* I - HTTP status code */
     case HTTP_PKI_ERROR :
         s = _("SSL/TLS Negotiation Error");
        break;
+    case HTTP_WEBIF_DISABLED :
+        s = _("Web Interface is Disabled");
+       break;
 
     default :
         s = _("Unknown");
@@ -1288,6 +1292,22 @@ _cups_hstrerror(int error)               /* I - Error number */
 #endif /* !HAVE_HSTRERROR */
 
 
+/*
+ * '_httpDecodeURI()' - Percent-decode a HTTP request URI.
+ */
+
+char *                                 /* O - Decoded URI or NULL on error */
+_httpDecodeURI(char       *dst,                /* I - Destination buffer */
+               const char *src,                /* I - Source URI */
+              size_t     dstsize)      /* I - Size of destination buffer */
+{
+  if (http_copy_decode(dst, src, (int)dstsize, NULL, 1))
+    return (dst);
+  else
+    return (NULL);
+}
+
+
 /*
  * '_httpEncodeURI()' - Percent-encode a HTTP request URI.
  */
@@ -1344,7 +1364,7 @@ _httpResolveURI(
 #endif /* DEBUG */
   {
     if (logit)
-      _cupsLangPrintf(stderr, _("Bad device URI \"%s\"\n"), uri);
+      _cupsLangPrintFilter(stderr, "ERROR", _("Bad device-uri \"%s\"."), uri);
 
     DEBUG_printf(("6_httpResolveURI: httpSeparateURI returned %d!", status));
     DEBUG_puts("5_httpResolveURI: Returning NULL");
@@ -1441,7 +1461,7 @@ _httpResolveURI(
        for (;;)
        {
          if (logit)
-           _cupsLangPuts(stderr, _("INFO: Looking for printer...\n"));
+           _cupsLangPrintFilter(stderr, "INFO", _("Looking for printer."));
 
         /*
          * For the first minute, wakeup every 2 seconds to emit a
@@ -1545,7 +1565,7 @@ _httpResolveURI(
 #endif /* HAVE_DNSSD */
 
     if (logit && !uri)
-      _cupsLangPuts(stderr, _("Unable to find printer\n"));
+      _cupsLangPrintFilter(stderr, "ERROR", _("Unable to find printer."));
   }
 
   DEBUG_printf(("5_httpResolveURI: Returning \"%s\"", uri));