- 论坛徽章:
- 0
|
我是在uclinux下使用的boa,但是在测试cookie的时候,返回的HTTP-COOKIE总是NULL,为什么啊?
程序如下(也是参考网络上的,可是大家解决了也不分享一下,我还是遇到这个问题 ):
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "cgic.h"
int cgiMain()
{
char username[25]= "uuuu ";
char pass[25] = "123 ";
printf( "Set-Cookie: username=%s; path=/\r\n ", username);
printf( "Set-Cookie: password=%s; path=/\r\n ", pass);
cgiHeaderContentType( "text/html ";
printf( " <a href=test2> 1111 </a> ";
return 0;
}
test2
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "cgic.h"
int cgiMain()
{
cgiHeaderContentType( "text/html ";
printf( "Cookie:%s\n ",getenv( "HTTP-COOKIE ");
return 0;
} |
|