this is using the mbed os version 5-13-1
Revision 86:04fc2fcda7ec, committed 2019-03-28
- Comitter:
- ocomeni
- Date:
- Thu Mar 28 23:41:10 2019 +0000
- Parent:
- 85:9f896e1e041c
- Child:
- 87:99b37d26ff2a
- Commit message:
- http request correctly passed to WifiManager
Changed in this revision
--- a/source/ATCmdManager.cpp Thu Mar 28 23:03:33 2019 +0000
+++ b/source/ATCmdManager.cpp Thu Mar 28 23:41:10 2019 +0000
@@ -230,8 +230,17 @@
//s1.replace(pos,1,"");
printf("\nname = %s value = %s",s1, s2);
//if(s1.find("Host")!= string::npos){
- if(strstr(s1, "POST")!= NULL){
- http_req.http_version.assign(s3);
+ if(strstr(s1, "Host")!= NULL){
+ http_req.hostName.assign(s2);
+ }
+ else if(strstr(s1, "Accept")!= NULL){
+ http_req.AcceptVal.assign(s2);
+ }
+ else if(strstr(s1, "Content-Type")!= NULL){
+ http_req.contentType.assign(s2);
+ }
+ else if(strstr(s1, "Content-Length")!= NULL){
+ http_req.contentLen.assign(s2);
}
--- a/source/WiFiManager.cpp Thu Mar 28 23:03:33 2019 +0000
+++ b/source/WiFiManager.cpp Thu Mar 28 23:41:10 2019 +0000
@@ -435,9 +435,11 @@
printf("\n[WIFI MAN] uri = %s", http_req_cfg->request_URI.c_str());
strncat(internet_config.url, http_req_cfg->request_URI.c_str(), http_req_cfg->request_URI.size());
printf("\n[WIFI MAN] server url = %s\n", internet_config.url);
+ printf("\n[WIFI MAN] contentLenstr = %s\n", http_req_cfg->contentLen.c_str());
//printf("\n[WIFI MAN] server url = %s\n", internet_config.url.c_str());
//const char* url = internet_config.url;
+ // http_request = new HttpRequest(network,
//https_request = new HttpsRequest(network,
http_request = new HttpRequest(network,
//SSL_CA_PEM,
@@ -450,6 +452,7 @@
setHttpHeader("Content-Length", http_req_cfg->contentLen);
int bodyLen;
sscanf(http_req_cfg->contentLen.c_str(), "%d", &bodyLen);
+ printf("contenLenstr = %s bodyLen = %d\n", http_req_cfg->contentLen.c_str(), bodyLen);
http_response = https_request->send(http_req_cfg->body, bodyLen);
free_DataMsg();
if (!http_response) {
--- a/source/main-https.cpp Thu Mar 28 23:03:33 2019 +0000
+++ b/source/main-https.cpp Thu Mar 28 23:41:10 2019 +0000
@@ -399,7 +399,7 @@
#define SKIP_WIFI_SCAN_DEMO
#define BLE_STOP_START_ADV_SCAN_DEMO
#define SKIP_WIFI_CONNECT_DEMO
-#define PAUSE_SECONDS 2
+#define PAUSE_SECONDS 0
int main() {
//print_all_thread_info();
//print_heap_and_isr_stack_info();