|
@@ -579,7 +579,7 @@ PUBLIC void websDone(Webs *wp)
|
|
|
logRequest(wp, wp->code);
|
|
|
#endif
|
|
|
if (!(wp->flags & WEBS_RESPONSE_TRACED)) {
|
|
|
- trace(3 | WEBS_RAW_MSG, "Request complete: code %d", wp->code);
|
|
|
+ printf("Request complete: code %d", wp->code);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -593,10 +593,10 @@ static int complete(Webs *wp, int reuse)
|
|
|
if (reuse && wp->flags & WEBS_KEEP_ALIVE && wp->rxRemaining == 0) {
|
|
|
reuseConn(wp);
|
|
|
socketCreateHandler(wp->sid, SOCKET_READABLE, socketEvent, wp);
|
|
|
- trace(5, "Keep connection alive");
|
|
|
+ printf( "Keep connection alive");
|
|
|
return 1;
|
|
|
}
|
|
|
- trace(5, "Close connection");
|
|
|
+ printf("Close connection");
|
|
|
wp->state = WEBS_BEGIN;
|
|
|
wp->flags |= WEBS_CLOSED;
|
|
|
return 0;
|
|
@@ -707,12 +707,12 @@ PUBLIC int websAccept(int sid, char *ipaddr, int port, int listenSid)
|
|
|
Arrange for socketEvent to be called when read data is available
|
|
|
*/
|
|
|
lp = socketPtr(listenSid);
|
|
|
- trace(4, "New connection from %s:%d to %s:%d", ipaddr, port, wp->ifaddr, lp->port);
|
|
|
+ printf( "New connection from %s:%d to %s:%d", ipaddr, port, wp->ifaddr, lp->port);
|
|
|
|
|
|
#if ME_COM_SSL
|
|
|
if (lp->secure) {
|
|
|
wp->flags |= WEBS_SECURE;
|
|
|
- trace(4, "Upgrade connection to TLS");
|
|
|
+ printf( "Upgrade connection to TLS");
|
|
|
if (sslUpgrade(wp) < 0) {
|
|
|
error("Cannot upgrade to TLS");
|
|
|
return -1;
|
|
@@ -896,10 +896,10 @@ static bool parseIncoming(Webs *wp)
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
- trace(3 | WEBS_RAW_MSG, "\n<<< Request\n");
|
|
|
+ printf("\n<<< Request\n");
|
|
|
c = *end;
|
|
|
*end = '\0';
|
|
|
- trace(3 | WEBS_RAW_MSG, "%s\n", wp->rxbuf.servp);
|
|
|
+ printf( "%s\n", wp->rxbuf.servp);
|
|
|
*end = c;
|
|
|
|
|
|
/*
|
|
@@ -981,7 +981,7 @@ static void parseFirstLine(Webs *wp)
|
|
|
}
|
|
|
protoVer = getToken(wp, "\r\n");
|
|
|
if (websGetLogLevel() == 2) {
|
|
|
- trace(2, "%s %s %s", wp->method, url, protoVer);
|
|
|
+ printf("%s %s %s", wp->method, url, protoVer);
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -1324,7 +1324,7 @@ static bool filterChunkData(Webs *wp)
|
|
|
wp->eof = 1;
|
|
|
return 1;
|
|
|
}
|
|
|
- trace(7, "chunkFilter: start incoming chunk of %d bytes", chunkSize);
|
|
|
+ printf( "chunkFilter: start incoming chunk of %d bytes", chunkSize);
|
|
|
wp->rxChunkState = WEBS_CHUNK_DATA;
|
|
|
break;
|
|
|
|
|
@@ -1796,7 +1796,7 @@ PUBLIC int websWriteHeader(Webs *wp, char *key, char *fmt, ...)
|
|
|
|
|
|
if (!(wp->flags & WEBS_RESPONSE_TRACED)) {
|
|
|
wp->flags |= WEBS_RESPONSE_TRACED;
|
|
|
- trace(3 | WEBS_RAW_MSG, "\n>>> Response\n");
|
|
|
+ printf( "\n>>> Response\n");
|
|
|
}
|
|
|
if (key) {
|
|
|
if (websWriteBlock(wp, key, strlen(key)) < 0) {
|
|
@@ -1805,7 +1805,7 @@ PUBLIC int websWriteHeader(Webs *wp, char *key, char *fmt, ...)
|
|
|
if (websWriteBlock(wp, ": ", 2) < 0) {
|
|
|
return -1;
|
|
|
}
|
|
|
- trace(3 | WEBS_RAW_MSG, "%s: ", key);
|
|
|
+ printf("%s: ", key);
|
|
|
}
|
|
|
if (fmt) {
|
|
|
va_start(vargs, fmt);
|
|
@@ -1815,7 +1815,7 @@ PUBLIC int websWriteHeader(Webs *wp, char *key, char *fmt, ...)
|
|
|
}
|
|
|
va_end(vargs);
|
|
|
assert(strstr(buf, "UNION") == 0);
|
|
|
- trace(3 | WEBS_RAW_MSG, "%s", buf);
|
|
|
+ printf("%s", buf);
|
|
|
if (websWriteBlock(wp, buf, strlen(buf)) < 0) {
|
|
|
return -1;
|
|
|
}
|
|
@@ -1824,7 +1824,7 @@ PUBLIC int websWriteHeader(Webs *wp, char *key, char *fmt, ...)
|
|
|
return -1;
|
|
|
}
|
|
|
}
|
|
|
- trace(3 | WEBS_RAW_MSG, "\r\n");
|
|
|
+ printf("\r\n");
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -2079,15 +2079,15 @@ PUBLIC int websFlush(Webs *wp, bool block)
|
|
|
}
|
|
|
op = &wp->output;
|
|
|
if (wp->flags & WEBS_CHUNKING) {
|
|
|
- trace(6, "websFlush chunking finalized %d", wp->finalized);
|
|
|
+ printf("websFlush chunking finalized %d", wp->finalized);
|
|
|
if (flushChunkData(wp) && wp->finalized) {
|
|
|
- trace(6, "websFlush: write chunk trailer");
|
|
|
+ printf("websFlush: write chunk trailer");
|
|
|
bufPutStr(op, "\r\n0\r\n\r\n");
|
|
|
bufAddNull(op);
|
|
|
wp->flags &= ~WEBS_CHUNKING;
|
|
|
}
|
|
|
}
|
|
|
- trace(6, "websFlush: buflen %d", bufLen(op));
|
|
|
+ printf( "websFlush: buflen %d", bufLen(op));
|
|
|
written = 0;
|
|
|
while ((nbytes = bufLen(op)) > 0) {
|
|
|
if ((written = websWriteSocket(wp, op->servp, nbytes)) < 0) {
|
|
@@ -2107,7 +2107,7 @@ PUBLIC int websFlush(Webs *wp, bool block)
|
|
|
} else if (written == 0) {
|
|
|
break;
|
|
|
}
|
|
|
- trace(6, "websFlush: wrote %d to socket", written);
|
|
|
+ printf( "websFlush: wrote %d to socket", written);
|
|
|
bufAdjustStart(op, written);
|
|
|
bufCompact(op);
|
|
|
nbytes = bufLen(op);
|
|
@@ -3218,7 +3218,7 @@ static void pruneSessions()
|
|
|
}
|
|
|
}
|
|
|
if (oldCount != sessionCount || sessionCount) {
|
|
|
- trace(4, "Prune %d sessions. Remaining: %d", oldCount - sessionCount, sessionCount);
|
|
|
+ printf("Prune %d sessions. Remaining: %d", oldCount - sessionCount, sessionCount);
|
|
|
}
|
|
|
}
|
|
|
websRestartEvent(pruneId, WEBS_SESSION_PRUNE);
|
|
@@ -3299,7 +3299,7 @@ static void setFileLimits()
|
|
|
}
|
|
|
}
|
|
|
getrlimit(RLIMIT_NOFILE, &r);
|
|
|
- trace(6, "Max files soft %d, max %d", r.rlim_cur, r.rlim_max);
|
|
|
+ printf("Max files soft %d, max %d", (int)r.rlim_cur, (int)r.rlim_max);
|
|
|
#endif
|
|
|
}
|
|
|
|
|
@@ -3338,7 +3338,7 @@ PUBLIC void websError(Webs *wp, int code, char *fmt, ...)
|
|
|
va_start(args, fmt);
|
|
|
msg = sfmtv(fmt, args);
|
|
|
va_end(args);
|
|
|
- trace(2, "%s", msg);
|
|
|
+ printf( "%s", msg);
|
|
|
wfree(msg);
|
|
|
}
|
|
|
buf = sfmt("\
|