mirror of
https://github.com/lxsang/ant-http
synced 2024-12-25 16:28:21 +01:00
fix cookie problem
This commit is contained in:
parent
e632e29302
commit
fc6d64cf7f
BIN
build/htdocs/.DS_Store
vendored
BIN
build/htdocs/.DS_Store
vendored
Binary file not shown.
BIN
build/htdocs/scripts/.DS_Store
vendored
BIN
build/htdocs/scripts/.DS_Store
vendored
Binary file not shown.
@ -137,11 +137,11 @@ void cat(int client, FILE *resource)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
fgets(buf, sizeof(buf), resource);
|
||||
while (!feof(resource))
|
||||
//fgets(buf, sizeof(buf), resource);
|
||||
while (fgets(buf, sizeof(buf), resource) != NULL)
|
||||
{
|
||||
send(client, buf, strlen(buf), 0);
|
||||
fgets(buf, sizeof(buf), resource);
|
||||
//fgets(buf, sizeof(buf), resource);
|
||||
}
|
||||
|
||||
|
||||
|
@ -196,17 +196,21 @@ dictionary decode_cookie(const char* line)
|
||||
{
|
||||
char *token,*token1;
|
||||
char *cpstr = strdup(line);
|
||||
trim(cpstr,' ');
|
||||
trim(cpstr,'\n');
|
||||
trim(cpstr,'\r');
|
||||
//printf("FUCKIT %s\n",cpstr );
|
||||
dictionary dic = NULL;
|
||||
while((token = strsep(&cpstr,";")))
|
||||
{
|
||||
trim(token,' ');
|
||||
token1 = strsep(&token,"=");
|
||||
if(token1)
|
||||
{
|
||||
if(dic == NULL)
|
||||
dic = dict();
|
||||
LOG("Found cookie : %s = %s\n",token1,token);
|
||||
trim(token1,' ');
|
||||
dput(dic,token1,token);
|
||||
//LOG("Found cookie : %s = %s\n",token1,token);
|
||||
dput(dic,token1,strdup(token));
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
@ -200,12 +200,13 @@ int __f(int client, const char* file)
|
||||
LOG("Cannot read : %s\n", file);
|
||||
return 0;
|
||||
}
|
||||
fgets(buf, sizeof(buf), ptr);
|
||||
while(!feof(ptr))
|
||||
;
|
||||
while(fgets(buf, sizeof(buf), ptr) != NULL)
|
||||
{
|
||||
nbytes = send(client, buf, strlen(buf), 0);
|
||||
if(nbytes == -1) return 0;
|
||||
fgets(buf, sizeof(buf), ptr);
|
||||
//LOG("READ : %s\n", buf);
|
||||
//fgets(buf, sizeof(buf), ptr);
|
||||
}
|
||||
fclose(ptr);
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user