CVSTrac Legacy Code

Check-in [3625b606ff]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:slightly cleaner
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3625b606ffe3b53df888aee20b67776432f10cda
User & Date: cpb 2016-07-18 19:27:57
Context
2019-01-20
21:34
Statically link against a recent version of SQLite. Leaf check-in: e4587a17aa user: drh tags: trunk
2016-07-18
19:27
slightly cleaner check-in: 3625b606ff user: cpb tags: trunk
19:22
block PROXY param. See https://httpoxy.org/ check-in: 5124b0f577 user: cpb tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to cgi.c.

2630
2631
2632
2633
2634
2635
2636



2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
    while( i>0 && isspace(zVal[i-1]) ){ i--; }
    zVal[i] = 0;
    for(i=0; zFieldName[i]; i++){ zFieldName[i] = tolower(zFieldName[i]); }
    if( strcmp(zFieldName,"content-length:")==0 ){
      putenv(mprintf("CONTENT_LENGTH=%s", zVal));
    }else if( strcmp(zFieldName,"content-type:")==0 ){
      putenv(mprintf("CONTENT_TYPE=%s", zVal));



    }else{
      for(i=0; zFieldName[i]; i++){
        if( zFieldName[i]==':' && !zFieldName[i+1] ) zFieldName[i] = 0;
        else if(!isalnum(zFieldName[i])) zFieldName[i]='_';
        else zFieldName[i] = toupper(zFieldName[i]);
      }
      if( !strcasecmp(zFieldName,"PROXY") ) {
        /* see https://httpoxy.org/ */
        continue;
      }
      putenv(mprintf("HTTP_%s=%s", zFieldName,zVal));
    }
  }

  cgi_init();
}








>
>
>






<
<
<
<







2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645




2646
2647
2648
2649
2650
2651
2652
    while( i>0 && isspace(zVal[i-1]) ){ i--; }
    zVal[i] = 0;
    for(i=0; zFieldName[i]; i++){ zFieldName[i] = tolower(zFieldName[i]); }
    if( strcmp(zFieldName,"content-length:")==0 ){
      putenv(mprintf("CONTENT_LENGTH=%s", zVal));
    }else if( strcmp(zFieldName,"content-type:")==0 ){
      putenv(mprintf("CONTENT_TYPE=%s", zVal));
    }else if( strcmp(zFieldName,"proxy:")==0 ){
      /* see https://httpoxy.org/ */
      continue;
    }else{
      for(i=0; zFieldName[i]; i++){
        if( zFieldName[i]==':' && !zFieldName[i+1] ) zFieldName[i] = 0;
        else if(!isalnum(zFieldName[i])) zFieldName[i]='_';
        else zFieldName[i] = toupper(zFieldName[i]);
      }




      putenv(mprintf("HTTP_%s=%s", zFieldName,zVal));
    }
  }

  cgi_init();
}