These are chat archives for esp8266/Arduino

22nd
Nov 2015
frippe75
@frippe75
Nov 22 2015 07:33
Is there any "official" http client library available ?
Ivan Grokhotkov
@igrr
Nov 22 2015 07:34
there isn't any yet, by @Links2004 is working on one
Links2004/Arduino@95dada1
kathir1951
@kathir1951
Nov 22 2015 09:24
@igrr How to create c++ lib using xtensa with make file Simple guidence enough
Markus
@Links2004
Nov 22 2015 10:12
@frippe75 I uploaded the latest version to my git GET is already working (see example)
https://github.com/Links2004/Arduino/tree/httpClient/libraries/ESP8266httpClient
frippe75
@frippe75
Nov 22 2015 10:21
I will have a look at it! thanks!
Markus
@Links2004
Nov 22 2015 10:28
i update the example with some more notes to make it easyer
Markus
@Links2004
Nov 22 2015 10:56

@igrr i try to return a WiFiClient object of WiFiClientSecure
by https://github.com/Links2004/Arduino/blob/httpClient/libraries/ESP8266httpClient/src/ESP8266httpClient.cpp#L144-L149

but i get a null ptr exception:

[HTTP] begin...
[HTTP] GET...
[HTTP-Client] connect https...
[HTTP-Client] connected to 192.168.1.12:443.
[HTTP][handleHeaderResponse] RX: 'HTTP/1.1 200 OK'
[HTTP][handleHeaderResponse] RX: 'Date: Sun, 22 Nov 2015 10:51:49 GMT'
[HTTP][handleHeaderResponse] RX: 'Server: Apache/2.2.22 (Debian)'
[HTTP][handleHeaderResponse] RX: 'Last-Modified: Sun, 09 Mar 2014 12:23:42 GMT'
[HTTP][handleHeaderResponse] RX: 'ETag: "e3ab2-1a9-4f42b8ec14fd7"'
[HTTP][handleHeaderResponse] RX: 'Accept-Ranges: bytes'
[HTTP][handleHeaderResponse] RX: 'Content-Length: 425'
[HTTP][handleHeaderResponse] RX: 'Vary: Accept-Encoding'
[HTTP][handleHeaderResponse] RX: 'Connection: close'
[HTTP][handleHeaderResponse] RX: 'Content-Type: text/html'
[HTTP][handleHeaderResponse] RX: ''
[HTTP][handleHeaderResponse] code: '200'
[HTTP][handleHeaderResponse] size: '425'
[HTTP] GET... code: 200
getStream.... 

Exception (28): 
epc1=0x40208319 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000014 depc=0x00000000 

ctx: cont  
sp: 3fff1cc0 end: 3fff1fb0 offset: 01a0 

>>>stack>>> 
3fff1e60:  3fff3dc8 00000020 3fff1f00 40206eec   
3fff1e70:  00000080 000001a9 3fff0f2c 40206c5f   
3fff1e80:  00000000 00000000 00000000 00000000   
3fff1e90:  00000000 00000000 00000000 00000000   
3fff1ea0:  00000000 00000000 00000000 00000000   
3fff1eb0:  00000000 00000000 00000000 00000000   
3fff1ec0:  00000000 00000000 00000000 00000000   
3fff1ed0:  00000000 00000000 00000000 00000000   
3fff1ee0:  00000000 00000000 00000000 00000000   
3fff1ef0:  00000000 00000000 00000000 00000000   
3fff1f00:  3fff4110 3fff4110 3fff4090 0000000f   
3fff1f10:  0000000c 3fff01bb 3fff40b0 0000000f   
3fff1f20:  0000000a 00000001 3fff40d0 0000000f   
3fff1f30:  00000000 3fff40f0 0000000f 00000000   
3fff1f40:  00000000 00000000 000000c8 000001a9   
3fff1f50:  3ffe9650 00000000 3ffe9090 40207c75   
3fff1f60:  00000000 3fff3e18 402094ec 3fff0f90   
3fff1f70:  000000c8 3fff0e28 3ffe9090 40207c90   
3fff1f80:  3fffdc20 00000000 3fff0f2c 3fff0f84   
3fff1f90:  3fffdc20 00000000 3fff0f7d 40209535   
3fff1fa0:  00000000 00000000 3fff0f90 40100114   
<<<stack<<<
40208304 <_ZN10WiFiClientC1ERKS_>:
40208304:    f0c112            addi    a1, a1, -16
40208307:    21c9          s32i.n    a12, a1, 8
40208309:    02cd          mov.n    a12, a2
4020830b:    020c          movi.n    a2, 0
4020830d:    1c29          s32i.n    a2, a12, 4
4020830f:    4c29          s32i.n    a2, a12, 16
40208311:    ff4d21            l32r    a2, 40208048 <_ZN10WiFiClient4stopEv+0x24>
40208314:    e8a342            movi    a4, 0x3e8
40208317:    0c29          s32i.n    a2, a12, 0
40208319:    5328          l32i.n    a2, a3, 20
4020831b:    3109          s32i.n    a0, a1, 12
4020831d:    2c49          s32i.n    a4, a12, 8
4020831f:    5c29          s32i.n    a2, a12, 20

