|
|
@ -87,12 +87,16 @@ const char ICACHE_FLASH_ATTR *httpdGetMimetype(char *url) { |
|
|
|
static char connStr[24]; |
|
|
|
static char connStr[24]; |
|
|
|
|
|
|
|
|
|
|
|
static void debugConn(void *arg, char *what) { |
|
|
|
static void debugConn(void *arg, char *what) { |
|
|
|
|
|
|
|
#if 0 |
|
|
|
struct espconn *espconn = arg; |
|
|
|
struct espconn *espconn = arg; |
|
|
|
esp_tcp *tcp = espconn->proto.tcp; |
|
|
|
esp_tcp *tcp = espconn->proto.tcp; |
|
|
|
os_sprintf(connStr, "%d.%d.%d.%d:%d ", |
|
|
|
os_sprintf(connStr, "%d.%d.%d.%d:%d ", |
|
|
|
tcp->remote_ip[0], tcp->remote_ip[1], tcp->remote_ip[2], tcp->remote_ip[3], |
|
|
|
tcp->remote_ip[0], tcp->remote_ip[1], tcp->remote_ip[2], tcp->remote_ip[3], |
|
|
|
tcp->remote_port); |
|
|
|
tcp->remote_port); |
|
|
|
//os_printf("%s %s\n", connStr, what);
|
|
|
|
//os_printf("%s %s\n", connStr, what);
|
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
connStr[0] = 0; |
|
|
|
|
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Looks up the connData info for a specific esp connection
|
|
|
|
//Looks up the connData info for a specific esp connection
|
|
|
@ -135,7 +139,8 @@ static void ICACHE_FLASH_ATTR httpdRetireConn(HttpdConnData *conn) { |
|
|
|
uint32 dt = conn->startTime; |
|
|
|
uint32 dt = conn->startTime; |
|
|
|
if (dt > 0) dt = (system_get_time() - dt) / 1000; |
|
|
|
if (dt > 0) dt = (system_get_time() - dt) / 1000; |
|
|
|
#ifdef HTTPD_DBG |
|
|
|
#ifdef HTTPD_DBG |
|
|
|
os_printf("%s Closed, %ums, heap=%ld\n", connStr, dt, |
|
|
|
os_printf("%sHTTP %s in %ums, heap=%ld\n", connStr, |
|
|
|
|
|
|
|
conn->requestType == HTTPD_METHOD_GET ? "GET" : "POST", dt, |
|
|
|
(unsigned long)system_get_free_heap_size()); |
|
|
|
(unsigned long)system_get_free_heap_size()); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
@ -432,11 +437,19 @@ static void ICACHE_FLASH_ATTR httpdParseHeader(char *h, HttpdConnData *conn) { |
|
|
|
*e = 0; //terminate url part
|
|
|
|
*e = 0; //terminate url part
|
|
|
|
|
|
|
|
|
|
|
|
// Count number of open connections
|
|
|
|
// Count number of open connections
|
|
|
|
|
|
|
|
#ifdef HTTPD_DBG |
|
|
|
|
|
|
|
#if 0 |
|
|
|
int open = 0; |
|
|
|
int open = 0; |
|
|
|
for (int j = 0; j<MAX_CONN; j++) if (connData[j].conn != NULL) open++; |
|
|
|
for (int j = 0; j<MAX_CONN; j++) if (connData[j].conn != NULL) open++; |
|
|
|
#ifdef HTTPD_DBG |
|
|
|
|
|
|
|
os_printf("%s%s %s (%d conn open)\n", connStr, |
|
|
|
os_printf("%s%s %s (%d conn open)\n", connStr, |
|
|
|
conn->requestType == HTTPD_METHOD_GET ? "GET" : "POST", conn->url, open); |
|
|
|
conn->requestType == HTTPD_METHOD_GET ? "GET" : "POST", conn->url, open); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
esp_tcp *tcp = conn->conn->proto.tcp; |
|
|
|
|
|
|
|
os_printf("%sHTTP %s %s from %d.%d.%d.%d:%d\n", connStr, |
|
|
|
|
|
|
|
conn->requestType == HTTPD_METHOD_GET ? "GET" : "POST", conn->url, |
|
|
|
|
|
|
|
tcp->remote_ip[0], tcp->remote_ip[1], tcp->remote_ip[2], tcp->remote_ip[3], |
|
|
|
|
|
|
|
tcp->remote_port); |
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
//Parse out the URL part before the GET parameters.
|
|
|
|
//Parse out the URL part before the GET parameters.
|
|
|
|
conn->getArgs = (char*)os_strstr(conn->url, "?"); |
|
|
|
conn->getArgs = (char*)os_strstr(conn->url, "?"); |
|
|
@ -444,7 +457,7 @@ static void ICACHE_FLASH_ATTR httpdParseHeader(char *h, HttpdConnData *conn) { |
|
|
|
*conn->getArgs = 0; |
|
|
|
*conn->getArgs = 0; |
|
|
|
conn->getArgs++; |
|
|
|
conn->getArgs++; |
|
|
|
#ifdef HTTPD_DBG |
|
|
|
#ifdef HTTPD_DBG |
|
|
|
os_printf("%s args = %s\n", connStr, conn->getArgs); |
|
|
|
//os_printf("%sargs = %s\n", connStr, conn->getArgs);
|
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|