]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/http.c
Merge changes from CUPS 1.4svn-r7394.
[thirdparty/cups.git] / cups / http.c
index 2faa1262e2af462804a19dfda363ef7c38ad5f91..e48c174c61f2dee86aa292323d1a36c32815b5d6 100644 (file)
@@ -2527,8 +2527,7 @@ http_send(http_t       *http,     /* I - Connection to server */
          const char   *uri)    /* I - URI */
 {
   int          i;              /* Looping var */
-  char         *ptr,           /* Pointer in buffer */
-               buf[1024];      /* Encoded URI buffer */
+  char         buf[1024];      /* Encoded URI buffer */
   static const char * const codes[] =
                {               /* Request code strings */
                  NULL,
@@ -2545,8 +2544,6 @@ http_send(http_t       *http,     /* I - Connection to server */
                  "TRACE",
                  "CLOSE"
                };
-  static const char hex[] = "0123456789ABCDEF";
-                               /* Hex digits */
 
 
   DEBUG_printf(("http_send(http=%p, request=HTTP_%s, uri=\"%s\")\n",
@@ -2566,20 +2563,7 @@ http_send(http_t       *http,    /* I - Connection to server */
   * Encode the URI as needed...
   */
 
-  for (ptr = buf; *uri != '\0' && ptr < (buf + sizeof(buf) - 1); uri ++)
-    if (*uri <= ' ' || *uri >= 127)
-    {
-      if (ptr < (buf + sizeof(buf) - 1))
-        *ptr ++ = '%';
-      if (ptr < (buf + sizeof(buf) - 1))
-        *ptr ++ = hex[(*uri >> 4) & 15];
-      if (ptr < (buf + sizeof(buf) - 1))
-        *ptr ++ = hex[*uri & 15];
-    }
-    else
-      *ptr ++ = *uri;
-
-  *ptr = '\0';
+  _httpEncodeURI(buf, uri, sizeof(buf));
 
  /*
   * See if we had an error the last time around; if so, reconnect...