version 1.1, 2013/09/22 01:07:38 |
version 1.3, 2020/10/06 11:33:48 |
|
|
/* $OpenXM$ |
/* $OpenXM: OpenXM/src/kan96xx/trans/oxdecode_post.c,v 1.2 2013/09/22 02:38:25 takayama Exp $ |
Decompose a given multi-part post message to URL encoded one for cgi.sm1 |
Decompose a given multi-part post message to URL encoded one for cgi.sm1 |
*/ |
*/ |
|
|
Line 17 char *urlEncoding(char *s); |
|
Line 17 char *urlEncoding(char *s); |
|
int substr(char s[],int n,char a[]); |
int substr(char s[],int n,char a[]); |
char *byteArrayToUrlEncoding(unsigned char *s,int size); |
char *byteArrayToUrlEncoding(unsigned char *s,int size); |
int isUrlEncoding3(char s); |
int isUrlEncoding3(char s); |
main() { |
int main() { |
char *s; |
char *s; |
int i,j,limit,len; |
int i,j,limit,len; |
int c; |
int c; |
|
|
the index i of s[] so that &(s[i]) agrees with a. |
the index i of s[] so that &(s[i]) agrees with a. |
n is the size of s. |
n is the size of s. |
*/ |
*/ |
substr(char s[],int n,char a[]) { |
int substr(char s[],int n,char a[]) { |
int m,i,j; |
int m,i,j; |
m = strlen(a); |
m = strlen(a); |
for (i=0; i<= n-m; i++) { /*BUG(< --> <=). Make corrections for other use!*/ |
for (i=0; i<= n-m; i++) { /*BUG(< --> <=). Make corrections for other use!*/ |
Line 64 substr(char s[],int n,char a[]) { |
|
Line 64 substr(char s[],int n,char a[]) { |
|
} |
} |
|
|
/* bug, they should follow RFC */ |
/* bug, they should follow RFC */ |
multipart(char *s) { |
int multipart(char *s) { |
if ((strlen(s) > 3) && (strncmp(s,"---",3)==0)) return(1); |
if ((strlen(s) > 3) && (strncmp(s,"---",3)==0)) return(1); |
else return(0); |
else return(0); |
} |
} |
Line 92 char *urlEncoding(char *s) { |
|
Line 92 char *urlEncoding(char *s) { |
|
|
|
pos = pos2; |
pos = pos2; |
for (i=pos2; i<strlen(s); i++) { |
for (i=pos2; i<strlen(s); i++) { |
if ((s[i] == '\n') && (s[i+1] == '\n')) { |
if ((s[i] == '\n') && (s[i+1] == '\n')) { /* \n\n */ |
pos = i+2; break; |
pos = i+2; break; |
|
} |
|
if ((s[i] == 0xd) && (s[i+1] == '\n') && (s[i+2] == 0xd) && (s[i+3] == '\n')) { /* 0d, 0x */ |
|
pos = i+4; break; |
} |
} |
} |
} |
pos2 = pos-1; |
pos2 = pos-1; |