any Idea why it work for http and not for https with WiFiClientSecure?

frippe75
@frippe75
Nov 22 2015 21:11

@Links2004, the http client looks good, have not switched to it but started out using WifiClient as a start.

Curl:ing the file works but the esp12-e fails.

Downloading: http://focuszoomer.no-ip.biz:80/firmware/myhex
HTTP/1.1 404 Not Found
Server: nginx/1.7.4
Date: Sun, 22 Nov 2015 21:00:39 GMT

String firmware_uri = "/firmware/myhex"; // Generate HTTP GET request client.println("GET " + firmware_uri + " HTTP/1.1"); client.println("Host: " + String(host)); client.println("Connection: close"); client.println();

The connect on port 80 is succesful and the nginx is there...

frippe75
@frippe75
Nov 22 2015 21:32
Switching to the ip of my laptop where I have apache running works fine.
Markus
@Links2004
Nov 22 2015 21:33
you send the request in 4 tcp packets the most server dont like this.
frippe75
@frippe75
Nov 22 2015 21:35
Downloading: http://192.168.0.210:80/firmware/myhex
HTTP/1.1 200 OK
Date: Sun, 22 Nov 2015 21:28:06 GMT
Markus
@Links2004
Nov 22 2015 21:35
simpler use the library :)
http get is working fine right now.
frippe75
@frippe75
Nov 22 2015 21:36
Haha, well I should have guessed. But you are right, why reinvent the wheel. While it's in the owen ;-)
Markus
@Links2004
Nov 22 2015 21:37
httpClient http;
 http.begin("focuszoomer.no-ip.biz", 80, "/firmware/myhex"); 
 int httpCode = http.GET();
 if(httpCode == 200) {
    http.writeToStream(&Serial);
   // or use  WiFiClient stream = http.getStream(); and handle the payload yourself
}
http.end();
thats the minimum :)
frippe75
@frippe75
Nov 22 2015 21:42
much appreciated!
frippe75
@frippe75
Nov 22 2015 22:00
Sorry for my lack of understanding!
Property line '<!DOCTYPE html>' in file /usr/local/arduino-PR-4107-BUILD-421/libraries/ESP8266httpClient/library.properties is invalid
here is a zip version :)
frippe75
@frippe75
Nov 22 2015 22:05
Thanks, wget on the file... don't know how the hell it ended up that way.
frippe75
@frippe75
Nov 22 2015 22:17
/usr/local/arduino-PR-4107-BUILD-421/hardware/esp8266com/esp8266/libraries/ESP8266httpClient/src/ESP8266httpClient.h:90:9: error: 'WiFiClientSecure' does not name a type
WiFiClientSecure * _tcps;
Markus
@Links2004
Nov 22 2015 22:18
which version of the arduino esp8266 do you use?
frippe75
@frippe75
Nov 22 2015 22:18
PR-4107-BUILD-421
Maybe adding WiFiClientSecure to my sketch.
That works but I'm not sure why that has to be... Shouldn't your class be self-contained?
Markus
@Links2004
Nov 22 2015 22:20
yes ;) may you not have this bugfix: esp8266/Arduino@83b452b
its currently only on the git version rc1 dont have it
frippe75
@frippe75
Nov 22 2015 22:21
aha! Do I dare asking best way to keep up?
then you can use git pull for update
frippe75
@frippe75
Nov 22 2015 22:23
thanks!
Now i'm latest and greatest. compiles fine. So what about the http GET...