util_uri.c revision 3d96ee83babeec32482c9082c9426340cee8c44d
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering/* ====================================================================
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * The Apache Software License, Version 1.1
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * Copyright (c) 2000 The Apache Software Foundation. All rights
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * Redistribution and use in source and binary forms, with or without
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * modification, are permitted provided that the following conditions
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * 1. Redistributions of source code must retain the above copyright
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * notice, this list of conditions and the following disclaimer.
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * 2. Redistributions in binary form must reproduce the above copyright
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * notice, this list of conditions and the following disclaimer in
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * the documentation and/or other materials provided with the
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * distribution.
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * 3. The end-user documentation included with the redistribution,
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * if any, must include the following acknowledgment:
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * "This product includes software developed by the
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * Apache Software Foundation (http://www.apache.org/)."
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * Alternately, this acknowledgment may appear in the software itself,
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * if and wherever such third-party acknowledgments normally appear.
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * 4. The names "Apache" and "Apache Software Foundation" must
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * not be used to endorse or promote products derived from this
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * software without prior written permission. For written
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * permission, please contact apache@apache.org.
d0a7c5f69207b6719bab94893035fc8f5f6f87cbLennart Poettering * 5. Products derived from this software may not be called "Apache",
d0a7c5f69207b6719bab94893035fc8f5f6f87cbLennart Poettering * nor may "Apache" appear in their name, without prior written
d0a7c5f69207b6719bab94893035fc8f5f6f87cbLennart Poettering * permission of the Apache Software Foundation.
99d4f5e5c0d2532159542519e683f976f881f0f5Lennart Poettering * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
78f22b973fa2c9b09bd974680836df17163d9ee0Lennart Poettering * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* util_uri.c: URI related utility things
#include "ap_config.h"
#include "apr_strings.h"
#include "httpd.h"
#include "http_log.h"
#include "util_uri.h"
#ifdef HAVE_STRING_H
#include <string.h>
#ifdef HAVE_STRINGS_H
#include <strings.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
char **ptrs;
char **aliases;
return NULL;
return newent;
AP_DECLARE(char *) ap_unparse_uri_components(apr_pool_t *p, const uri_components *uptr, unsigned flags)
int is_default_port;
NULL);
ret,
NULL);
return ret;
#ifdef UTIL_URI_REGEX
int ret;
const char *re_str;
* draft-fielding-uri-syntax-01.txt, section 4.4 tells us:
int ret;
if (ret != 0) {
uri);
return HTTP_BAD_REQUEST;
if (ret != 0) {
return HTTP_BAD_REQUEST;
char *endstr;
int port;
return HTTP_BAD_REQUEST;
if (ret == 0)
return ret;
/* the uri_delims.h file is autogenerated by gen_uri_delims.c */
#include "uri_delims.h"
const char *s1;
const char *hostinfo;
char *endstr;
int port;
* that the path could be empty -- http://foobar?query for example
s = uri;
if (s != uri) {
return HTTP_OK;
if (s1) {
return HTTP_OK;
return HTTP_OK;
s = uri;
hostinfo = s;
if (s < hostinfo) {
if (s == NULL) {
goto deal_with_path;
if (uri != s) {
goto deal_with_path;
return HTTP_BAD_REQUEST;
goto deal_with_path;
if (s1) {
++s1;
goto deal_with_host;
* currently at http://www.mcom.com/newsref/std/tunneling_ssl.html
AP_DECLARE(int) ap_parse_hostinfo_components(apr_pool_t *p, const char *hostinfo, uri_components *uptr)
char *endstr;
if (s == NULL) {
return HTTP_BAD_REQUEST;
return HTTP_OK;
return HTTP_BAD_REQUEST;