1 /* ====================================================================
2 * Copyright (c) 1998 The Apache Group. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
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
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/)."
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.
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.
29 * 6. Redistributions of any form whatsoever must retain the following
31 * "This product includes software developed by the Apache Group
32 * for use in the Apache HTTP server project (http://www.apache.org/)."
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 * ====================================================================
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/>.
58 * util_uri.h: External Interface of util_uri.c
70 unsigned short default_port
;
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 */
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 */
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 */
101 struct hostent
*hostent
;
103 unsigned short port
; /* The port number, numeric, valid only if port_str != NULL */
105 unsigned is_initialized
:1;
107 unsigned dns_looked_up
:1;
108 unsigned dns_resolved
:1;
113 API_EXPORT(unsigned short) ap_default_port_for_scheme(const char
115 API_EXPORT(unsigned short) ap_default_port_for_request(const request_rec
117 API_EXPORT(struct hostent
*) ap_pduphostent(pool
* p
,
118 const struct hostent
*hp
);
119 API_EXPORT(struct hostent
*) ap_pgethostbyname(pool
* p
,
120 const char *hostname
);
121 API_EXPORT(char *) ap_unparse_uri_components(pool
* p
,
122 const uri_components
*
123 uptr
, unsigned flags
);
124 API_EXPORT(int) ap_parse_uri_components(pool
* p
, const char *uri
,
125 uri_components
* uptr
);
126 API_EXPORT(int) ap_parse_hostinfo_components(pool
* p
,
127 const char *hostinfo
,
128 uri_components
* uptr
);
129 /* called by the core in main() */
130 extern void ap_util_uri_init(void);
135 #endif /*UTIL_URI_H */