資源簡介
嵌入式liunx下,基于boa,cgi的ajax 表單異步提交demo。
代碼片段和文件信息
/*?cgicTempDir?is?the?only?setting?you?are?likely?to?need
to?change?in?this?file.?*/
/*?Used?only?in?Unix?environments?in?conjunction?with?mkstemp().?
Elsewhere?(Windows)?temporary?files?go?where?the?tmpnam()?
function?suggests.?If?this?behavior?does?not?work?for?you?
modify?the?getTempFileName()?function?to?suit?your?needs.?*/
#define?cgicTempDir?“/tmp“
#if?CGICDEBUG
#define?CGICDEBUGSTART?\
{?\
FILE?*dout;?\
dout?=?fopen(“/home/boutell/public_html/debug“?“a“);?\
#define?CGICDEBUGEND?\
fclose(dout);?\
}
#else?/*?CGICDEBUG?*/
#define?CGICDEBUGSTART
#define?CGICDEBUGEND
#endif?/*?CGICDEBUG?*/
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#ifdef?WIN32
#include?
/*?cgic?2.01?*/
#include?
#else
#include?
#endif?/*?WIN32?*/
#include?“cgic.h“
#define?cgiStrEq(a?b)?(!strcmp((a)?(b)))
char?*cgiServerSoftware;
char?*cgiServerName;
char?*cgiGatewayInterface;
char?*cgiServerProtocol;
char?*cgiServerPort;
char?*cgiRequestMethod;
char?*cgiPathInfo;
char?*cgiPathTranslated;
char?*cgiscriptName;
char?*cgiQueryString;
char?*cgiRemoteHost;
char?*cgiRemoteAddr;
char?*cgiAuthType;
char?*cgiRemoteUser;
char?*cgiRemoteIdent;
char?cgiContentTypeData[1024];
char?*cgiContentType?=?cgiContentTypeData;
char?*cgiMultipartBoundary;
char?*cgiCookie;
int?cgiContentLength;
char?*cgiAccept;
char?*cgiUserAgent;
char?*cgiReferrer;
FILE?*cgiIn;
FILE?*cgiOut;
/*?True?if?CGI?environment?was?restored?from?a?file.?*/
static?int?cgiRestored?=?0;
static?void?cgiGetenv(char?**s?char?*var);
typedef?enum?{
cgiParseSuccess
cgiParseMemory
cgiParseIO
}?cgiParseResultType;
/*?One?form?entry?consisting?of?an?attribute-value?pair
and?an?optional?filename?and?content?type.?All?of
these?are?guaranteed?to?be?valid?null-terminated?strings
which?will?be?of?length?zero?in?the?event?that?the
field?is?not?present?with?the?exception?of?tfileName
which?will?be?null?when?‘in‘?is?null.?DO?NOT?MODIFY?THESE?
VALUES.?Make?local?copies?if?modifications?are?desired.?*/
typedef?struct?cgiFormEntryStruct?{
char?*attr;
/*?value?is?populated?for?regular?form?fields?only.
For?file?uploads?it?points?to?an?empty?string?and?file
upload?data?should?be?read?from?the?file?tfileName.?*/?
char?*value;
/*?When?fileName?is?not?an?empty?string?tfileName?is?not?null
and?‘value‘?points?to?an?empty?string.?*/
/*?Valid?for?both?files?and?regular?fields;?does?not?include
terminating?null?of?regular?fields.?*/
int?valueLength;
char?*fileName;
char?*contentType;
/*?Temporary?file?name?for?working?storage?of?file?uploads.?*/
char?*tfileName;
????????struct?cgiFormEntryStruct?*next;
}?cgiFormEntry;
/*?The?first?form?entry.?*/
static?cgiFormEntry?*cgiFormEntryFirst;
static?cgiParseResultType?cgiParseGetFormInput();
static?cgiParseResultType?cgiParsePostFormInput();
static?cgiParseResultType?cgiParsePostMultipartInput();
static?cgiParseResultType?
- 上一篇:組態王在樓宇監控的應用
- 下一篇:DDS的FPGA實現
評論
共有 條評論