-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTPClient doesn't send the URL in HTTPS #1941
Comments
I just tried with 2.1.0 and the same code works fine to reach server using HTTPS |
I can confirm that I can't do any calls to https endpoints using the Eg this code: Serial.print("API Call to: https://www.reddit.com/iphone.json");
Serial.println();
HTTPClient http;
int beginResult = http.begin("https://www.reddit.com/iphone.json");
http.addHeader("Content-Type", "text/plain");
int httpCode = http.POST("Message from ESP8266");
String response = http.getString();
Serial.print("beginResult: ");
Serial.print(beginResult);
Serial.println();
Serial.print("http: ");
Serial.print(httpCode);
Serial.println();
Serial.print("response: ");
Serial.println(response);
Serial.println();
http.end(); Should return |
Hi, this is because you need now to provide website certificat thumbprint in http.begin for https website.
|
What if it changes (thinking about tools like Letsencrypt and Cloudflare that generate free certificates on the fly that are only valid for short periods of time)? |
That is a valid concern! I am currently working on that as part of
#3700. That will add ability to
verify the certificate in one of the several ways (fingerprint,
subjectPublicKeyInfo, root cert), when using HTTPClient.
…On Thu, Oct 12, 2017, 08:12 Wouter De Schuyter ***@***.***> wrote:
What if it changes (thinking about tools like Letsencrypt and Cloudflare
that generate free certificates on the fly)?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#1941 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEJcevAIAJiR4XB76RgVaHldluQ162dwks5srgIPgaJpZM4IKjjO>
.
|
Thanks igrr :-) |
Alright, good to know @igrr, thanks :-)! Another question: is there a way to ignore it if you don't care about it? Eg like the unix command |
Currently there isn't a way to do that with HTTPClient. If you need this,
you can copy the .cpp/.h files of HTTPClient into your sketch (renaming the
.h file), and delete the line in .cpp file responsible for the check.
…On Thu, Oct 12, 2017, 08:18 Wouter De Schuyter ***@***.***> wrote:
Alright, good to know @igrr <https://github.com/igrr> :-)!
Another question: is there a way to ignore it? If you don't care about? Eg
like the unix command wget that has an option --no-check-certificate?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1941 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEJceszokb9CDpTnDOW-t8y-NdaM86vUks5srgN4gaJpZM4IKjjO>
.
|
I guess I'll do that for now, thanks! |
Just wondering if anyone got this going? If so, any chance you can publish the relevant bits of the code to change in HTTPClient.cpp? This is what I tried... I can see the entry point for https is:
So I detect the url using url.startsWith("https:"), then call client.begin with a fake string param like so:
And tried changing this:
to this:
Few other things I tried, but that didn't work.
Any tips? |
@wouterds Did you get this going? Any chance you can post the relevant changes? (See my attempts above) |
Hi! No, I did not get it working yet. I managed to copy the libs and include my custom libs, tried commenting all the verify methods out / make them early return true but without success. Still looking into it! Any help would be appreciated!
… On 19 Oct 2017, at 02:19, Simon ***@***.***> wrote:
@wouterds <https://github.com/wouterds> Did you get this going? Any chance you can post the relevant changes? (See my attempts above)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#1941 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABJ5BLDsb3uDb1muYiWrlTTwY9vQ13YGks5stpWpgaJpZM4IKjjO>.
|
@hutch120 : I have the same problem. So, to connect in https without certificat (fingerprint), i change the fonction "verify" in TLSTraits class in ESP8266HTTPClient.cpp. I made this fonction return always true, and that work fine. |
Actually @TTnsp already provided the answer. Here's the modified code portion in the ESP8266HTTPClient.cpp file
|
It works for me though. I'm using LetsEncrypt on my https server. It was a POST Request. Did you modify the library directly? I actually copied them into my sketch folder and change the headers to use the local sketch libraries instead. |
I'm in the same case of you and i copied the librairie into my sketch. |
Not sure if I can help but what error are you getting? |
Below I attach a portion of my code.
The return codes that I'm receiving in Remember that actually I modified the
|
Could you try this line with your post request instead?
|
I tried that alternative and now the return codes that I'm receiving in Additionally I tried a GET request to get data from MLAB's and NASA's API but I received
In this occasion the return code Therefore, in both cases (POST and GET request) the Note: I've also tried removing the
Note 2: The fingerprint of Nasa API was obtained from https://www.grc.com/fingerprints.htm. |
Hello @igrr, I've been trying to get data from NASA's API using the example HTTPSRequest.ino but I can not succeed. The same happens when I send a POST request to MLAB's API (see the post above). My code based on HTTPSRequest.ino is:
The serial monitor output is:
It is possible that you can guide me regarding this problem? |
Hello, I am experiencing the same problem as well. I attempted to change the return statement to true in my appdata, hardware folder. `
|
Hello @shannonzchanz
|
@shannonzchanz try this PR #3933 |
I have resolved it! It's just that my esp8266 doesn't reach the localhost. So, I would have to publish it online. Thanks for the help. |
I am still having the same issue with not being able to load an https website. This is what I have currently tried
But I still get -1, even with passing the current SH1 key for that specific site. What am I doing wrong here? |
Hi @theyogeshrathod Looks like maybe you are fairly new to Github, and just starting out with ESP boards? Please be aware that github issue lists are generally reserved for bugs and I'd suggest that a better place to ask random questions like this is on the StackOverflow website. Also, if you do post a response to a thread please ensure you read and understand the issue first, or you just annoy people. This thread clearly has nothing to do with your problem, it is related to an issue with HTTPS as it says in the issue title. Also, I suggest you check if a thread has been updated recently, this hasn't had an actual answer since 2017 and probably should be locked and closed. @igrr please consider locking this issue. |
Oh, sorry @hutch120. I will just delete the above comment. Thanks! |
Basic Infos
Trying to make a GET to /something and receive a request for / only on web server side.
Hardware
Hardware: ESP-01
Core Version: 2.2.0
Description
My sketch do a GET using HTTPClient.
I was in release 2.0.0 and I just updated to 2.2.0 release (did not try in 2.1.0)
My sketch was able to send GET for HTTP and HTTPS URI using 2.0.0 release.
Since I updated to 2.2.0, HTTP works almost fine (getting frequent -11 return code while my server answering bellow 5sec).
But the issue is while i'm trying to send same GET request using HTTPS, My web server receive a wrong header requesting for / only.
Exemple:
I request for https://192.168.1.123/plugins/teleinfo/core/php/jeeTeleinfo.php?api=YQFMNcxGJ52XSrHYcF3U&ADCO=050522038502&HCHP=072686874&PAPP=00730
My apache2 log contains this:
192.168.1.104 - - [19/Apr/2016:11:57:21 +0200] "GET / HTTP/1.0" 400 0 "-" "-"
Settings in IDE
Module: Generic ESP8266 Module
Flash Size: 1MB
CPU Frequency: 80Mhz
Flash Mode: dio
Flash Frequency: 40Mhz
Upload Using: OTA
Reset Method: ck
Sketch
The text was updated successfully, but these errors were encountered: