-void ReadPostData(void)
+int ReadPostData(void)
{
+ int rc;
int body_start = 0;
wcsession *WCC = WC;
StrBuf *content = NULL;
body_start = StrLength(content);
/** Read the entire input data at once. */
- client_read_to(WCC->Hdr, content,
- WCC->Hdr->HR.ContentLength,
- SLEEPING);
+ rc = client_read_to(WCC->Hdr, content,
+ WCC->Hdr->HR.ContentLength,
+ SLEEPING);
+ if (rc < 0)
+ return rc;
+
if (!strncasecmp(ChrPtr(WCC->Hdr->HR.ContentType), "application/x-www-form-urlencoded", 33)) {
StrBufCutLeft(content, body_start);
content = NULL;
}
FreeStrBuf(&content);
+ return 1;
}
* so we can use them to reconnect a timed out session if we have to.
*/
wcsession *WCC;
-
-
- Buf = NewStrBuf();
-
+
WCC= WC;
-
WCC->upload_length = 0;
WCC->upload = NULL;
WCC->is_mobile = 0;
- WCC->trailing_javascript = NewStrBuf();
WCC->Hdr->nWildfireHeaders = 0;
if (WCC->Hdr->HR.Handler != NULL)
Flags = WCC->Hdr->HR.Handler->Flags; /* so we can temporarily add our own... */
if (WCC->Hdr->HR.ContentLength > 0) {
- ReadPostData();
+ if (ReadPostData() < 0) {
+ return;
+ }
}
+ Buf = NewStrBuf();
+ WCC->trailing_javascript = NewStrBuf();
+
/* If there are variables in the URL, we must grab them now */
if (WCC->Hdr->PlainArgs != NULL)
ParseURLParams(WCC->Hdr->PlainArgs);