OSDN Git Service

* Added Spec Cache Cleaner.
[modchxj/mod_chxj.git] / src / chxj_jreserved_tag.c
index 3d6b833..66e020e 100644 (file)
@@ -120,6 +120,21 @@ static r_table_t reserved_table[] = {
 };
 
 
+int
+chxj_is_jreserved_tag(const char *src) 
+{
+  int ii;
+  for (ii=0;ii<RESERVED_NELT;ii++) {
+    if (STRCASEEQ(reserved_table[ii].lower,
+                  reserved_table[ii].upper,
+                  reserved_table[ii].name, 
+                  src)) {
+      return 1;
+    }
+  }
+  return 0;
+}
+
 char *
 chxj_jreserved_to_safe_tag(request_rec *r, const char *src, chxjconvrule_entry *entryp)
 {
@@ -172,30 +187,35 @@ chxj_jreserved_tag_to_safe_for_query_string(request_rec *r, const char *query_st
   s++;
   fname = apr_pstrdup(pool, result);
   result = NULL;
-
-  char *pstat;
+       
+       char *pstat;
   char *pstat2;
   for (;;) {
     char *pair = NULL;
-    if (xmlflag) {
-      pair = apr_strtok(s, "&amp;", &pstat);
-    }
-    else {
-      pair = apr_strtok(s, "&", &pstat);
-    }
+    pair = apr_strtok(s, "&", &pstat);
+    
     if (! pair) break;
     s = NULL;
+               
+               if(strncasecmp(pair,"amp;",4) == 0){
+                       pair += 4;
+               }
+               
     char *key = apr_strtok(pair, "=",  &pstat2);
     char *val = "";
     if (key) {
       val = apr_strtok(NULL, "=", &pstat2);
+                       
       if (!val) val = "";
     }
     char *tmp = NULL;
     if (strcasecmp(key, "guid") == 0) {
       tmp = apr_psprintf(pool, "%s=%s", key, val);
       if (result) {
-        result = apr_pstrcat(pool, result, "&" ,tmp, NULL);
+                               if(xmlflag)
+                                       result = apr_pstrcat(pool, result, "&amp;" ,tmp, NULL);
+                               else
+               result = apr_pstrcat(pool, result, "&" ,tmp, NULL);
       }
       else {
         result = tmp;