Skip to content

Commit 90c4e3a

Browse files
authored
Change host from tls.mbed.org to api.my-ip.io (#8931)
https://tls.mbed.org/ host does not support MFLN and Also Redirects the Client. https://api.my-ip.io/ip is a better alternative, supporting MFLN and allowing the user to get a simple text with a useful information.
1 parent b7f7b74 commit 90c4e3a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

libraries/ESP8266WiFi/examples/BearSSL_MaxFragmentLength/BearSSL_MaxFragmentLength.ino

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const char *ssid = STASSID;
1616
const char *pass = STAPSK;
1717

1818
void fetch(BearSSL::WiFiClientSecure *client) {
19-
client->write("GET / HTTP/1.0\r\nHost: tls.mbed.org\r\nUser-Agent: ESP8266\r\n\r\n");
19+
client->write("GET /ip HTTP/1.0\r\nHost: api.my-ip.io\r\nUser-Agent: ESP8266\r\n\r\n");
2020
client->flush();
2121
using oneShot = esp8266::polledTimeout::oneShot;
2222
oneShot timeout(5000);
@@ -39,12 +39,12 @@ void fetch(BearSSL::WiFiClientSecure *client) {
3939
int fetchNoMaxFragmentLength() {
4040
int ret = ESP.getFreeHeap();
4141

42-
Serial.printf("\nConnecting to https://tls.mbed.org\n");
42+
Serial.printf("\nConnecting to https://api.my-ip.io\n");
4343
Serial.printf("No MFLN attempted\n");
4444

4545
BearSSL::WiFiClientSecure client;
4646
client.setInsecure();
47-
if (client.connect("tls.mbed.org", 443)) {
47+
if (client.connect("api.my-ip.io", 443)) {
4848
Serial.printf("Memory used: %d\n", ret - ESP.getFreeHeap());
4949
ret -= ESP.getFreeHeap();
5050
fetch(&client);
@@ -76,11 +76,11 @@ int fetchMaxFragmentLength() {
7676

7777
BearSSL::WiFiClientSecure client;
7878
client.setInsecure();
79-
bool mfln = client.probeMaxFragmentLength("tls.mbed.org", 443, 512);
80-
Serial.printf("\nConnecting to https://tls.mbed.org\n");
79+
bool mfln = client.probeMaxFragmentLength("api.my-ip.io", 443, 512);
80+
Serial.printf("\nConnecting to https://api.my-ip.io\n");
8181
Serial.printf("MFLN supported: %s\n", mfln ? "yes" : "no");
8282
if (mfln) { client.setBufferSizes(512, 512); }
83-
if (client.connect("tls.mbed.org", 443)) {
83+
if (client.connect("api.my-ip.io", 443)) {
8484
Serial.printf("MFLN status: %s\n", client.getMFLNStatus() ? "true" : "false");
8585
Serial.printf("Memory used: %d\n", ret - ESP.getFreeHeap());
8686
ret -= ESP.getFreeHeap();

0 commit comments

Comments
 (0)