-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
empty http responses (ESPEasy 2.0 on SONOFF basic) #1066
Comments
Do you have any idea when this got 'broken'? |
@TD-er it's my first try to use the current V2 branch on a sonoff. All the tutorials I found were based on the older 120 build. Funny thing is: it works once in every few attempts, I don't think I have a "good" response captured in the debug log, though. I should say there seem to be some more issues, either with the flash chip or the wlan implementation, uploading the config.dat takes ~30 seconds It's really odd, actually triggering the GPIOs via http works just fine, the web server responses are what is unpredictable. |
The 'funny' thing is that we're using two kinds of 'webservices' to serve data. |
ok, /json?cmd=status,gpio,12 works in 100% of the cases. |
looking at my debug data further up:
|
I guess this is where it all happens:
Looks like the debug output would happen whether there's enough free heap or not, although the resulting log shows that there clearly is enough heap.
|
Regarding the Status command... It doesn't seem to work properly. If I use pulse commands etc the state is kept "1" even if the state is going back to "0" after the duration has ended. |
Platform IO 1.5.0 uses Arduino ESP8266 core 2.3.0 The last one is not being used in the builds we make, since 2.4.0 gives some strange issues with respect to the internal LWIP library used. (although it is much faster) |
it seems that neither the command? nor the json? url triggers the sendContentBlocking code...
the debug output here is the expected json, however it seems to never make it to the web response. |
oh interesting, I just managed to capture a "good" (well, not so, maybe) response, that is, a reply that is not empty:
Two things:
|
Can you check the info page in the Tools tab? |
don't think so. |
The thing is, the hex value at the start, is some indication of the chunk size. |
in the first post, I have a snippet from wireshark - at least the response header sais http 1.1 |
Can you change something in these two lines: Lines 35 to 36 in 9913848
Change |
in the version that I have checked out, this looks like this:
and for completeness: this is the original request, so it's all http 1.1
|
That flush part, I added yesterday, so it should be included in the latest builds. (saves the trouble of building yourself) |
ok, then I'll pull in upstream again and see if there's change. |
right, pulled the upstream v2.0 branch again, the flush(); is now in, the result is unchanged.
The behaviour is very predictable: edit2:
it would seem that this code portion is triggering the send, as it checks the buffer size. |
this code 0x190 (decimal 400) is the chunk size. It looks like the handler of this URL is not calling the endStream() (or how it's called). |
I have added TXBuffer.startStream() and TXBuffer.endStream() before at the start and end of the handler, respectively. That didn't fix it though. Let me give this another try. |
What is the exact URL you're trying to get? |
There is a proper startStream() and endStream() in void handle_controllers() |
this is how I have changed the code now:
The result is still no json output, but I can see that TXBuffer.buf really does contain the json data (in log) and that a 67 character chunk is being sent. At least the log claims that
on the wire, however, I can't see that and it doesn't arrive in my browser either. |
not handle_controllers, handle_control! I got confused by that, too ;-) |
That function is messed-up. |
that Sir did the trick! So I had done the right thing but really WebServer.send() has to be called after the stream has been closed? I thought since it did contain the content header, it would have to come first. |
Well your issue is solved, my task remains to find out how this function got messed up like this. :) |
as said: in the current v2.0 branch, this is missing the startStream and endStream calls alltogether. I had just put it in the wrong place. |
There wasn't a proper start/end for the streaming webserver. See discussion on issue letscontrolit#1066
…t#1079) [issue letscontrolit#1066] Fix Webserver handle_control
Steps to reproduce
Build the current 2.0 branch for 1024kB/DOUT and flash to a SONOFF basic (integrated ESP8266 relay)
on any linux system go
'''wget -O - http:///control?cmd=status,gpio,12'''
watch an empty reply probably 7 out of 8 times
problem is reproducible after reboots, soft and hard on two different SONOFF boards
Expected behavior
Should respond with a json structure describing the state of gpio 12
Actual behavior
Empty response:
after that, the browser sends a fin ack and ESPEasy responds with a rst ack
from the ESPEasy log:
System configuration
Hardware:
SONOFF Basic
Software or git version:
Built off a git pull from the v2.0 branch on Sunday, March 11th
The text was updated successfully, but these errors were encountered: