Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

urlmatch.h File Reference

Declares functions to match URLs against URL patterns. More...

Go to the source code of this file.

Defines

#define URLMATCH_H_VERSION   "$Id: urlmatch.h,v 2.0 2002/06/04 14:34:21 jongfoster Exp $"

Functions

void free_http_request (struct http_request *http)
jb_err parse_http_request (const char *req, struct http_request *http, struct client_state *csp)
jb_err parse_http_url (const char *url, struct http_request *http, struct client_state *csp)
int url_match (const struct url_spec *pattern, const struct http_request *url)
jb_err create_url_spec (struct url_spec *url, const char *buf)
void free_url_spec (struct url_spec *url)

Variables

const char urlmatch_rcs []
const char urlmatch_h_rcs []


Detailed Description

Declares functions to match URLs against URL patterns.

Log:
urlmatch.h,v
Revision 2.0 2002/06/04 14:34:21 jongfoster Moving source files to src/

Revision 1.3 2002/03/26 22:29:55 swa we have a new homepage!

Revision 1.2 2002/03/24 13:25:43 swa name change related issues

Revision 1.1 2002/01/17 20:53:46 jongfoster Moving all our URL and URL pattern parsing code to the same file - it was scattered around in filters.c, loaders.c and parsers.c.

Providing a single, simple url_match(pattern,url) function - rather than the 3-line match routine which was repeated all over the place.

Renaming free_url to free_url_spec, since it frees a struct url_spec.

Providing parse_http_url() so that URLs can be parsed without faking a HTTP request line for parse_http_request() or repeating the parsing code (both of which were techniques that were actually in use).

Standardizing that struct http_request is used to represent a URL, and struct url_spec is used to represent a URL pattern. (Before, URLs were represented as seperate variables and a partially-filled-in url_spec).


Function Documentation

jb_err create_url_spec struct url_spec   url,
const char *    buf
 

Creates a "url_spec" structure from a string.

When finished, free with unload_url().

Parameters:
url  Target url_spec to be filled in. Will be zeroed before use.
buf  Source pattern, null terminated. NOTE: The contents of this buffer are destroyed by this function. If this function succeeds, the buffer is copied to url->spec. If this function fails, the contents of the buffer are lost forever.
Returns:
JB_ERR_OK - Success JB_ERR_MEMORY - Out of memory JB_ERR_PARSE - Cannot parse regex (Detailed message written to system log)

void free_http_request struct http_request   http
 

Freez a http_request structure.

Parameters:
http  points to a http_request structure to free
Returns:
N/A

void free_url_spec struct url_spec   url
 

Called from the "unloaders".

Freez the url structure elements.

Parameters:
url  pointer to a url_spec structure.
Returns:
N/A

jb_err parse_http_request const char *    req,
struct http_request   http,
struct client_state   csp
 

Parse out the host and port from the URL.

Find the hostname & path, port (if ':'), and/or password (if '@')

Parameters:
req  HTTP request line to break down
http  pointer to the http structure to hold elements
csp  Current client state (buffers, headers, etc...)
Returns:
JB_ERR_OK on success JB_ERR_MEMORY on out of memory JB_ERR_CGI_PARAMS on malformed command/URL or >100 domains deep.

jb_err parse_http_url const char *    url,
struct http_request   http,
struct client_state   csp
 

Parse out the host and port from the URL.

Find the hostname & path, port (if ':'), and/or password (if '@')

Parameters:
url  URL (or is it URI?) to break down
http  pointer to the http structure to hold elements. Will be zeroed before use. Note that this function sets the http->gpc and http->ver members to NULL.
csp  Current client state (buffers, headers, etc...)
Returns:
JB_ERR_OK on success JB_ERR_MEMORY on out of memory JB_ERR_CGI_PARAMS on malformed command/URL or >100 domains deep.

int url_match const struct url_spec   pattern,
const struct http_request   url
 

Compare a URL against a URL pattern.

Parameters:
pattern  a URL pattern
url  URL to match
Returns:
0 iff the URL matches the pattern, else nonzero.


Variable Documentation

const char urlmatch_h_rcs[]
 

Version information about urlmatch.h.

const char urlmatch_rcs[]
 

Version information about urlmatch.c.


Generated on Tue Jun 4 18:54:49 2002 for Privoxy 3.1.1 by doxygen1.2.15