#include <XrdOucUri.hh>
|
static int | Decode (const char *src, int len, char *dst) |
|
static int | Encode (const char *src, int len, char **dst) |
|
static int | Encode (const char *src, int len, char *dst) |
|
static int | Encoded (const char *src, int len) |
|
Definition at line 44 of file XrdOucUri.hh.
◆ XrdOucUri()
◆ ~XrdOucUri()
XrdOucUri::~XrdOucUri |
( |
| ) |
|
|
inline |
◆ Decode()
int XrdOucUri::Decode |
( |
const char * |
src, |
|
|
int |
len, |
|
|
char * |
dst |
|
) |
| |
|
static |
Decode a url encoded string
- Parameters
-
src | Pointer to the source string to decode |
len | The length of src (i.e. strlen(src)). |
dst | Pointer to the buffer where to put the result. The buffer should be at least as long as the src, including null byte. |
- Returns
- The index of the null byte (i.e. end of string) in dst.
Definition at line 116 of file XrdOucUri.cc.
119 unsigned char v1, v2;
124 {
if(src[i] ==
'%' && i + 2 < len)
125 {v1 = hexval[ (
unsigned char)src[i+1] ];
126 v2 = hexval[ (
unsigned char)src[i+2] ];
129 if ((v1 | v2) == 0xFF) dst[j++] = src[i++];
130 else {dst[j++] = (v1 << 4) | v2;
133 }
else dst[j++] = src[i++];
◆ Encode() [1/2]
int XrdOucUri::Encode |
( |
const char * |
src, |
|
|
int |
len, |
|
|
char ** |
dst |
|
) |
| |
|
static |
Encode an ASCII text string
- Parameters
-
src | Pointer to the source string to encode |
len | The length of src (i.e. strlen(src)). |
dst | Pointer to where the allocated buffer pointer should be placed. This buffer holds the result and must be released using free() when no longer needed. |
- Returns
- The index of the null byte (i.e. end of string) in dst.
Definition at line 146 of file XrdOucUri.cc.
155 if (!(*dst = (
char *)malloc(n)))
return 0;
159 return Encode(src, len, *dst);
static int Encode(const char *src, int len, char **dst)
static int Encoded(const char *src, int len)
References Encoded().
◆ Encode() [2/2]
int XrdOucUri::Encode |
( |
const char * |
src, |
|
|
int |
len, |
|
|
char * |
dst |
|
) |
| |
|
static |
Encode an ASCII text string
- Parameters
-
src | Pointer to the source string to encode |
len | The length of src (i.e. strlen(src)). |
dst | Pointer to the buffer where to put the result. The buffer should be long enough to hold the result. Use the Encoded() method to determine how many bytes will be needed. |
- Returns
- The index of the null byte (i.e. end of string) in dst.
Definition at line 164 of file XrdOucUri.cc.
166 const unsigned char *code;
171 for(
int i = 0; i < len; i++)
172 {code = &uri_encode_tbl[((
unsigned int)((
unsigned char)src[i])) << 1];
175 memcpy(&dst[j], code, 2);
177 }
else dst[j++] = src[i];
◆ Encoded()
int XrdOucUri::Encoded |
( |
const char * |
src, |
|
|
int |
len |
|
) |
| |
|
static |
Calculate the number of bytes an encoded string will occupy.
- Parameters
-
src | Pointer to the source string to encode |
len | The length of src (i.e. strlen(src)). |
- Returns
- The number of bytes needed, including the ending null byte.
Definition at line 190 of file XrdOucUri.cc.
196 for(
int i = 0; i < len; i++)
197 {totlen += (uri_encode_tbl[((
unsigned int)src[i]) << 1] ? 3 : 1);}
Referenced by Encode().
The documentation for this class was generated from the following files: