diff --git a/src/HAP.cpp b/src/HAP.cpp index c82aeb7..19ee483 100644 --- a/src/HAP.cpp +++ b/src/HAP.cpp @@ -165,10 +165,21 @@ void HAPClient::processRequest(){ if(homeSpan.needsConfiguration){ // device not yet configured - only allow certain URLs + if(!strncmp(body,"POST /configure ",16) && // POST CONFIGURE + strstr(body,"Content-Type: application/x-www-form-urlencoded")){ // check that content is from a form + + content[cLen]='\0'; // add a trailing null on end of POST data + LOG2((char *)content); // print data + LOG2("\n------------ END DATA! ------------\n"); + + postConfigureURL((char *)content); // process URL + return; + } + captiveAccessURL(); // default action for all other URLs when in captive Access Point mode return; - } // captive access point URLs only + } // captive access point URLs only - everything below is for normal HAP requests if(!strncmp(body,"POST ",5)){ // this is a POST request @@ -345,13 +356,13 @@ int HAPClient::captiveAccessURL(){ int n=WiFi.scanNetworks(); - String s="HTTP/1.1 200 OK\r\nContent-type:text/html\r\n\r\n"; + String s="HTTP/1.1 200 OK\r\nContent-type: text/html\r\n\r\n"; s+="
HomeSpan_12_54_DD_E4_23_F5
Welcome to HomeSpan! This page allows you to configure the above HomeSpan device to connect to your WiFi network, and (if needed) to create a Setup Code for pairing this device to HomeKit.
"; s+="The LED on this device should be double-blinking during this configuration.
"; - s+="