Sat, 21 Feb 2026 19:36:15 +0100
add util_parse_uri
| 1 | 1 | /* |
| 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
| 3 | * | |
| 4 | * Copyright 2008 Sun Microsystems, Inc. All rights reserved. | |
| 5 | * | |
| 6 | * THE BSD LICENSE | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions are met: | |
| 10 | * | |
| 11 | * Redistributions of source code must retain the above copyright notice, this | |
| 12 | * list of conditions and the following disclaimer. | |
| 13 | * Redistributions in binary form must reproduce the above copyright notice, | |
| 14 | * this list of conditions and the following disclaimer in the documentation | |
| 15 | * and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * Neither the name of the nor the names of its contributors may be | |
| 18 | * used to endorse or promote products derived from this software without | |
| 19 | * specific prior written permission. | |
| 20 | * | |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER | |
| 25 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | */ | |
| 33 | ||
| 34 | #ifndef BASE_UTIL_H | |
| 35 | #define BASE_UTIL_H | |
| 36 | ||
|
14
b8bf95b39952
New source folder layout
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
1
diff
changeset
|
37 | #include "../daemon/netsite.h" |
|
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
386
diff
changeset
|
38 | #include <cx/string.h> |
|
58
66c22e54aa90
webdav uses the vfs api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
48
diff
changeset
|
39 | #include "pool.h" |
|
148
d861ee1455bf
removes some unused stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
40 | |
|
d861ee1455bf
removes some unused stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
41 | #ifdef XP_UNIX |
|
48
37a512d7b8f6
fixed some memory leaks
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
24
diff
changeset
|
42 | #include <pwd.h> |
|
148
d861ee1455bf
removes some unused stuff
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
43 | #endif |
| 1 | 44 | |
| 45 | #ifndef NOINTNSAPI | |
| 46 | #define INTNSAPI | |
| 47 | #endif /* !NOINTNSAPI */ | |
| 48 | ||
| 49 | /* | |
| 50 | * util.h: A hodge podge of utility functions and standard functions which | |
| 51 | * are unavailable on certain systems | |
| 52 | * | |
| 53 | * Rob McCool | |
| 54 | */ | |
| 55 | ||
| 56 | /* Needed for various reentrant functions */ | |
| 57 | #define DEF_CTIMEBUF 26 | |
| 58 | #define DEF_ERRBUF 256 | |
| 59 | #define DEF_PWBUF 1024 | |
| 60 | ||
| 61 | #ifndef BASE_BUFFER_H | |
| 62 | //include "buffer.h" /* filebuf for getline */ | |
| 63 | #endif /* !BASE_BUFFER_H */ | |
| 64 | ||
| 65 | /* | |
| 66 | * UTIL_ITOA_SIZE is the minimum size for buffers passed to util_itoa(). | |
| 67 | */ | |
| 68 | #define UTIL_ITOA_SIZE 12 | |
| 69 | ||
| 70 | /* | |
| 71 | * UTIL_I64TOA_SIZE is the minimum size for buffers passed to util_i64toa(). | |
| 72 | */ | |
| 73 | #define UTIL_I64TOA_SIZE 21 | |
| 74 | ||
| 75 | /* --- Begin common function prototypes --- */ | |
| 76 | ||
| 77 | #ifdef INTNSAPI | |
| 78 | ||
|
24
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
79 | #ifdef __cplusplus |
|
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
80 | extern "C" { |
|
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
81 | #endif |
| 1 | 82 | |
|
127
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
119
diff
changeset
|
83 | size_t util_base64decode(char *bufcoded, size_t codedbytes, char *bufout); |
|
84e206063b64
adds minimal websocket implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
119
diff
changeset
|
84 | char* util_base64encode(char *in, size_t len); |
|
62
c47e081b6c0f
added keyfile based authentication
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
58
diff
changeset
|
85 | |
| 1 | 86 | NSAPI_PUBLIC |
| 87 | int INTutil_init_PRNetAddr(PRNetAddr * naddr, char * ipstr, int iplen, int type); | |
| 88 | ||
| 89 | NSAPI_PUBLIC | |
| 90 | int INTutil_getline(filebuffer *buf, int lineno, int maxlen, char *l); | |
| 91 | ||
| 92 | NSAPI_PUBLIC char **INTutil_env_create(char **env, int n, int *pos); | |
| 93 | ||
| 94 | NSAPI_PUBLIC char *INTutil_env_str(const char *name, const char *value); | |
| 95 | ||
| 96 | NSAPI_PUBLIC void INTutil_env_replace(char **env, const char *name, const char *value); | |
| 97 | ||
| 98 | NSAPI_PUBLIC void INTutil_env_free(char **env); | |
| 99 | ||
| 100 | NSAPI_PUBLIC char **INTutil_env_copy(char **src, char **dst); | |
| 101 | ||
| 102 | NSAPI_PUBLIC char *INTutil_env_find(char **env, const char *name); | |
| 103 | ||
| 104 | NSAPI_PUBLIC char **util_argv_parse(const char *cmdline); | |
| 105 | ||
| 106 | NSAPI_PUBLIC char *INTutil_hostname(void); | |
| 107 | ||
| 108 | NSAPI_PUBLIC int INTutil_chdir2path(char *path); | |
| 109 | ||
| 110 | NSAPI_PUBLIC int INTutil_chdir(const char *path); | |
| 111 | ||
| 112 | NSAPI_PUBLIC char *INTutil_getcwd(void); | |
| 113 | ||
| 114 | NSAPI_PUBLIC int INTutil_is_mozilla(char *ua, char *major, char *minor); | |
| 115 | ||
| 116 | NSAPI_PUBLIC int INTutil_is_url(const char *url); | |
| 117 | ||
| 118 | NSAPI_PUBLIC int INTutil_mstr2num(const char *s); | |
| 119 | ||
| 120 | NSAPI_PUBLIC int INTutil_later_than(const struct tm *lms, const char *ims); | |
| 121 | ||
| 122 | NSAPI_PUBLIC int INTutil_time_equal(const struct tm *lms, const char *ims); | |
| 123 | ||
| 124 | NSAPI_PUBLIC int INTutil_str_time_equal(const char *t1, const char *t2); | |
| 125 | ||
| 126 | NSAPI_PUBLIC int INTutil_uri_is_evil(const char *t); | |
| 127 | ||
| 128 | NSAPI_PUBLIC int INTutil_uri_is_evil_internal(const char *t, int, int); | |
| 129 | ||
| 130 | NSAPI_PUBLIC void INTutil_uri_parse(char *uri); | |
| 131 | ||
|
693
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
132 | // new util_parse_uri |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
133 | enum WSUriScheme { |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
134 | WS_URI_OTHER = 0, |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
135 | WS_URI_HTTP, |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
136 | WS_URI_HTTPS |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
137 | }; |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
138 | |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
139 | typedef struct WSUri { |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
140 | const char *scheme; |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
141 | size_t schemelen; |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
142 | const char *host; |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
143 | size_t hostlen; |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
144 | const char *path; |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
145 | size_t pathlen; |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
146 | enum WSUriScheme scheme_num; |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
147 | short port; |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
148 | } WSUri; |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
149 | |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
150 | NSAPI_PUBLIC int util_parse_uri(const char *uri, WSUri *result); |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
151 | NSAPI_PUBLIC int util_parse_uri_len(const char *uri, size_t length, WSUri *result); |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
152 | // end util_parse_uri |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
153 | |
|
b26cae13b79a
add util_parse_uri
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
415
diff
changeset
|
154 | |
| 1 | 155 | #ifdef XP_WIN32 |
| 156 | NSAPI_PUBLIC int INTutil_uri_unescape_and_normalize(pool_handle_t *pool, char *s, char *unnormalized); | |
| 157 | #endif /* XP_WIN32 */ | |
| 158 | ||
| 159 | NSAPI_PUBLIC void INTutil_uri_normalize_slashes(char *s); | |
| 160 | ||
| 161 | NSAPI_PUBLIC void INTutil_uri_unescape (char *s); | |
| 162 | ||
| 163 | NSAPI_PUBLIC int INTutil_uri_unescape_strict (char *s); | |
| 164 | ||
| 165 | NSAPI_PUBLIC int INTutil_uri_unescape_plus (const char *src, char *trg, int len); | |
| 166 | ||
| 167 | NSAPI_PUBLIC char *INTutil_uri_escape(char *d, const char *s); | |
| 168 | ||
| 169 | NSAPI_PUBLIC char *INTutil_uri_strip_params(char *uri); | |
| 170 | ||
| 171 | NSAPI_PUBLIC char* util_canonicalize_uri(pool_handle_t *pool, const char *uri, int len, int *pcanonlen); | |
| 172 | ||
| 173 | NSAPI_PUBLIC char* util_canonicalize_redirect(pool_handle_t *pool, const char *baseUri, const char *newUri); | |
| 174 | ||
| 175 | NSAPI_PUBLIC char *INTutil_url_escape(char *d, const char *s); | |
| 176 | ||
| 177 | NSAPI_PUBLIC char *INTutil_sh_escape(char *s); | |
| 178 | ||
| 179 | NSAPI_PUBLIC int INTutil_mime_separator(char *sep); | |
| 180 | ||
| 181 | NSAPI_PUBLIC int INTutil_itoa(int i, char *a); | |
| 182 | ||
|
24
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
183 | NSAPI_PUBLIC int INTutil_i64toa(int64_t i, char *a); |
| 1 | 184 | |
| 185 | ||
| 186 | NSAPI_PUBLIC | |
| 187 | int INTutil_vsprintf(char *s, register const char *fmt, va_list args); | |
| 188 | ||
| 189 | NSAPI_PUBLIC int INTutil_sprintf(char *s, const char *fmt, ...); | |
| 190 | ||
| 191 | NSAPI_PUBLIC int INTutil_vsnprintf(char *s, int n, register const char *fmt, | |
| 192 | va_list args); | |
| 193 | ||
| 194 | NSAPI_PUBLIC int INTutil_snprintf(char *s, int n, const char *fmt, ...); | |
| 195 | ||
|
338
c62ea2a2133b
add util_asprintf and util_vasprintf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
285
diff
changeset
|
196 | NSAPI_PUBLIC int util_vasprintf(pool_handle_t *pool, char **s, const char *fmt, |
|
c62ea2a2133b
add util_asprintf and util_vasprintf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
285
diff
changeset
|
197 | va_list args); |
|
c62ea2a2133b
add util_asprintf and util_vasprintf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
285
diff
changeset
|
198 | |
|
c62ea2a2133b
add util_asprintf and util_vasprintf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
285
diff
changeset
|
199 | NSAPI_PUBLIC int util_asprintf(pool_handle_t *pool, char **s, const char *fmt, ...); |
|
c62ea2a2133b
add util_asprintf and util_vasprintf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
285
diff
changeset
|
200 | |
| 1 | 201 | NSAPI_PUBLIC int util_strlftime(char *dst, size_t dstsize, const char *format, const struct tm *t); |
| 202 | ||
| 203 | NSAPI_PUBLIC int INTutil_strftime(char *s, const char *format, const struct tm *t); | |
| 204 | ||
| 205 | NSAPI_PUBLIC char *INTutil_strtok(char *s1, const char *s2, char **lasts); | |
| 206 | ||
| 207 | NSAPI_PUBLIC struct tm *INTutil_localtime(const time_t *clock, struct tm *res); | |
| 208 | ||
| 209 | NSAPI_PUBLIC char *INTutil_ctime(const time_t *clock, char *buf, int buflen); | |
| 210 | ||
| 211 | NSAPI_PUBLIC char *INTutil_strerror(int errnum, char *msg, int buflen); | |
| 212 | ||
| 213 | NSAPI_PUBLIC struct tm *INTutil_gmtime(const time_t *clock, struct tm *res); | |
| 214 | ||
| 215 | NSAPI_PUBLIC char *INTutil_asctime(const struct tm *tm,char *buf, int buflen); | |
| 216 | ||
| 217 | NSAPI_PUBLIC char *INTutil_cookie_find(char *cookie, const char *name); | |
| 218 | ||
| 219 | NSAPI_PUBLIC char *INTutil_cookie_next(char *cookie, char **name, char **value); | |
| 220 | ||
| 221 | NSAPI_PUBLIC char *INTutil_cookie_next_av_pair(char *cookie, char **name, char **value); | |
| 222 | ||
| 223 | NSAPI_PUBLIC void INTutil_random(void *buf, size_t sz); | |
| 224 | ||
| 225 | NSAPI_PUBLIC PRBool INTutil_format_http_version(const char *v, int *protv_num, char *buffer, int size); | |
| 226 | ||
| 227 | NSAPI_PUBLIC int INTutil_getboolean(const char *v, int def); | |
|
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
386
diff
changeset
|
228 | int util_getboolean_s(cxstring s, int def); |
|
24
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
229 | |
|
119
155cbab9eefd
adds support for CGI with request bodies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
106
diff
changeset
|
230 | // new |
|
282
cfb588e27198
add support for getstat parameter in pg readdir
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
278
diff
changeset
|
231 | NSAPI_PUBLIC int util_strtoint(const char *str, int64_t *value); |
|
278
38bf7b42b58c
implement pg_vfs_open
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
274
diff
changeset
|
232 | NSAPI_PUBLIC const char* util_resource_name(const char *url); |
|
285
96e53bd94958
add support for O_CREAT flag in postgresql vfs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
282
diff
changeset
|
233 | NSAPI_PUBLIC char* util_parent_path(const char *path); |
|
382
9e2289c77b04
disable pg large object IO functions for collections
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
338
diff
changeset
|
234 | NSAPI_PUBLIC char* util_parent_path_pool(pool_handle_t *pool, const char *path); |
|
119
155cbab9eefd
adds support for CGI with request bodies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
106
diff
changeset
|
235 | |
|
24
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
236 | // TODO |
|
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
237 | //NSAPI_PUBLIC PRIntervalTime INTutil_getinterval(const char *v, PRIntervalTime def); |
| 1 | 238 | |
| 239 | #ifdef NEED_STRCASECMP | |
| 240 | NSAPI_PUBLIC int INTutil_strcasecmp(const char *one, const char *two); | |
| 241 | #endif /* NEED_STRCASECMP */ | |
| 242 | ||
| 243 | #ifdef NEED_STRNCASECMP | |
| 244 | NSAPI_PUBLIC int INTutil_strncasecmp(const char *one, const char *two, int n); | |
| 245 | #endif /* NEED_STRNCASECMP */ | |
| 246 | ||
| 247 | NSAPI_PUBLIC char *INTutil_strcasestr(char *str, const char *substr); | |
| 248 | ||
| 249 | NSAPI_PUBLIC size_t util_strlcpy(char *dst, const char *src, size_t dstsize); | |
| 250 | ||
| 251 | NSAPI_PUBLIC size_t util_strlcat(char *dst, const char *src, size_t dstsize); | |
| 252 | ||
| 253 | NSAPI_PUBLIC char *INTutil_uuencode(const char *src, int len); | |
| 254 | ||
| 255 | NSAPI_PUBLIC char *INTutil_uudecode(const char *src); | |
| 256 | ||
| 257 | NSAPI_PUBLIC char *util_strlower(char *s); | |
| 258 | ||
| 259 | NSAPI_PUBLIC char *util_decrement_string(char *s); | |
| 260 | ||
|
24
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
261 | NSAPI_PUBLIC int64_t util_atoi64(const char *a); |
| 1 | 262 | |
| 263 | NSAPI_PUBLIC int util_qtoi(const char *q, const char **p); | |
| 264 | ||
|
58
66c22e54aa90
webdav uses the vfs api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
48
diff
changeset
|
265 | /* path utils */ |
|
66c22e54aa90
webdav uses the vfs api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
48
diff
changeset
|
266 | NSAPI_PUBLIC |
|
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
386
diff
changeset
|
267 | cxmutstr util_path_append(pool_handle_t *pool, char *path, char *child); |
|
63
66442f81f823
supports file system ACLs on Solaris
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
268 | NSAPI_PUBLIC |
|
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
386
diff
changeset
|
269 | cxmutstr util_path_remove_last(cxmutstr path); |
|
96
0185b13bf41f
added document-root and pfx2dir nametrans safs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
91
diff
changeset
|
270 | NSAPI_PUBLIC |
|
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
386
diff
changeset
|
271 | void util_add_ppath(cxmutstr root, cxmutstr path, pblock *vars); |
|
58
66c22e54aa90
webdav uses the vfs api
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
48
diff
changeset
|
272 | |
| 99 | 273 | |
|
415
d938228c382e
switch from ucx 2 to 3
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
386
diff
changeset
|
274 | int util_isdate(const char *str); |
|
104
a8acbb12f27c
implemented range requests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
275 | |
| 1 | 276 | /* --- End common function prototypes --- */ |
| 277 | ||
| 278 | /* --- Begin Unix-only function prototypes --- */ | |
| 279 | ||
| 280 | #ifdef XP_UNIX | |
| 281 | ||
| 282 | NSAPI_PUBLIC int INTutil_can_exec(struct stat *finfo, uid_t uid, gid_t gid); | |
| 283 | ||
| 284 | NSAPI_PUBLIC | |
| 285 | struct passwd *INTutil_getpwnam(const char *name, struct passwd *result, | |
| 286 | char *buffer, int buflen); | |
| 287 | ||
| 288 | NSAPI_PUBLIC | |
| 289 | struct passwd *INTutil_getpwuid(uid_t uid, struct passwd *result, | |
| 290 | char *buffer, int buflen); | |
| 291 | ||
| 292 | NSAPI_PUBLIC pid_t INTutil_waitpid(pid_t pid, int *statptr, int options); | |
| 293 | ||
| 294 | #endif /* XP_UNIX */ | |
| 295 | ||
| 296 | /* --- End Unix-only function prototypes --- */ | |
| 297 | ||
| 298 | /* --- Begin Windows-only function prototypes --- */ | |
| 299 | ||
| 300 | #ifdef XP_WIN32 | |
| 301 | ||
| 302 | NSAPI_PUBLIC | |
| 303 | VOID INTutil_delete_directory(char *FileName, BOOL delete_directory); | |
| 304 | ||
| 305 | #endif /* XP_WIN32 */ | |
| 306 | ||
| 307 | /* --- End Windows-only function prototypes --- */ | |
| 308 | ||
|
24
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
309 | #ifdef __cplusplus |
|
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
310 | } |
|
1a7853a4257e
removed some NSPR dependencies
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
14
diff
changeset
|
311 | #endif |
| 1 | 312 | |
| 313 | #ifdef __cplusplus | |
| 314 | ||
| 315 | NSAPI_PUBLIC const char *util_host_port_suffix(const char *h); | |
| 316 | ||
| 317 | #endif | |
| 318 | ||
| 319 | #define util_init_PRNetAddr INTutil_init_PRNetAddr | |
| 320 | #define util_getline INTutil_getline | |
| 321 | #define util_env_create INTutil_env_create | |
| 322 | #define util_env_str INTutil_env_str | |
| 323 | #define util_env_replace INTutil_env_replace | |
| 324 | #define util_env_free INTutil_env_free | |
| 325 | #define util_env_copy INTutil_env_copy | |
| 326 | #define util_env_find INTutil_env_find | |
| 327 | #define util_hostname INTutil_hostname | |
| 328 | #define util_chdir2path INTutil_chdir2path | |
| 329 | #define util_chdir INTutil_chdir | |
| 330 | #define util_getcwd INTutil_getcwd | |
| 331 | #define util_is_mozilla INTutil_is_mozilla | |
| 332 | #define util_is_url INTutil_is_url | |
| 333 | #define util_mstr2num INTutil_mstr2num | |
| 334 | #define util_later_than INTutil_later_than | |
| 335 | #define util_time_equal INTutil_time_equal | |
| 336 | #define util_str_time_equal INTutil_str_time_equal | |
| 337 | #define util_uri_is_evil INTutil_uri_is_evil | |
| 338 | #define util_uri_is_evil_internal INTutil_uri_is_evil_internal | |
| 339 | #define util_uri_parse INTutil_uri_parse | |
| 340 | #ifdef XP_WIN32 | |
| 341 | #define util_uri_unescape_and_normalize INTutil_uri_unescape_and_normalize | |
| 342 | #endif /* XP_WIN32 */ | |
| 343 | #define util_uri_normalize_slashes INTutil_uri_normalize_slashes | |
| 344 | #define util_uri_unescape INTutil_uri_unescape | |
| 345 | #define util_uri_unescape_strict INTutil_uri_unescape_strict | |
| 346 | #define util_uri_unescape_plus INTutil_uri_unescape_plus | |
| 347 | ||
| 348 | #define util_uri_escape INTutil_uri_escape | |
| 349 | #define util_uri_strip_params INTutil_uri_strip_params | |
| 350 | #define util_url_escape INTutil_url_escape | |
| 351 | #define util_sh_escape INTutil_sh_escape | |
| 352 | #define util_mime_separator INTutil_mime_separator | |
| 353 | #define util_itoa INTutil_itoa | |
| 354 | #define util_i64toa INTutil_i64toa | |
| 355 | #define util_vsprintf INTutil_vsprintf | |
| 356 | #define util_sprintf INTutil_sprintf | |
| 357 | #define util_vsnprintf INTutil_vsnprintf | |
| 358 | #define util_snprintf INTutil_snprintf | |
|
338
c62ea2a2133b
add util_asprintf and util_vasprintf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
285
diff
changeset
|
359 | #define util_vasprintf INTutil_vasprintf |
|
c62ea2a2133b
add util_asprintf and util_vasprintf
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
285
diff
changeset
|
360 | #define util_asprintf INTutil_asprintf |
| 1 | 361 | #define util_strftime INTutil_strftime |
| 362 | #define util_strcasecmp INTutil_strcasecmp | |
| 363 | #define util_strncasecmp INTutil_strncasecmp | |
| 364 | #define util_strcasestr INTutil_strcasestr | |
| 365 | #define util_strtok INTutil_strtok | |
| 366 | #define util_localtime INTutil_localtime | |
| 367 | #define util_ctime INTutil_ctime | |
| 368 | #define util_strerror INTutil_strerror | |
| 369 | #define util_gmtime INTutil_gmtime | |
| 370 | #define util_asctime INTutil_asctime | |
| 371 | #define util_uuencode INTutil_uuencode | |
| 372 | #define util_uudecode INTutil_uudecode | |
| 373 | ||
| 374 | #ifdef XP_UNIX | |
| 375 | #define util_can_exec INTutil_can_exec | |
| 376 | #define util_getpwnam INTutil_getpwnam | |
| 377 | #define util_getpwuid INTutil_getpwuid | |
| 378 | #define util_waitpid INTutil_waitpid | |
| 379 | #endif /* XP_UNIX */ | |
| 380 | ||
| 381 | #ifdef XP_WIN32 | |
| 382 | #define util_delete_directory INTutil_delete_directory | |
| 383 | #endif /* XP_WIN32 */ | |
| 384 | ||
| 385 | #ifdef NEED_STRCASECMP | |
| 386 | #define util_strcasecmp INTutil_strcasecmp | |
| 387 | #define strcasecmp INTutil_strcasecmp | |
| 388 | #endif /* NEED_STRCASECMP */ | |
| 389 | ||
| 390 | #ifdef NEED_STRINGS_H /* usually for strcasecmp */ | |
| 391 | #include <strings.h> | |
| 392 | #endif | |
| 393 | ||
| 394 | #ifdef NEED_STRNCASECMP | |
| 395 | #define util_strncasecmp INTutil_strncasecmp | |
| 396 | #define strncasecmp INTutil_strncasecmp | |
| 397 | #endif /* NEED_STRNCASECMP */ | |
| 398 | ||
| 399 | #define util_cookie_find INTutil_cookie_find | |
| 400 | #define util_cookie_next INTutil_cookie_next | |
| 401 | #define util_cookie_next_av_pair INTutil_cookie_next_av_pair | |
| 402 | ||
| 403 | #define util_random INTutil_random | |
| 404 | #define util_format_http_version INTutil_format_http_version | |
| 405 | #define util_getboolean INTutil_getboolean | |
| 406 | #define util_getinterval INTutil_getinterval | |
| 407 | ||
| 408 | #ifdef XP_WIN32 | |
| 409 | void set_fullpathname(PRBool b); | |
| 410 | #endif /* XP_WIN32 */ | |
| 411 | #endif /* INTNSAPI */ | |
| 412 | ||
| 413 | #endif /* !BASE_UTIL_H */ | |
| 414 | ||
| 415 |