-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Undocumented negative return values from HTTPClient::get() #5137
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
Comments
@teo1978 when you opened this issue, you were presented with an issue template that contains specific instructions and requested info. You have ignored this. |
This is a documentation issue, you don't need a reproducible example. What you need to do is look at the "return -1" statement in the function's code and document them. Well actually there's point 2 which is not just documentation, that is more of a feature request. If you read it, you'll see you don't need (nor does it make sense to ask for) a reproducible case for that either. |
|
I see, thanks (I usually don't look at the source code for documentation). So this is
So I wonder: is it really safe to assume that, if |
You can enable serial port debugging and see, where in ::connect() method is source of the error... |
I have tried that thanks to your suggestion, and it says more or less what we already knew: "connection refused":
I strongly suspect HttpClient is wrongly reporting as "connection refused" a broader class of connection failuers, but I'd like to verify that. Do you know if there are logs on the server (it's Debian 8) where I can look, where refused connections are logged? I have also added WIFI to the debug level (besides HTTTP_CLIENT) but that doesn't add a bit of information when this error occurs. |
Hmm, it seems like the problem is deeper than I thought (now it seems like problem in WiFiClient, or deeper). |
Anyway It definitely does look like |
It's failing here:
which means,
So, whenever |
Note that we are actually discussing two separate issues now:
They are both still valid, and the former has always been. I don't know why this report got closed. |
Btw, I saw some However, that is not the case. Is that another bug or am I missing something? I replaced the |
@teo1978 this was closed because there is an issue policy in place for this repo, and because the issue template has specific instructions to follow and requests to fill out specific information, neither of which was done. |
Well, do whatever you want. To the part regarding lack of documentation, the template doesn't even apply. And I don't see a separate repository or bug tracker for documentation. For the other part, maybe I'll open a separate issue, though as you say the details are all here. Either you are interested in fixing it, in which case you have all the details here, or you are not, in which case I would be wasting my time by opening a new issue and filling in the template as you request. And if you are basing your decision whether or not to fix (or triage) the issue based on whether or not I fill in a template the way you request, that in my opinion wouldn't be a sensible criteria, but of course it's up to you. By the way, I'd suggest you to reduce the length of the template if you really expect bug reporters to read it. When I'm presented a text that long in a form I'm filling in, I'll systematically ignore it, and so will most people. |
Oh, I had come here to add some possibly valuable information, then I saw your comment. In the case I'm experiencing, the failure to connect happens, as I suspected in comment #this one, here:
and the value of |
This seems to be something important - please can @d-a-v take a look @ this? |
@teo1978 the documentation is versioned together with the code in this repo, so I don't understand why you think the template doesn't apply. Do you mean the IDE Settings and MCVE sketch? Even then, you mention specific parts of code, so specifying the core version in question is important. Or do you mean the IDE Settings and MCVE? You can, of course, specify that certain fields don't apply. The template requests specific information to allow better triaging, searching, and planning in general. In a year or two, if this issue were to be referenced, that information would help quite a bit to get the context for when this was opened and what this issue was for. There are other reasons for requesting them, which have come from lessons learned in the past (e.g.: older issues where the template didn't exist yet). *When I arrived here, this repo was at 1000+ open issues and growing, and was on the verge of getting out of control, to the point that getting a new release out the door (2.4.0) was difficult in the extreme. Now it's at less than 440 open issues, and with a downward trend. Consider that right now we're only 3 active developers, all working only on our free time, plus the occasional community contributor, so getting things right to reduce workload and ease planning is important. |
About the above comment, I we can say that there are several things at play here:
Given the details already posted here, I suggest keeping this issue for code changes, and open a new issue for the documentation. Just please fill out the issue templates correctly. |
True. That means the esp did not receive the server's answer within the configured What code should HTTPC return in that case ?
That would be |
Given the last two comments, shouldn't this be reopened? |
I said:
Then @d-a-v asked questions that weren't answered. Please provide the requested info. |
I don't have the answers. It seems to me that enough information has been collected to state that there is indeed an issue to be fixed, so I think the correct status is open, whether or not I can answer to those questions. Some of the question don't seem directed to me as the issue poster, but rather open questions as in "what should we do with xxx". The mere existence of such questions seems to me a reason for the issue to be open. E.g.
I don't know or have a suggestion for that one. |
What is the proper usage for
What i get is: request for member 'errorToString' in 'httpCode', which is of non-class type 'int' What am I doing wrong? I also tried this: http.errorToString() returns the error no matching function for call to 'HTTPClient::errorToString()' This is on an ESP32. Perhaps the ESP32 library has a bug in this non-critical function. |
|
@d-a-v Yup, that appears to work. Looks weird but it works. |
Now I'm getting error -11 HTTPC_ERROR_READ_TIMEOUT Nothing is logged on the server, so the HTTP request never gets through. Here's the debug output:
|
Wow, it was actually timing out. |
And to that I add:
See #6169 (comment) Forget the timeout: I'm using |
Got the same issue here even with 22000 timing. |
Yordan did you resolve this? how? |
To tell You the truth it turns to be a hell of connected issues mainly and mostly related to the WiFi implementation than the HTTPClient itself. |
Get error is: |
Hey, i think i am missing something but i feel u guys directly jumped to the point where u got error code as -11 i am getting error code as -1 for 2 days now, cannot find help anywhere, How did you resolve it? |
Hey, I had the same issue. It was solved by replacing I hope it helps ! |
I had the same problem as stated in the original post. I was getting -1 error as a response for HTTPClient::get(), although the link was working on a browser. I then tried this: WiFi.setSleepMode(WIFI_NONE_SLEEP) (mentioned by d-a-v), and at least for now the error is gone. Lastly, I provide some background information on my situation. This problem occurred to me after I started using my data logging code on a new ESP8266 board. There were three changes in my system. The new board has a CP2102 chip while the old one had either CH340 or CH341 (I don't remember which one it was). I had also upgraded my wifi network to mesh wifi6 using TP-link deco x50 devices. The last change was swapping a DHT11 sensor for a better BME280 sensor. So the problems started after these three changes, and I don't know which one it caused but I wanted to share this info anyway. |
All I can find in the documentation about
HTTPClient::get()
return value is that it returns "the http code".Sometimes it returns -1. I guess that happens when something fails while sending the request, or parsing the response (if you even got one), so there's no http code to be returned.
However
If there already exists a way to get that kind of information, then that needs to be documented too.
The text was updated successfully, but these errors were encountered: