version 1.2, 2004/09/24 08:35:47 |
version 1.6, 2004/09/28 12:27:17 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/plugin/oxcgi.c,v 1.1 2004/09/21 12:52:01 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/plugin/oxcgi.c,v 1.5 2004/09/28 12:20:40 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include "datatype.h" |
#include "datatype.h" |
#include "stackm.h" |
#include "stackm.h" |
Line 35 struct object cgiUrlEncodingToKeyValuePair(char *s) { |
|
Line 35 struct object cgiUrlEncodingToKeyValuePair(char *s) { |
|
for (i=0; i<n; i++) { |
for (i=0; i<n; i++) { |
if (s[i] == '?') { start=i+1; break;} |
if (s[i] == '?') { start=i+1; break;} |
} |
} |
|
if (start == -1) { |
|
start = 0; |
|
for (i=0; i<n; i++) { |
|
if (s[i] > ' ') { start = i; break; } |
|
} |
|
} |
for (k=0; k<2; k++) { |
for (k=0; k<2; k++) { |
/* k==0 path one. Count nOfPairs. */ |
/* k==0 path one. Count nOfPairs. */ |
/* k==1 path two. generate array. */ |
/* k==1 path two. generate array. */ |
Line 521 struct object cgiKeyValuePairToHttpString(struct objec |
|
Line 527 struct object cgiKeyValuePairToHttpString(struct objec |
|
return KpoString(s); |
return KpoString(s); |
} |
} |
|
|
|
struct object KooStringToUrlEncoding(struct object sob) { |
|
unsigned char *s; |
|
char *rs; |
|
int n; |
|
if (sob.tag == Sdollar) { |
|
s = (unsigned char *) KopString(sob); |
|
n = strlen((char *)s); |
|
}else if (sob.tag == SbyteArray) { |
|
s = KopByteArray(sob); |
|
n = getByteArraySize(sob); |
|
}else errorKan1("%s\n","KooStringToUrlEncoding: argument must be a string or a bytearray."); |
|
rs = byteArrayToUrlEncoding(s,n); |
|
return KpoString(rs); |
|
} |
|
|
|
struct object KooUrlEncodedStringToObj(struct object sob) { |
|
char *s; |
|
int n; |
|
if (sob.tag == Sdollar) { |
|
s = KopString(sob); |
|
n = strlen((char *)s); |
|
}else if (sob.tag == SbyteArray) { |
|
s = KopByteArray(sob); |
|
n = getByteArraySize(sob); |
|
}else errorKan1("%s\n","KooUrlEncodedStringToObj: argument must be a string."); |
|
return urlEncodedStringToObj(s,0,n-1,0); |
|
} |