rfc1738.c File Reference
#include "squid.h"
#include "rfc1738.h"
Include dependency graph for rfc1738.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

char * rfc1738_do_escape (const char *url, int flags)
 
static int fromhex (char ch)
 
void rfc1738_unescape (char *s)
 

Variables

static char rfc1738_unsafe_chars []
 
static char rfc1738_reserved_chars []
 

Function Documentation

◆ fromhex()

static int fromhex ( char  ch)
static

Definition at line 130 of file rfc1738.c.

Referenced by rfc1738_unescape().

◆ rfc1738_do_escape()

char* rfc1738_do_escape ( const char *  url,
int  flags 
)

RFC 1738 URL-escaping

Public API is formed of a triplet of encode functions mapping to the rfc1738_do_encode() engine.

ASCII characters are split into four groups:

  • SAFE Characters which are safe to occur in any URL. For example A,B,C
  • CTRLS Binary control codes. Dangerous to include in URLs.
  • UNSAFE Characters which are completely usafe to occur in any URL. For example; backspace, tab, space, newline.
  • RESERVED Characters which are reserved for special meaning and may only occur in certain parts of a URL.

Returns a static buffer containing the RFC 1738 compliant, escaped version of the given url.

Parameters
flagsRFC1738_ESCAPE_CTRLS Encode the blatantly dangerous binary codes.
flagsRFC1738_ESCAPE_UNSAFE Encode printable unsafe characters (excluding CTRLs).
flagsRFC1738_ESCAPE_RESERVED Encode reserved characters.
flagsRFC1738_ESCAPE_ALL Encode all binary CTRL, unsafe and reserved characters.
flagsRFC1738_ESCAPE_NOSPACE Ignore the space whitespace character.
flagsRFC1738_ESCAPE_NOPERCENT Ignore the escaping delimiter ''.

Definition at line 56 of file rfc1738.c.

References buf, i, NULL, RFC1738_ESCAPE_CTRLS, RFC1738_ESCAPE_NOPERCENT, RFC1738_ESCAPE_NOSPACE, RFC1738_ESCAPE_RESERVED, RFC1738_ESCAPE_UNSAFE, rfc1738_reserved_chars, rfc1738_unsafe_chars, xcalloc, and xfree.

Referenced by AnyP::Uri::cleanup(), Ftp::Gateway::parseListing(), and testRFC1738::testUrlEncode().

◆ rfc1738_unescape()

Variable Documentation

◆ rfc1738_reserved_chars

char rfc1738_reserved_chars[]
static
Initial value:
= {
(char) 0x3b,
(char) 0x2f,
(char) 0x3f,
(char) 0x3a,
(char) 0x40,
(char) 0x3d,
(char) 0x26
}

Definition at line 41 of file rfc1738.c.

Referenced by rfc1738_do_escape().

◆ rfc1738_unsafe_chars

char rfc1738_unsafe_chars[]
static
Initial value:
= {
(char) 0x3C,
(char) 0x3E,
(char) 0x22,
(char) 0x23,
(char) 0x7B,
(char) 0x7D,
(char) 0x7C,
(char) 0x5C,
(char) 0x5E,
(char) 0x7E,
(char) 0x5B,
(char) 0x5D,
(char) 0x60,
(char) 0x27
}

Definition at line 20 of file rfc1738.c.

Referenced by rfc1738_do_escape().

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors