version 1.8, 2005/02/27 05:28:06 |
version 1.10, 2005/07/03 11:08:54 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/plugin/oxcgi.c,v 1.7 2004/11/23 01:37:47 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/plugin/oxcgi.c,v 1.9 2005/06/16 05:07:24 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
|
#include <stdlib.h> |
|
#include <string.h> |
#include "datatype.h" |
#include "datatype.h" |
#include "stackm.h" |
#include "stackm.h" |
#include "extern.h" |
#include "extern.h" |
Line 28 struct object cgiUrlEncodingToKeyValuePair(char *s) { |
|
Line 30 struct object cgiUrlEncodingToKeyValuePair(char *s) { |
|
int vstart,vend; /* start of value, end of value */ |
int vstart,vend; /* start of value, end of value */ |
int state; |
int state; |
int nOfPairs; |
int nOfPairs; |
struct object rob; |
struct object rob = OINIT; |
struct object ob; |
struct object ob = OINIT; |
int k; |
int k; |
n = strlen(s); start = -1; |
n = strlen(s); start = -1; |
for (i=0; i<n; i++) { |
for (i=0; i<n; i++) { |
Line 180 struct object urlEncodedStringToObj(char *s,int vstart |
|
Line 182 struct object urlEncodedStringToObj(char *s,int vstart |
|
[ not implemented yet. ] |
[ not implemented yet. ] |
*/ |
*/ |
{ |
{ |
struct object rob; |
struct object rob = OINIT; |
char *ts; |
char *ts; |
char *ts2; |
char *ts2; |
int i,j; |
int i,j; |
Line 241 static test1() { |
|
Line 243 static test1() { |
|
} |
} |
static test2() { |
static test2() { |
char s[1000]; |
char s[1000]; |
struct object ob; |
struct object ob = OINIT; |
ob=cgiUrlEncodingToKeyValuePair("http://hoge.hoge?name=1231232&hoge=asdfsdf&foo=asdfasdf"); |
ob=cgiUrlEncodingToKeyValuePair("http://hoge.hoge?name=1231232&hoge=asdfsdf&foo=asdfasdf"); |
printObject(ob,1,stdout); |
printObject(ob,1,stdout); |
ob=cgiUrlEncodingToKeyValuePair("http://hoge.hoge?name=1231232&hoge=&foo=asdfasdf&hoge=A%41+%42%62y%21"); |
ob=cgiUrlEncodingToKeyValuePair("http://hoge.hoge?name=1231232&hoge=&foo=asdfasdf&hoge=A%41+%42%62y%21"); |
Line 253 static test2() { |
|
Line 255 static test2() { |
|
|
|
static test4() { |
static test4() { |
char s[1000]; |
char s[1000]; |
struct object ob; |
struct object ob = OINIT; |
char *ts; |
char *ts; |
int size; |
int size; |
ob=cgiUrlEncodingToKeyValuePair("http://hoge.hoge?name=1231232&hoge=&foo=asdfasdf&hoge=A%41+%42%62y%21"); |
ob=cgiUrlEncodingToKeyValuePair("http://hoge.hoge?name=1231232&hoge=&foo=asdfasdf&hoge=A%41+%42%62y%21"); |
Line 283 char *cgiKeyValuePairToUrlEncoding(struct object ob) { |
|
Line 285 char *cgiKeyValuePairToUrlEncoding(struct object ob) { |
|
} |
} |
int checkKeyValuePairFormat(struct object ob,char *msg) { |
int checkKeyValuePairFormat(struct object ob,char *msg) { |
int i,n; |
int i,n; |
struct object eob,eob0,eob1; |
struct object eob = OINIT; |
|
struct object eob0 = OINIT; |
|
struct object eob1 = OINIT; |
static char *fmt = NULL; |
static char *fmt = NULL; |
int size; |
int size; |
char *ss; |
char *ss; |
Line 309 int checkKeyValuePairFormat(struct object ob,char *msg |
|
Line 313 int checkKeyValuePairFormat(struct object ob,char *msg |
|
|
|
int cgiKeyValuePairToUrlEncodingFile2(struct object ob,FILE2 *fp) { |
int cgiKeyValuePairToUrlEncodingFile2(struct object ob,FILE2 *fp) { |
int n,i; |
int n,i; |
struct object eob,eob0,eob1; |
struct object eob = OINIT; |
|
struct object eob0 = OINIT; |
|
struct object eob1 = OINIT; |
char *key, *s; |
char *key, *s; |
checkKeyValuePairFormat(ob,"cgiKeyValuePairToUrlEncodingFile2"); |
checkKeyValuePairFormat(ob,"cgiKeyValuePairToUrlEncodingFile2"); |
n = getoaSize(ob); |
n = getoaSize(ob); |
Line 340 int cgiKeyValuePairToUrlEncodingFile2(struct object ob |
|
Line 346 int cgiKeyValuePairToUrlEncodingFile2(struct object ob |
|
|
|
static struct object rStringToObj(char *s,int vstart,int vend,int mode) { |
static struct object rStringToObj(char *s,int vstart,int vend,int mode) { |
/* mode has not yet been used. */ |
/* mode has not yet been used. */ |
struct object rob; |
struct object rob = OINIT; |
char *sss; int i; |
char *sss; int i; |
int bytearray; |
int bytearray; |
bytearray=0; |
bytearray=0; |
Line 372 struct object cgiHttpToKeyValuePair(char *s,int size) |
|
Line 378 struct object cgiHttpToKeyValuePair(char *s,int size) |
|
int ssize,i,j,k; |
int ssize,i,j,k; |
int nOfPairs, startbody,state, kstart,kend,vstart, vend,startline,endline; |
int nOfPairs, startbody,state, kstart,kend,vstart, vend,startline,endline; |
int nextstart,path; |
int nextstart,path; |
struct object rob,ob; |
struct object rob = OINIT; |
|
struct object ob = OINIT; |
ssize = strlen(s); |
ssize = strlen(s); |
nOfPairs = 0; startbody = -1; |
nOfPairs = 0; startbody = -1; |
/* state==0 : readline and set startline and endline; state = 1; |
/* state==0 : readline and set startline and endline; state = 1; |
Line 455 char *cgiKeyValuePairToHttp(struct object ob,int *size |
|
Line 462 char *cgiKeyValuePairToHttp(struct object ob,int *size |
|
|
|
int cgiKeyValuePairToHttpFile2(struct object ob,FILE2 *fp) { |
int cgiKeyValuePairToHttpFile2(struct object ob,FILE2 *fp) { |
int n,i; |
int n,i; |
struct object eob,eob0,eob1; |
struct object eob = OINIT; |
|
struct object eob0 = OINIT; |
|
struct object eob1 = OINIT; |
char *key, *s; |
char *key, *s; |
checkKeyValuePairFormat(ob,"cgiKeyValuePairToHttpFile2"); |
checkKeyValuePairFormat(ob,"cgiKeyValuePairToHttpFile2"); |
n = getoaSize(ob); |
n = getoaSize(ob); |
Line 491 int cgiKeyValuePairToHttpFile2(struct object ob,FILE2 |
|
Line 500 int cgiKeyValuePairToHttpFile2(struct object ob,FILE2 |
|
|
|
static test3() { |
static test3() { |
char *s; |
char *s; |
struct object ob; |
struct object ob = OINIT; |
s = "Pragma: no-cache\nContent-Length: 2915\nContent-Type: text/html\nConnection: close\n\n <DIV class=Section1> \n <P class=MsoNormal \n style=\"mso-list: none; mso-list-ins: \" 19991102T2025\"> \n </P> "; |
s = "Pragma: no-cache\nContent-Length: 2915\nContent-Type: text/html\nConnection: close\n\n <DIV class=Section1> \n <P class=MsoNormal \n style=\"mso-list: none; mso-list-ins: \" 19991102T2025\"> \n </P> "; |
|
|
ob=cgiHttpToKeyValuePair(s,strlen(s)); |
ob=cgiHttpToKeyValuePair(s,strlen(s)); |
Line 558 static struct object toTokens(char *s,int *sep,int nse |
|
Line 567 static struct object toTokens(char *s,int *sep,int nse |
|
/* s is the input, and sep are the separators. */ |
/* s is the input, and sep are the separators. */ |
/* -1 means <=' ' are separators */ |
/* -1 means <=' ' are separators */ |
int nOfTokens,n,i,done,k,start,sav; |
int nOfTokens,n,i,done,k,start,sav; |
struct object rob; |
struct object rob = OINIT; |
char *t; |
char *t; |
|
|
rob = NullObject; |
rob = NullObject; |