Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

url.c File Reference

#include "url.h"
#include <ctype.h>

Functions

int32_t aw_parse_url (const byte_t *url, byte_t **protocol, byte_t **hostname, u_int32_t *port, byte_t **path, u_int32_t urlencode)
 Url is of form:
[<protocol>://]<host>:[<port>][/<path>]
where the optional params are not set if they are not in the URL, so you should set them to the appropriate defaults before calling. Protocol, hostname and path have strings malloc'd you need to free() later, port is assigned.

void aw_url_decode (byte_t *url)
 In place url decode.

int32_t aw_url_encode (byte_t *to, u_int32_t tosize, const byte_t *from)
 URL encode text string, the 'to' must be at least 3x the length of 'from'.


Function Documentation

int32_t aw_parse_url (  const byte_t *  url,
byte_t **  protocol,
byte_t **  hostname,
u_int32_t *  port,
byte_t **  path,
u_int32_t  urlencode
) 
 

Url is of form:

[<protocol>://]<host>:[<port>][/<path>]
where the optional params are not set if they are not in the URL, so you should set them to the appropriate defaults before calling. Protocol, hostname and path have strings malloc'd you need to free() later, port is assigned.

Url is of form:

[<protocol>://]<host>:[<port>][/<path>]
Return args are not touched if not found, you should init with appropriate defaults.

Returns 0 on success

void aw_url_decode (  byte_t *  url  ) 
 

In place url decode.

aw_url_decode

Parameters:
url The url to decode

int32_t aw_url_encode (  byte_t *  to,
u_int32_t  tosize,
const byte_t *  from
) 
 

URL encode text string, the 'to' must be at least 3x the length of 'from'.

aw_url_encode

Parameters:
to The destination string
tosize The size of to
from The source string
Returns:
0 on success, non-zero on failure (to string too small)

Aware 0.11.1 Copyright (C) 1998-2005 Russell Leighton (russ@elegant-software.com)