|
@@ -788,7 +788,6 @@ static void readEvent(Webs *wp)
|
|
|
return;
|
|
|
}
|
|
|
websNoteRequestActivity(wp);
|
|
|
-
|
|
|
rxbuf = &wp->rxbuf; //存储的是请求包中的所有数据 18432 //缓冲区的数据结构
|
|
|
// printf("%d>>>>>>>>0000>>>>%d>>>\n",rxbuf->buflen, bufRoom(rxbuf));
|
|
|
if (bufRoom(rxbuf) < (ME_GOAHEAD_LIMIT_BUFFER+1)) { //缓冲区不够了增加缓冲区的大小
|
|
@@ -823,6 +822,7 @@ static void readEvent(Webs *wp)
|
|
|
return;//通过websPump处理完请求,需要关闭连接,return返回readEvent.数据结构依然保留。
|
|
|
} else if (nbytes < 0 && socketEof(wp->sid)) {
|
|
|
/* EOF or error. Allow running requests to continue. */
|
|
|
+ // printf("%d>>>>>>>>>state>>>>>>>>>>>\n", wp->state);
|
|
|
//state 值是1
|
|
|
if (wp->state < WEBS_READY) {//ready 2
|
|
|
if (wp->state > WEBS_BEGIN) {//begin 0
|
|
@@ -846,7 +846,6 @@ PUBLIC void websPump(Webs *wp)
|
|
|
bool canProceed;
|
|
|
|
|
|
for (canProceed = 1; canProceed; ) {
|
|
|
- printf("wp->state = %d\n",wp->state);
|
|
|
switch (wp->state) {
|
|
|
case WEBS_BEGIN:
|
|
|
canProceed = parseIncoming(wp);
|
|
@@ -856,6 +855,7 @@ PUBLIC void websPump(Webs *wp)
|
|
|
break;
|
|
|
case WEBS_READY:
|
|
|
if (!websRunRequest(wp)) {
|
|
|
+ // printf("%d<<<<<<<<<<<<>>>>>>>>>*******\n", WEBS_READY);
|
|
|
/* Reroute if the handler re-wrote the request */
|
|
|
websRouteRequest(wp);
|
|
|
wp->state = WEBS_READY;
|
|
@@ -1120,6 +1120,7 @@ static void parseHeaders(Webs *wp)
|
|
|
} else if (strcmp(key, "content-type") == 0) {
|
|
|
wfree(wp->contentType);
|
|
|
wp->contentType = sclone(value);
|
|
|
+// printf("%s>>>>>>>>>>>>>>>wp->contentType>>>>>\n", wp->contentType);
|
|
|
if (strstr(value, "application/x-www-form-urlencoded")) {
|
|
|
wp->flags |= WEBS_FORM;
|
|
|
} else if (strstr(value, "application/json")) {
|
|
@@ -1329,6 +1330,7 @@ static bool filterChunkData(Webs *wp)
|
|
|
nbytes = min(bufRoom(&wp->input), len);
|
|
|
// printf("---> bufPutBlk2 len = %d\n", len);
|
|
|
if (len > 0 && (nbytes = bufPutBlk(&wp->input, rxbuf->servp, nbytes)) == 0) {
|
|
|
+ printf("<<<<<<<<<<<<<<>>42222>>>>>>>>>>>>\n" );
|
|
|
websError(wp, HTTP_CODE_REQUEST_TOO_LARGE | WEBS_CLOSE, "Too big");
|
|
|
return 1;
|
|
|
}
|
|
@@ -1666,16 +1668,13 @@ PUBLIC void websRedirect(Webs *wp, char *uri)
|
|
|
port = secure ? defaultSslPort : defaultHttpPort;
|
|
|
}
|
|
|
if (strstr(uri, "https:///")) {
|
|
|
- printf("---> log1\n");
|
|
|
/* Short-hand for redirect to https */
|
|
|
uri = location = makeUri(scheme, hostbuf, port, &uri[8]);
|
|
|
|
|
|
} else if (strstr(uri, "http:///")) {
|
|
|
- printf("---> log2\n");
|
|
|
uri = location = makeUri(scheme, hostbuf, port, &uri[7]);
|
|
|
|
|
|
} else if (!fullyQualified) {
|
|
|
- printf("---> log3\n");
|
|
|
uri = location = makeUri(scheme, hostbuf, port, uri);
|
|
|
}
|
|
|
message = sfmt("<html><head></head><body>\r\n\
|
|
@@ -1683,7 +1682,6 @@ PUBLIC void websRedirect(Webs *wp, char *uri)
|
|
|
Please update your documents to reflect the new location.\r\n\
|
|
|
</body></html>\r\n", uri);
|
|
|
len = slen(message);
|
|
|
- printf("---> message: %s\n", message);
|
|
|
websSetStatus(wp, HTTP_CODE_MOVED_TEMPORARILY);
|
|
|
websWriteHeaders(wp, len + 2, uri);
|
|
|
websWriteEndHeaders(wp);
|