|
发表于 2009-9-12 10:11:57
|
显示全部楼层
请问如何使我的图2显示出我输入的内容?处理程序在这
/* This function processes an incomming connection. */
static void process_connection(struct netconn *conn)
{
struct netbuf *inbuf;
char *rq;
int len;
portCHAR *ptr,buf[100],value[20];
/* Read data from the connection into the netbuf inbuf.
We assume that the full request is in the netbuf. */
inbuf = netconn_recv(conn);
/* Get the pointer to the data in the first netbuf
fragment which we hope contains the request. */
netbuf_data(inbuf, &rq, &len);
/* Check if the request was an HTTP "GET /\r\n". */
if(rq[0] == 'G' && rq[1] == 'E' &&
rq[2] == 'T' && rq[3] == ' ' &&
rq[4] == '/' )
{
/* Send the header. */
netconn_write(conn, http_html_hdr, sizeof(http_html_hdr),NETCONN_NOCOPY);
/* Send the actual web page. */
netconn_write(conn, indexdata, sizeof(indexdata), NETCONN_NOCOPY);
}
else if(rq[0] == 'P' && rq[1] == 'O' &&
rq[2] == 'S' && rq[3] == 'T')
{
ptr=inbuf->p->payload;
while(*ptr != '&') ptr++;
memset(buf,'\0',100);
int i=0;
int j=strlen(ptr);
while(j)
{
if(*ptr=='=')
{
buf=':';
}
else if(*ptr=='&')
{
buf=' ';
}
else
{
buf=*ptr;
}
i++;
ptr++;
j--;
}
//strncpy(buf, ptr, strlen(ptr)-16);
/* Send the header. */
netconn_write(conn, http_html_hdr, sizeof(http_html_hdr),NETCONN_NOCOPY);
/* Send the actual web page. */
// netconn_write(conn, webHTML_START, sizeof(webHTML_START), NETCONN_NOCOPY);
netconn_write(conn, buf, sizeof(buf), NETCONN_NOCOPY);
// netconn_write(conn, webHTML_END, sizeof(webHTML_END), NETCONN_NOCOPY);
}
/* Close the connection. */
// netbuf_delete( inbuf );
netconn_close(conn);
} |
|