Skip to content

HTTPS GET Request returns -1 (still worked with Git update on Jun 6, 2016) #2150

Closed
@djoele

Description

@djoele

Hello everybody,

today I updated the ESP8266 code from Github.

My latest update was:
commit 32bd42b, June 6th

Now I have:
commit da17d54, Jun 14th

I have the function below which is responsible for doing a HTTPS GET Request.
The behaviour that I see now is that http=>GET now always returns -1.
When I do the request from a browser it is working and returns 200.

Anybody sees what I am doing wrong? Were there any changes in the ESP8266 codebase that forces me to change something?

const char* url= "https://....";
const String host = ".....";
const int port = 443;
const char * fingerprint = ".....";
const char* www_username = "....";
const char* www_password = ".....";

callURL(url, host, port);

  void callURL(String url, String host, const int port) {
      HTTPClient * http = new HTTPClient();
      http->begin(host, port, url, fingerprint);
      http->setAuthorization(www_username,www_password);
      http->addHeader("X-ESP8266-IP", ipadres);

      int httpCode = http->GET();
      Serial.println((String("[HTTP] url: ") + url + ", return code: " + httpCode));
      http->end();
     http->~HTTPClient();
     delete http;
}

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions