summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Bloom <rbb@apache.org>2001-11-10 19:38:02 +0100
committerRyan Bloom <rbb@apache.org>2001-11-10 19:38:02 +0100
commita0545d2647e0afad247f74e570b729c8e81ad3c9 (patch)
tree48cb53d16d21c0e409799662f62f22b43913fe78
parentFix a missing tag. (diff)
downloadapache2-a0545d2647e0afad247f74e570b729c8e81ad3c9.tar.xz
apache2-a0545d2647e0afad247f74e570b729c8e81ad3c9.zip
Improve http2env's performance by cutting the work it has to
do. Submitted by: Brian Pane <bpane@pacbell.net> git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91835 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES3
-rw-r--r--server/util_script.c32
2 files changed, 23 insertions, 12 deletions
diff --git a/CHANGES b/CHANGES
index e54fc2d0e0..0657381861 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
Changes with Apache 2.0.29-dev
+ *) Improve http2env's performance by cutting the work it has to
+ do. [Brian Pane <bpane@pacbell.net>]
+
*) use new 'apr_hash_merge' function in mod_mime (performance fix)
[Brian Pane <bpane@pacbell.net>]
diff --git a/server/util_script.c b/server/util_script.c
index 735c76f348..0f3733bea4 100644
--- a/server/util_script.c
+++ b/server/util_script.c
@@ -95,20 +95,28 @@
#define MALFORMED_MESSAGE "malformed header from script. Bad header="
#define MALFORMED_HEADER_LENGTH_TO_SHOW 30
-static char *http2env(apr_pool_t *a, char *w)
+static char *http2env(apr_pool_t *a, const char *w)
{
- char *res = apr_pstrcat(a, "HTTP_", w, NULL);
+ char *res = (char *)apr_palloc(a, sizeof("HTTP_") + strlen(w));
char *cp = res;
-
- while (*++cp) {
- if (!apr_isalnum(*cp) && *cp != '_') {
- *cp = '_';
- }
- else {
- *cp = apr_toupper(*cp);
- }
- }
-
+ char c;
+
+ *cp++ = 'H';
+ *cp++ = 'T';
+ *cp++ = 'T';
+ *cp++ = 'P';
+ *cp++ = '_';
+
+ while ((c = *w++) != 0) {
+ if (!apr_isalnum(c)) {
+ *cp++ = '_';
+ }
+ else {
+ *cp++ = apr_toupper(c);
+ }
+ }
+ *cp = 0;
+
return res;
}