loadURL server error (Raspberry Pi)
James Sentman
james at sentman.com
Wed Oct 16 13:08:59 EDT 2019
The “server error 3” is actually the number being returned in the HTTP status code of the reply. A “3” is not really a valid HTTP status code, so I don’t know what it means necessarily. It might even be a lower level socket error or some such. If it is an actual exit code from curl and not an HTTP status then it might mean “malformed URL” but I don’t think that can be correct since it looks like the remove machine accepts the connection and responds with an appropriate 200/OK in your debug output.
What I meant by the command line was actually the terminal in this case :) Run curl from the terminal window just something like:
curl “http://192.168.0.233/?Relay=8;value=on”
and see what it does. Can you actually separate the 2 query string variables with a semicolon like that? Or is it expecting that it is a “&” that might not matter if you’re parsing the entirety of the query string yourself and not using a standard query processor in PHP or it might.
a few other things to try. It might be something odd about switching around between http/1.1 and 1.0. You can force the loadURL command to use http/1.0 by using the "with force http1” and that might get past it.
I also see in the debug output an “unprintable” character as the second header crlf. Thats not necessarily a problem. Apple seems to change the way such things are handled internally on me with about every other system update so it may just be that the log display window is not realizing that the string is just a simple empty line and is inserting the lf or cr separately. Or it might be that the php script is not always returning a crlf pair? but in some cases it might be returning something else. that would definitely make curl unhappy with the response and it would potentially return an error even though it appears the connection is actually going through.
The last thing I would experiment with right this moment is where that “cmd” variable is coming from. It’s possible that it has a different text encoding than the rest of the URL causing things to be goofy. I would hard code it for testing so that the value is always known. And also the “chan” for that matter too. Just override the calls to not include those values at all and see if it works differently than when you concatenate that together. So something like
on wasberrycommand(chan, cmd)
loadurl "192.168.0.233/?Relay=8;value=on" with logging debug data
loadurl "1
92.168
.0.245/?Relay=8;value=on" with logging debug data
end
and see if it works properly that way where it didn’t when putting the string together all by itself.
> On Oct 15, 2019, at 5:31 PM, ard jonker <ard.jonker at xs4all.nl> wrote:
>
> James, when do you issue the Server Error 3? Is there a HTTP error/response equivalent?
> Why is there nothing in the log file on the XTension machine? Not even when debug is on:
> on wasberrycommand(chan, cmd)
> loadurl "192.168.0.233/?Relay=" & chan & ";value=" & (cmd) with logging debug data
> loadurl "1
92.168
.0.245/?Relay=" & chan & ";value=" & (cmd) with logging debug data
> end
Thanks,
James
James Sentman http://www.PlanetaryGear.org http://MacHomeAutomation.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.machomeautomation.com/pipermail/xtensionlist/attachments/20191016/2a106226/attachment.html>
More information about the XTensionList
mailing list