khoih-prog/AsyncHTTPSRequest_Generic

Bug with _parseURL()

redphx opened this issue · 4 comments

_parseURL() doesn't consider https://www.google.com a valid URL, but it does with https://www.google.com/.

You have to save us some time by including MRE in any issue. I certainly can create some code to test, but just wasting time, better to use yours.

Sorry, here is the sketch:

#define _ASYNC_HTTPS_LOGLEVEL_ 4

#include <WiFi.h>
#include "Arduino.h"
#include <AsyncHTTPSRequest_Generic.h>

// Wifi Credentials
const char* WIFI_SSID = "wifi";
const char* WIFI_PASSWORD = "password";

AsyncHTTPSRequest request;

void setup() {
  Serial.begin(115200);

  // WiFi Init
  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("[WIFI] connecting to network " + String(WIFI_SSID) );
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("[WIFI] connected with Ip: " + WiFi.localIP().toString() );

  request.setDebug(true);

  request.open("GET", "https://www.google.com");
  // request.open("GET", "https://www.google.com/");
}

void loop() {
}

When URL = https://www.google.com

[AHTTPS] open( GET , url = https://www.google.com
[AHTTPS] open: error parsing URL

When URL = https://www.google.com/

[AHTTPS] open( GET , url = https://www.google.com/
[AHTTPS] open: connecting to hostname = www.google.com:443
[AHTTPS] _client->connecting to www.google.com , 443
[AHTTPS] client.connect OK to www.google.com , 443
[AHTTPS] _onError handler SSL error = OK

Hi @redphx

The new AsyncHTTPSRequest_Generic v2.5.0 has just been published. Your contribution is noted in Contributions and Thanks

Please test and report more bugs.

Best Regards,


Releases v2.5.0

  1. Add support to ESP32 boards using LwIP W6100 Ethernet
  2. Fix bug of wrong reqStates. Check Callback behavior buggy #19
  3. Fix bug of _parseURL(). Check Bug with _parseURL() #21
  4. Improve README.md so that links can be used in other sites, such as PIO

These are the terminal outputs using your test code

Using url = https://www.google.com

[WIFI] connecting to network HueNet.......
[WIFI] connected with Ip: 192.168.2.151
[AHTTPS] open( GET , url = https://www.google.com
[AHTTPS] pathBeg= -1
[AHTTPS] hostEnd= 22
[AHTTPS] portBeg= -1
[AHTTPS] _URL->host= www.google.com
[AHTTPS] _URL->path= 
[AHTTPS] _URL->query= 
[AHTTPS] open: connecting to hostname = www.google.com:443
[AHTTPS] _client->connecting to www.google.com , 443
[AHTTPS] client.connect OK to www.google.com , 443
[AHTTPS] _onError handler SSL error = OK

Using url = https://www.google.com/

[WIFI] connecting to network HueNet.......
[WIFI] connected with Ip: 192.168.2.151
[AHTTPS] open( GET , url = https://www.google.com/
[AHTTPS] pathBeg= 22
[AHTTPS] portBeg= -1
[AHTTPS] _URL->host= www.google.com
[AHTTPS] _URL->path= /
[AHTTPS] _URL->query= 
[AHTTPS] open: connecting to hostname = www.google.com:443
[AHTTPS] _client->connecting to www.google.com , 443
[AHTTPS] client.connect OK to www.google.com , 443
[AHTTPS] _onError handler SSL error = OK