nmattisson/HttpClient

problems with http

Closed this issue · 2 comments

After a busy time I am back to spark-core development.

I can't get the http-library working on my core. I am testing with the
simple example in the readme, but with different domains (switch.ch,
google.com, etc.) I am not sure if this is because of my spark-core, the firmware upgrade, new wifi-router or isp...

But i only get this in the console:

Application> Start of Loop.
HttpClient> Connection failed.
Application> Response status: -1
Application> HTTP Response Body:

does it work for you most of the time?

Some spark devices currently have issues resolving domain names. see https://community.spark.io/t/problem-with-core-networking-and-dns-try-this-tool/7667

Meanwhile I needed a way go arround the dns. For my workaround I made the following local changes:

-added to http_request_t: bool forceIp;
-check it on HttpClient.ccp#66: if(aRequest.forceIp==false) {
-but still use the hostname if present for host header: if(aRequest.hostname!=NULL) ...

is this something to include in the library?

...a bit busy with this at the moment:
https://www.kickstarter.com/projects/830527119/612880945

...but will check in when the dust settles. :)