rfc1738.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9#ifndef _SQUID_INCLUDE_RFC1738_H
10#define _SQUID_INCLUDE_RFC1738_H
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16/* Encoder rfc1738_do_escape flag values. */
17#define RFC1738_ESCAPE_CTRLS 1
18#define RFC1738_ESCAPE_UNSAFE 2
19#define RFC1738_ESCAPE_RESERVED 4
20#define RFC1738_ESCAPE_ALL (RFC1738_ESCAPE_UNSAFE|RFC1738_ESCAPE_RESERVED|RFC1738_ESCAPE_CTRLS)
21// exclusions
22#define RFC1738_ESCAPE_NOSPACE 128
23#define RFC1738_ESCAPE_NOPERCENT 256
24// Backward compatibility
25#define RFC1738_ESCAPE_UNESCAPED (RFC1738_ESCAPE_UNSAFE|RFC1738_ESCAPE_CTRLS|RFC1738_ESCAPE_NOPERCENT)
26
47extern char *rfc1738_do_escape(const char *url, int flags);
48
49/* Old API functions */
50
51/* Default RFC 1738 escaping. Escape all UNSAFE characters and binary CTRL codes */
52#define rfc1738_escape(x) rfc1738_do_escape(x, RFC1738_ESCAPE_UNSAFE|RFC1738_ESCAPE_CTRLS)
53
54/* Escape a partial URL. Encoding every binary code, unsafe or reserved character. */
55#define rfc1738_escape_part(x) rfc1738_do_escape(x, RFC1738_ESCAPE_ALL)
56
57/* Escape a URL. Encoding every unsafe characters but skipping reserved and already-encoded bytes.
58 * Suitable for safely encoding an absolute URL which may be encoded but is not trusted. */
59#define rfc1738_escape_unescaped(x) rfc1738_do_escape(x, RFC1738_ESCAPE_UNSAFE|RFC1738_ESCAPE_CTRLS|RFC1738_ESCAPE_NOPERCENT)
60
65extern void rfc1738_unescape(char *url);
66
67#ifdef __cplusplus
68}
69#endif
70#endif /* _SQUID_INCLUDE_RFC1738_H */
71
char * rfc1738_do_escape(const char *url, int flags)
Definition: rfc1738.c:56
void rfc1738_unescape(char *url)
Definition: rfc1738.c:146

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors