Commit f8d88335 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

the new escape/unescape function setup

parent c23df41d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -475,6 +475,11 @@ char *curl_getenv(char *variable);
/* Returns a static ascii string of the libcurl version. */
char *curl_version(void);

/* Escape and unescape URL encoding in strings. The functions return a new
 * allocated string or NULL if an error occurred.  */
char *curl_escape(char *string, int length);
char *curl_unescape(char *string, int length);

/* This is the version number */
#define LIBCURL_VERSION "7.7-beta5"
#define LIBCURL_VERSION_NUM 0x070700
+60 −60
Original line number Diff line number Diff line
@@ -36,15 +36,15 @@
#include "memdebug.h"
#endif

char *curl_escape(char *string)
char *curl_escape(char *string, int length)
{
   int alloc=strlen(string)+1;
  int alloc = (length?length:strlen(string))+1;  
  char *ns = malloc(alloc);
  unsigned char in;
  int newlen = alloc;
  int index=0;

   while(*string) {
  while(length--) {
    in = *string;
    if(' ' == in)
      ns[index++] = '+';
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@
/* Escape and unescape URL encoding in strings. The functions return a new
 * allocated string or NULL if an error occurred.  */

char *curl_escape(char *string);
char *curl_escape(char *string, int length);
char *curl_unescape(char *string, int length);

#endif