Annotation of win32/apache13/src/include/util_uri.h, revision 1.1.1.1
1.1 parser 1: /* ====================================================================
2: * Copyright (c) 1998-1999 The Apache Group. All rights reserved.
3: *
4: * Redistribution and use in source and binary forms, with or without
5: * modification, are permitted provided that the following conditions
6: * are met:
7: *
8: * 1. Redistributions of source code must retain the above copyright
9: * notice, this list of conditions and the following disclaimer.
10: *
11: * 2. Redistributions in binary form must reproduce the above copyright
12: * notice, this list of conditions and the following disclaimer in
13: * the documentation and/or other materials provided with the
14: * distribution.
15: *
16: * 3. All advertising materials mentioning features or use of this
17: * software must display the following acknowledgment:
18: * "This product includes software developed by the Apache Group
19: * for use in the Apache HTTP server project (http://www.apache.org/)."
20: *
21: * 4. The names "Apache Server" and "Apache Group" must not be used to
22: * endorse or promote products derived from this software without
23: * prior written permission.
24: *
25: * 5. Products derived from this software may not be called "Apache"
26: * nor may "Apache" appear in their names without prior written
27: * permission of the Apache Group.
28: *
29: * 6. Redistributions of any form whatsoever must retain the following
30: * acknowledgment:
31: * "This product includes software developed by the Apache Group
32: * for use in the Apache HTTP server project (http://www.apache.org/)."
33: *
34: * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
35: * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
36: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
37: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
38: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
39: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
40: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
41: * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
43: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
44: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
45: * OF THE POSSIBILITY OF SUCH DAMAGE.
46: * ====================================================================
47: *
48: * This software consists of voluntary contributions made by many
49: * individuals on behalf of the Apache Group and was originally based
50: * on public domain software written at the National Center for
51: * Supercomputing Applications, University of Illinois, Urbana-Champaign.
52: * For more information on the Apache Group and the Apache HTTP server
53: * project, please see <http://www.apache.org/>.
54: *
55: */
56:
57: /*
58: * util_uri.h: External Interface of util_uri.c
59: */
60:
61: #ifndef UTIL_URI_H
62: #define UTIL_URI_H
63:
64: #ifdef __cplusplus
65: extern "C" {
66: #endif
67:
68: typedef struct {
69: const char *name;
70: unsigned short default_port;
71: } schemes_t;
72:
73: #define DEFAULT_FTP_DATA_PORT 20
74: #define DEFAULT_FTP_PORT 21
75: #define DEFAULT_GOPHER_PORT 70
76: #define DEFAULT_NNTP_PORT 119
77: #define DEFAULT_WAIS_PORT 210
78: #define DEFAULT_SNEWS_PORT 563
79: #define DEFAULT_PROSPERO_PORT 1525 /* WARNING: conflict w/Oracle */
80:
81: /* Flags passed to unparse_uri_components(): */
82: #define UNP_OMITSITEPART (1U<<0) /* suppress "scheme://user@site:port" */
83: #define UNP_OMITUSER (1U<<1) /* Just omit user */
84: #define UNP_OMITPASSWORD (1U<<2) /* Just omit password */
85: #define UNP_OMITUSERINFO (UNP_OMITUSER|UNP_OMITPASSWORD) /* omit "user:password@" part */
86: #define UNP_REVEALPASSWORD (1U<<3) /* Show plain text password (default: show XXXXXXXX) */
87: #define UNP_OMITPATHINFO (1U<<4) /* Show "scheme://user@site:port" only */
88: #define UNP_OMITQUERY (1U<<5) /* Omit the "?queryarg" from the path */
89:
90: typedef struct {
91: char *scheme; /* scheme ("http"/"ftp"/...) */
92: char *hostinfo; /* combined [user[:password]@]host[:port] */
93: char *user; /* user name, as in http://user:passwd@host:port/ */
94: char *password; /* password, as in http://user:passwd@host:port/ */
95: char *hostname; /* hostname from URI (or from Host: header) */
96: char *port_str; /* port string (integer representation is in "port") */
97: char *path; /* the request path (or "/" if only scheme://host was given) */
98: char *query; /* Everything after a '?' in the path, if present */
99: char *fragment; /* Trailing "#fragment" string, if present */
100:
101: struct hostent *hostent;
102:
103: unsigned short port; /* The port number, numeric, valid only if port_str != NULL */
104:
105: unsigned is_initialized:1;
106:
107: unsigned dns_looked_up:1;
108: unsigned dns_resolved:1;
109:
110: } uri_components;
111:
112: /* util_uri.c */
113: API_EXPORT(unsigned short) ap_default_port_for_scheme(const char *scheme_str);
114: API_EXPORT(unsigned short) ap_default_port_for_request(const request_rec *r);
115: API_EXPORT(struct hostent *) ap_pduphostent(pool *p, const struct hostent *hp);
116: API_EXPORT(struct hostent *) ap_pgethostbyname(pool *p, const char *hostname);
117: API_EXPORT(char *) ap_unparse_uri_components(pool *p, const uri_components *uptr,
118: unsigned flags);
119: API_EXPORT(int) ap_parse_uri_components(pool *p, const char *uri, uri_components *uptr);
120: API_EXPORT(int) ap_parse_hostinfo_components(pool *p, const char *hostinfo, uri_components *uptr);
121: /* called by the core in main() */
122: extern void ap_util_uri_init(void);
123:
124: #ifdef __cplusplus
125: }
126: #endif
127:
128: #endif /*UTIL_URI_H*/
E-mail: