X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fmodules%2Fswfcgi.c;h=a1656e5087b0fe86f91efdc015d759ceeae07a9a;hb=714b122c75a757dcd1ef9a631aa209a298e650d7;hp=67f6881c8b5a726c6920426ee0a2166ecba11d37;hpb=cfb06dab4b1674078f1306d1c537ad03d00def26;p=swftools.git diff --git a/lib/modules/swfcgi.c b/lib/modules/swfcgi.c index 67f6881..a1656e5 100644 --- a/lib/modules/swfcgi.c +++ b/lib/modules/swfcgi.c @@ -9,16 +9,26 @@ Copyright (c) 2001 Rainer Böhme - This file is distributed under the GPL, see file COPYING for details + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -*/ + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define ishex(x) (((x) >= '0' && (x) <= '9') || ((x) >= 'a' && (x) <= 'f') || ((x) >= 'A' && (x) <= 'F')) #define PREFIX "WWW_" -static int htoi(unsigned char * s) +static int swf_htoi(unsigned char * s) { int value; char c; @@ -33,14 +43,14 @@ static int htoi(unsigned char * s) return (value); } -static void url_unescape(unsigned char * s) +static void swf_url_unescape(unsigned char * s) { unsigned char *dest = s; while (s[0]) { if (s[0] == '+') dest[0] = ' '; else { if (s[0] == '%' && ishex(s[1]) && ishex(s[2])) - { dest[0] = (unsigned char) htoi(s + 1); + { dest[0] = (unsigned char) swf_htoi(s + 1); s += 2; } else dest[0] = s[0]; @@ -50,12 +60,12 @@ static void url_unescape(unsigned char * s) dest[0] = 0; } -static void cgienv(unsigned char * var) +static void swf_cgienv(unsigned char * var) { unsigned char *buf, *c, *s, *t, *oldval = NULL, *newval; int despace = 0, got_cr = 0; // fprintf(stderr,"%s\n",var); - url_unescape(var); + swf_url_unescape(var); // fprintf(stderr,"%s\n",var); @@ -119,14 +129,14 @@ static void cgienv(unsigned char * var) } } -static void scanquery(char * q) +static void swf_scanquery(char * q) { char *next = q; if (!q) return; while (next) { next = strchr(q, '&'); if (next) next[0] = 0; - cgienv(q); + swf_cgienv(q); if (next) { next[0] = '&'; q = next+1; @@ -134,7 +144,7 @@ static void scanquery(char * q) } } -char * postread() +char * swf_postread() { char * buf = NULL; int size = 0, sofar = 0, got; @@ -157,23 +167,24 @@ char * postread() return buf; } -void uncgi() +void swf_uncgi() { char *query, *dupquery, *method; query = getenv("QUERY_STRING"); if ((query) && strlen(query)) { dupquery = strdup(query); - scanquery(dupquery); + swf_scanquery(dupquery); free(dupquery); } method = getenv("REQUEST_METHOD"); if ((method) && ! strcmp(method, "POST")) - { query = postread(); - if ((query)&&(query[0]!=0)) scanquery(query); + { query = swf_postread(); + if ((query)&&(query[0]!=0)) swf_scanquery(query); free(query); } } #undef ishex +#undef PREFIX