歡迎您光臨本站 註冊首頁

求助boa伺服器!!!????

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

求助boa伺服器!!!????

我在uclinux中用了boa伺服器,為什麼用post沒有反映,文件系統是romfs,在/var下有ext2(ramdisk),幫幫我,怎麼改好

我在boa上編寫cgi程序,用到了post,如下
title>密碼保護</title>
<center>
<H1>美麗寶島站</H1>
<HR>
<FORM METHOD="OST" "ACTION="/home/web/cgi-bin/password">
會員姓名<input type="text" name="name"><p>
輸入密碼<input type="password" name="passwd" value="********"><p>
<input type="submit" value="輸入">
<input type="reset" value="清除">
</FROM>
</center>

在按輸入時沒有響應,網頁上地址還是192.168.111.100(原來的),怎麼回事,boa不支持post嗎?

cgi程序
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

typedef struct
{
char *name;
char *val;
}input;

char *ReadStdin(FILE *f,char stop,int *len);
void AddToSpace(char *str);
void Convert(char *url);
char *ReadData(char *line,char stop);
char ConvertToHex(char *change);

main()
{
input inputs;
int i,m=0;
int len;
FILE *fp;
char s;

printf("Content-type:text/html\n\n";
len=atoi(getenv("CONTENT_LENGTH");
for(i=0;len&&(!feof(stdin));i++)
{
m=i;
inputs.val=ReadStdin(stdin,'&',&len);
AddToSpace(inputs.val);
Convert(inputs.val);
inputs.name=ReadData(inputs.val,'=');
}

if(strcmp(inputs.val,"qq"==0&&strcmp(inputs.val,"aa"==0)
{
printf("<title>netword</title>\n";
printf("<H1>welcome %s</H1>\n",inputs.val);
fp=fopen("/home/web/html/wecome.html","r";
if(fp==NULL)
exit(1);
while((fgets(s,255,fp))!=NULL)
printf("%s\n",s);
}
else
{
printf("<title>error</title>\n";
printf("<H1>error</H1>\n";
printf("<H1>restart</H1>\n";
}
}


char *ReadStdin(FILE *f,char stop,int *len)
{
int wsize;
char *word;
int x;
wsize=2048;
x=0;
word=(char*)malloc(sizeof(char)*(wsize+1));
while(1)
{
word=(char)fgetc(f);
if(x==wsize)
{
word='\0';
wsize+=2048;
word=(char*)realloc(word,sizeof(char)*(wsize+1));
}
--(*len);
if((word==stop)||(feof(f))||(!(*len)))
{
if(word!=stop)
x++;
word='\0';
return word;
}
++x;
}
}


char *ReadData(char *line,char stop)
{
int i=0,j;
char *word;

word=(char*)malloc(sizeof(char)*(strlen(line)+1));
for(i=0;(line&&(line!=stop));i++)
word=line;
word='\0';
if(line)
i++;
j=0;
while(line=line);
return word;
}

char ConvertToHex(char *change)
{
char hexdigit;
hexdigit=(change>='A'?((change&0xdf)-'A')+10change-'0'));
hexdigit*=16;
hexdigit+=(change>='A'?((change&0xdf)-'A')+10change-'0'));
return hexdigit;
}

void Convert(char *data)
{
int i,j;
for(i=0,j=0;data;++i,++j)
{
if((data=data)=='%')
{
data=ConvertToHex(&data);
j+=2;
}
}
data='\0';
}

void AddToSpace(char *str)
{
int i;
for(i=0;str;i++)
if(str=='+')
str=' ';
}
《解決方案》

回復 #1 soqsoq 的帖子

method="ost"
樓主這樣post么

[火星人 ] 求助boa伺服器!!!????已經有474次圍觀

http://coctec.com/docs/service/show-post-30489.html