Skip to content

httpClient.begin(url) reurn -1 and -11 #3780

@ghost

Description

Hi!
ESP8266 (ESP12)
A remote server is available. Through the browser, I get the contents of the file txt.
But my function returns -1 and -11.

#define OTA_HOST        "updates.soi-tech.com"
#define DEVICE_MODEL    "WalkingLight"

bool otaAvailable() {
    HTTPClient httpClient;
    httpClient.useHTTP10(true);
    httpClient.setTimeout(5000);
    char url[65];
    sprintf( url, "http://%s/%s.txt", OTA_HOST, DEVICE_MODEL );
    httpClient.begin(url);
Serial.println(url);
    int code = httpClient.GET();
Serial.println(code);
    if (code != HTTP_CODE_OK) {
          httpClient.end();
          return false;
    }
    const char *response = httpClient.getString().c_str();
    httpClient.end();
Serial.println(response);
    return true;
}

I tried http and https.

First run function:

http://updates.soi-tech.com/WalkingLight.txt␍␊
200␍␊
1 F52187696F59EE5A1D85285D0F0B62A8 29131F8A6A853402AAB5433D521B1EC0 EA9BF8DE9BF008DFC94ECDE7260F4409␍␊

The second and subsequent launches:

http://updates.soi-tech.com/WalkingLight.txt␍␊
-11␍␊

http://updates.soi-tech.com/WalkingLight.txt␍␊
-11␍␊

I am use library ESPAsyncWebServer, past first run function the server stops loading, the Web interface does not load.
What could it be?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions