]> granicus.if.org Git - apache/commitdiff
emit and accept modern query string parameter delimiters (;).
authorAndre Malo <nd@apache.org>
Sun, 2 Mar 2003 17:15:43 +0000 (17:15 +0000)
committerAndre Malo <nd@apache.org>
Sun, 2 Mar 2003 17:15:43 +0000 (17:15 +0000)
Thus column headers no longer contain unescaped ampersands.

PR: 10880

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98883 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/generators/mod_autoindex.c

diff --git a/CHANGES b/CHANGES
index 12ccd50341a9f763684ac4929dc9e8cd9bd256d4..aa0e1f751c71a81dc6922afbc27ccdc5462f5fc1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) mod_autoindex now emits and accepts modern query string parameter
+     delimiters (;). Thus column headers no longer contain unescaped
+     ampersands. PR 10880  [AndrĂ© Malo]
+
   *) mod_autoindex no longer forgets output format and enabled version
      sort in linked column headers.  [AndrĂ© Malo]
 
index f9b32d9bb51d4bfbe15a0796e3abb6d36a11af56..e556e6dcf90b8ad057919144e24a70c438d1e00e 100644 (file)
@@ -1458,24 +1458,20 @@ static void emit_link(request_rec *r, const char *anchor, char column,
                       char curkey, char curdirection,
                       const char *colargs, int nosort)
 {
-    char qvalue[13];
-    int reverse;
-
     if (!nosort) {
-        reverse = ((curkey == column) && (curdirection == D_ASCENDING));
+        char qvalue[9];
+
         qvalue[0] = '?';
         qvalue[1] = 'C';
         qvalue[2] = '=';
         qvalue[3] = column;
-        qvalue[4] = '&';
-        qvalue[5] = 'a';
-        qvalue[6] = 'm';
-        qvalue[7] = 'p';
-        qvalue[8] = ';';
-        qvalue[9] = 'O';
-        qvalue[10] = '=';
-        qvalue[11] = reverse ? D_DESCENDING : D_ASCENDING;
-        qvalue[12] = '\0';
+        qvalue[4] = ';';
+        qvalue[5] = 'O';
+        qvalue[6] = '=';
+                    /* reverse? */
+        qvalue[7] = ((curkey == column) && (curdirection == D_ASCENDING))
+                      ? D_DESCENDING : D_ASCENDING;
+        qvalue[8] = '\0';
         ap_rvputs(r, "<a href=\"", qvalue, colargs ? colargs : "",
                      "\">", anchor, "</a>", NULL);
     }
@@ -2013,20 +2009,23 @@ static int index_directory(request_rec *r,
         while (qstring && *qstring) {
             if (qstring[0] == 'C' && qstring[1] == '='
                     && qstring[2] && strchr(K_VALID, qstring[2])
-                    && (qstring[3] == '&' || !qstring[3])) {
+                    && (qstring[3] == '&' || qstring[3] == ';'
+                        || !qstring[3])) {
                 keyid = qstring[2];
                 qstring += qstring[3] ? 4 : 3;
             }
             else if (qstring[0] == 'O' && qstring[1] == '='
                      && ((qstring[2] == D_ASCENDING)
                          || (qstring[2] == D_DESCENDING))
-                     && (qstring[3] == '&' || !qstring[3])) {
+                     && (qstring[3] == '&' || qstring[3] == ';'
+                         || !qstring[3])) {
                 direction = qstring[2];
                 qstring += qstring[3] ? 4 : 3;
             }
             else if (qstring[0] == 'F' && qstring[1] == '='
                      && qstring[2] && strchr("012", qstring[2])
-                     && (qstring[3] == '&' || !qstring[3])) {
+                     && (qstring[3] == '&' || qstring[3] == ';'
+                         || !qstring[3])) {
                 if (qstring[2] == '0') {
                     autoindex_opts &= ~(FANCY_INDEXING | TABLE_INDEXING);
                 }
@@ -2037,26 +2036,32 @@ static int index_directory(request_rec *r,
                 else if (qstring[2] == '2') {
                     autoindex_opts |= FANCY_INDEXING | TABLE_INDEXING;
                 }
-                strcpy(fval, "&F= ");
+                strcpy(fval, ";F= ");
                 fval[3] = qstring[2];
                 qstring += qstring[3] ? 4 : 3;
             }
             else if (qstring[0] == 'V' && qstring[1] == '='
                      && (qstring[2] == '0' || qstring[2] == '1')
-                     && (qstring[3] == '&' || !qstring[3])) {
+                     && (qstring[3] == '&' || qstring[3] == ';'
+                         || !qstring[3])) {
                 if (qstring[2] == '0') {
                     autoindex_opts &= ~VERSION_SORT;
                 }
                 else if (qstring[2] == '1') {
                     autoindex_opts |= VERSION_SORT;
                 }
-                strcpy(vval, "&V= "); 
+                strcpy(vval, ";V= "); 
                 vval[3] = qstring[2];
                 qstring += qstring[3] ? 4 : 3;
             }
             else if (qstring[0] == 'P' && qstring[1] == '=') {
-                const char *eos = ap_strchr_c(qstring, '&');
-                if (eos) {
+                const char *eos = qstring + 2;
+
+                while (*eos && *eos != '&' && *eos != ';') {
+                    ++eos;
+                }
+
+                if (*eos) {
                     pstring = apr_pstrndup(r->pool, qstring + 2,
                                            eos - qstring - 2);
                     qstring = eos + 1;
@@ -2066,7 +2071,7 @@ static int index_directory(request_rec *r,
                     qstring = NULL;
                 }
                 if (*pstring) {
-                    ppre = "&P=";
+                    ppre = ";P=";
                 }
                 else {
                     pstring = NULL;