Skip to content
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.begin(url) reurn -1 and -11 #3780

Closed
ghost opened this issue Oct 31, 2017 · 1 comment
Closed

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

ghost opened this issue Oct 31, 2017 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 31, 2017

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?

@ghost ghost changed the title httpClient.begin(url) reurn -1 httpClient.begin(url) reurn -1 and -11 Oct 31, 2017
@devyte
Copy link
Collaborator

devyte commented Nov 1, 2017

@MCMeGa No basic info, no IDE settings, example sketch is incomplete.
The httpClient is part of this repo, the meaning of the return values can be found here:
#define HTTPC_ERROR_CONNECTION_REFUSED (-1)
...
#define HTTPC_ERROR_READ_TIMEOUT (-11)

The ESPAsyncWebServer is not hosted here.

I don't see anything obvious with the httpClient code. I suspect the problem is on the server side, e.g.: an out of mem issue, or mem corruption, but that is just a guess.

In any case, this is not the right place to request help with your particular project. Please discuss on a community forum. If you narrow the problem down and find an issue with the core hosted in this repo, please open a new issue, and provide the requested details.
Closing per #3655 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant