Is http server and http client possbile?
"racqueldesign" <[email protected]>
| Newsgroups | gmane.comp.hardware.rabbit-semiconductor |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I have a HTTP server running and the cgi is working fine.
I added http client and now the cgi is taking about 10 seconds to respond.
I think the cgi keeps the response to any HTTP REQUEST until the http client task is complete. My question is, how do I get the cgi to send the response(infomation in its buffer) immediately? I added a yield statement hoping to give control back to the http_handler but that didn't work. I am not sure why my cgi won't send response right-away. Do you guys have any advice?
while (1) {
costate {
http_handler();
}
costate {
yield; //GIVE CONTROL BACK TO http_handler(), cgi
retval = httpc_init (&hsock, sock);
if (retval)
{
printf ("error %d calling httpc_init()\n", retval);
}
retval = httpc_post( &hsock, DEST, 80, FILENAME, NULL, PostUpdate_Msg);
if(retval){
printf ("error %d calling httpc_post()\n", retval);
}
//Skip Header reading and only read body
httpc_skip_headers(&hsock); //skip header reading
do
{
retval = httpc_read_body( &hsock, PostResponse_msg, 128);
} while(hsock.state == HTTPC_STATE_BODY);
httpc_close(&hsock);
}
}