diff --git a/iguana/iguana_html.c b/iguana/iguana_html.c index 31cbeee0f..6bc304e01 100755 --- a/iguana/iguana_html.c +++ b/iguana/iguana_html.c @@ -427,13 +427,13 @@ cJSON *SuperNET_urlconv(char *value,int32_t bufsize,char *urlstr) char *SuperNET_rpcparse(struct supernet_info *myinfo,char *retbuf,int32_t bufsize,int32_t *jsonflagp,int32_t *postflagp,char *urlstr,char *remoteaddr) { - cJSON *tokens,*argjson,*json = 0; char symbol[16],urlmethod[16],*data,url[1024],*retstr,*token = 0; int32_t i,j,n; - printf("rpcparse.(%s)\n",urlstr); + cJSON *tokens,*argjson,*json = 0; char symbol[16],buf[4096],urlmethod[16],*data,url[1024],*retstr,*token = 0; int32_t i,j,n; + //printf("rpcparse.(%s)\n",urlstr); for (i=0; i 1 ) - jaddstr(argjson,"method",jstri(tokens,1)); + { + if ( jstri(tokens,1) != 0 ) + { + char *key,*value; + strcpy(buf,jstri(tokens,1)); + key = value = 0; + i = 0; + for (; buf[i]!=0; i++) + { + if ( buf[i] == '?' ) + { + buf[i] = 0; + jaddstr(argjson,"method",buf); + i++; + key = &buf[i]; + break; + } + } + while ( buf[i] != 0 ) + { + //printf("iter.[%s]\n",&buf[i]); + if ( buf[i] != 0 && key != 0 ) + { + for (; buf[i]!=0; i++) + { + if ( buf[i] == '=' ) + { + buf[i] = 0; + i++; + //printf("got key.(%s)\n",key); + value = &buf[i]; + break; + } + } + if ( buf[i] != 0 && value != 0 ) + { + for (; buf[i]!=0; i++) + { + if ( buf[i] == '&' ) + { + buf[i] = 0; + jaddstr(argjson,key,value); + i++; + //printf("got value.(%s)\n",value); + value = 0; + key = &buf[i]; + break; + } + } + } + } + } + if ( key != 0 && value != 0 ) + jaddstr(argjson,key,value); + } else jaddstr(argjson,"method",buf); + } for (i=2; i