From 07b1101cc1ed28618e07eda179eaab84715a9399 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Wed, 3 Jun 2009 16:42:49 +0000 Subject: [PATCH] Streamline struct http_request if FEATURE_EXTENDED_HOST_PATTERNS is enabled. --- jcc.c | 4 +++- project.h | 4 +++- urlmatch.c | 14 ++++++++++---- urlmatch.h | 4 +++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/jcc.c b/jcc.c index dc40741e..c5a8a4a8 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.249 2009/05/13 18:22:45 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.250 2009/05/16 13:27:20 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -491,8 +491,10 @@ static jb_err get_request_destination_elsewhere(struct client_state *csp, struct } else if (JB_ERR_OK == get_destination_from_headers(headers, csp->http)) { +#ifndef FEATURE_EXTENDED_HOST_PATTERNS /* Split the domain we just got for pattern matching */ init_domain_components(csp->http); +#endif return JB_ERR_OK; } diff --git a/project.h b/project.h index eaac07dd..8f1fc469 100644 --- a/project.h +++ b/project.h @@ -1,7 +1,7 @@ #ifndef PROJECT_H_INCLUDED #define PROJECT_H_INCLUDED /** Version string. */ -#define PROJECT_H_VERSION "$Id: project.h,v 1.137 2009/05/13 18:22:45 fabiankeil Exp $" +#define PROJECT_H_VERSION "$Id: project.h,v 1.138 2009/05/16 13:27:20 fabiankeil Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/project.h,v $ @@ -296,9 +296,11 @@ struct http_request char *host_ip_addr_str; /**< String with dotted decimal representation of host's IP. NULL before connect_to() */ +#ifndef FEATURE_EXTENDED_HOST_PATTERNS char *dbuffer; /**< Buffer with '\0'-delimited domain name. */ char **dvec; /**< List of pointers to the strings in dbuffer. */ int dcount; /**< How many parts to this domain? (length of dvec) */ +#endif /* ndef FEATURE_EXTENDED_HOST_PATTERNS */ }; /** diff --git a/urlmatch.c b/urlmatch.c index 7a2778b0..317344d1 100644 --- a/urlmatch.c +++ b/urlmatch.c @@ -1,4 +1,4 @@ -const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.52 2009/05/19 17:39:59 fabiankeil Exp $"; +const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.53 2009/05/19 17:40:36 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/urlmatch.c,v $ @@ -86,12 +86,15 @@ void free_http_request(struct http_request *http) freez(http->path); freez(http->ver); freez(http->host_ip_addr_str); +#ifndef FEATURE_EXTENDED_HOST_PATTERNS freez(http->dbuffer); freez(http->dvec); http->dcount = 0; +#endif } +#ifndef FEATURE_EXTENDED_HOST_PATTERNS /********************************************************************* * * Function : init_domain_components @@ -155,6 +158,7 @@ jb_err init_domain_components(struct http_request *http) return JB_ERR_OK; } +#endif /* ndef FEATURE_EXTENDED_HOST_PATTERNS */ /********************************************************************* @@ -377,10 +381,12 @@ jb_err parse_http_url(const char *url, struct http_request *http, int require_pr } } - /* - * Split domain name so we can compare it against wildcards - */ +#ifdef FEATURE_EXTENDED_HOST_PATTERNS + return JB_ERR_OK; +#else + /* Split domain name so we can compare it against wildcards */ return init_domain_components(http); +#endif /* def FEATURE_EXTENDED_HOST_PATTERNS */ } diff --git a/urlmatch.h b/urlmatch.h index fde70737..74948560 100644 --- a/urlmatch.h +++ b/urlmatch.h @@ -1,6 +1,6 @@ #ifndef URLMATCH_H_INCLUDED #define URLMATCH_H_INCLUDED -#define URLMATCH_H_VERSION "$Id: urlmatch.h,v 1.14 2009/04/17 11:38:28 fabiankeil Exp $" +#define URLMATCH_H_VERSION "$Id: urlmatch.h,v 1.15 2009/05/16 13:27:20 fabiankeil Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/urlmatch.h,v $ @@ -43,7 +43,9 @@ extern "C" { #endif extern void free_http_request(struct http_request *http); +#ifndef FEATURE_EXTENDED_HOST_PATTERNS extern jb_err init_domain_components(struct http_request *http); +#endif extern jb_err parse_http_request(const char *req, struct http_request *http); extern jb_err parse_http_url(const char *url, struct http_request *http, -- 2.39.2