mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
the new escape/unescape function setup
This commit is contained in:
parent
c23df41d83
commit
f8d883355d
@ -475,6 +475,11 @@ char *curl_getenv(char *variable);
|
|||||||
/* Returns a static ascii string of the libcurl version. */
|
/* Returns a static ascii string of the libcurl version. */
|
||||||
char *curl_version(void);
|
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 */
|
/* This is the version number */
|
||||||
#define LIBCURL_VERSION "7.7-beta5"
|
#define LIBCURL_VERSION "7.7-beta5"
|
||||||
#define LIBCURL_VERSION_NUM 0x070700
|
#define LIBCURL_VERSION_NUM 0x070700
|
||||||
|
@ -36,15 +36,15 @@
|
|||||||
#include "memdebug.h"
|
#include "memdebug.h"
|
||||||
#endif
|
#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);
|
char *ns = malloc(alloc);
|
||||||
unsigned char in;
|
unsigned char in;
|
||||||
int newlen = alloc;
|
int newlen = alloc;
|
||||||
int index=0;
|
int index=0;
|
||||||
|
|
||||||
while(*string) {
|
while(length--) {
|
||||||
in = *string;
|
in = *string;
|
||||||
if(' ' == in)
|
if(' ' == in)
|
||||||
ns[index++] = '+';
|
ns[index++] = '+';
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
/* Escape and unescape URL encoding in strings. The functions return a new
|
/* Escape and unescape URL encoding in strings. The functions return a new
|
||||||
* allocated string or NULL if an error occurred. */
|
* 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);
|
char *curl_unescape(char *string, int length);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user