]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/http-support.c
Merge changes from CUPS 1.4svn-r7394.
[thirdparty/cups.git] / cups / http-support.c
index be6cfbe844f3539c523b45c23f83445937ff1d1b..a8d58b0bec6d1ff7b6f062485b8b1190c17a601e 100644 (file)
@@ -36,6 +36,7 @@
  *   httpStatus()         - Return a short string describing a HTTP status code.
  *   _cups_hstrerror()    - hstrerror() emulation function for Solaris and
  *                          others...
+ *   _httpEncodeURI()     - Percent-encode a HTTP request URI.
  *   http_copy_decode()   - Copy and decode a URI.
  *   http_copy_encode()   - Copy and encode a URI.
  */
@@ -1203,6 +1204,20 @@ _cups_hstrerror(int error)               /* I - Error number */
 #endif /* !HAVE_HSTRERROR */
 
 
+/*
+ * '_httpEncodeURI()' - Percent-encode a HTTP request URI.
+ */
+
+char *                                 /* O - Encoded URI */
+_httpEncodeURI(char       *dst,                /* I - Destination buffer */
+               const char *src,                /* I - Source URI */
+              size_t     dstsize)      /* I - Size of destination buffer */
+{
+  http_copy_encode(dst, src, dst + dstsize - 1, NULL, NULL, 1);
+  return (dst);
+}
+
+
 /*
  * 'http_copy_decode()' - Copy and decode a URI.
  */
@@ -1311,6 +1326,8 @@ http_copy_encode(char       *dst, /* O - Destination buffer */
       *dst++ = *src++;
   }
 
+  *dst = '\0';
+
   if (*src)
     return (NULL);
   else