Some aesthetic cleanups

pull/30/head
Jeroen Domburg 10 years ago
parent ccb87593e8
commit 49c7d310bc
  1. 9
      user/httpd.c
  2. 2
      user/user_main.c

@ -94,8 +94,9 @@ static HttpdConnData ICACHE_FLASH_ATTR *httpdFindConnData(void *arg) {
for (i=0; i<MAX_CONN; i++) { for (i=0; i<MAX_CONN; i++) {
if (connData[i].conn==(struct espconn *)arg) return &connData[i]; if (connData[i].conn==(struct espconn *)arg) return &connData[i];
} }
//Shouldn't happen.
os_printf("FindConnData: Huh? Couldn't find connection for %p\n", arg); os_printf("FindConnData: Huh? Couldn't find connection for %p\n", arg);
return NULL; //WtF? return NULL;
} }
//Retires a connection for re-use //Retires a connection for re-use
@ -174,7 +175,6 @@ int ICACHE_FLASH_ATTR httpdGetHeader(HttpdConnData *conn, char *header, char *re
p=p+strlen(p)+1; //skip HTTP part p=p+strlen(p)+1; //skip HTTP part
while (p<(conn->priv->head+conn->priv->headPos)) { while (p<(conn->priv->head+conn->priv->headPos)) {
while(*p<=32 && *p!=0) p++; //skip crap at start while(*p<=32 && *p!=0) p++; //skip crap at start
// os_printf("Looking for %s, Header: '%s'\n", header, p);
//See if this is the header //See if this is the header
if (os_strncmp(p, header, strlen(header))==0 && p[strlen(header)]==':') { if (os_strncmp(p, header, strlen(header))==0 && p[strlen(header)]==':') {
//Skip 'key:' bit of header line //Skip 'key:' bit of header line
@ -264,7 +264,6 @@ static void ICACHE_FLASH_ATTR httpdSentCb(void *arg) {
HttpdConnData *conn=httpdFindConnData(arg); HttpdConnData *conn=httpdFindConnData(arg);
char sendBuff[MAX_SENDBUFF_LEN]; char sendBuff[MAX_SENDBUFF_LEN];
// os_printf("Sent callback on conn %p\n", conn);
if (conn==NULL) return; if (conn==NULL) return;
conn->priv->sendBuff=sendBuff; conn->priv->sendBuff=sendBuff;
conn->priv->sendBuffLen=0; conn->priv->sendBuffLen=0;
@ -449,7 +448,7 @@ static void ICACHE_FLASH_ATTR httpdReconCb(void *arg, sint8 err) {
static void ICACHE_FLASH_ATTR httpdDisconCb(void *arg) { static void ICACHE_FLASH_ATTR httpdDisconCb(void *arg) {
#if 0 #if 0
//Stupid esp sdk passes through wrong arg here, namely the one of the *listening* socket. //The esp sdk passes through wrong arg here, namely the one of the *listening* socket.
//If it ever gets fixed, be sure to update the code in this snippet; it's probably out-of-date. //If it ever gets fixed, be sure to update the code in this snippet; it's probably out-of-date.
HttpdConnData *conn=httpdFindConnData(arg); HttpdConnData *conn=httpdFindConnData(arg);
os_printf("Disconnected, conn=%p\n", conn); os_printf("Disconnected, conn=%p\n", conn);
@ -501,7 +500,7 @@ static void ICACHE_FLASH_ATTR httpdConnectCb(void *arg) {
espconn_regist_sentcb(conn, httpdSentCb); espconn_regist_sentcb(conn, httpdSentCb);
} }
//Httpd initialization routine. Call this to kick off webserver functionality.
void ICACHE_FLASH_ATTR httpdInit(HttpdBuiltInUrl *fixedUrls, int port) { void ICACHE_FLASH_ATTR httpdInit(HttpdBuiltInUrl *fixedUrls, int port) {
int i; int i;

@ -61,7 +61,7 @@ HttpdBuiltInUrl builtInUrls[]={
//Routines to make the /wifi URL and everything beneath it work. //Routines to make the /wifi URL and everything beneath it work.
//Enable the line below to protect the WiFi configuration with an username/password combo. //Enable the line below to protect the WiFi configuration with an username/password combo.
// {"/wifi/*", authBasic, myPassFn}, {"/wifi/*", authBasic, myPassFn},
{"/wifi", cgiRedirect, "/wifi/wifi.tpl"}, {"/wifi", cgiRedirect, "/wifi/wifi.tpl"},
{"/wifi/", cgiRedirect, "/wifi/wifi.tpl"}, {"/wifi/", cgiRedirect, "/wifi/wifi.tpl"},

Loading…
Cancel
Save