You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
POST /homeassistant/api/states/sensor.argon_one_addon_fan_speed HTTP/1.1
Authorization: Bearer ${SUPERVISOR_TOKEN}
Content-Length: $(echo -ne "${reqBody}"| wc -c )
${reqBody}
EOF
This is not working correctly. It is not actually replacing unix line endings with dos line endings in the HTTP data. I used the following script to confirm this:
#!/bin/bash
cat -e <<<unix2dos<<EOF
GET /world HTTP/1.1
Host: 127.0.0.1
EOF
Here is the result of this script:
# ./test
GET /world HTTP/1.1$
Host: 127.0.0.1$
$
Each line should end with ^M$ instead as is required for a proper HTTP request.
This worked in the past because aiohttp did not require proper line endings and accepted simple carriage returns. As of 3.8.5 of aiohttp this is no longer the case and all requests from this addon result in an error like this in the logs:
23-07-24 02:50:15 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 332, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadHttpMessage: 400, message:
Invalid header value char:
b'Authorization: Bearer *********************************************************************************************************410939e'
^
Please note that this has nothing to do with the Authorization header, that is simply the first header. The error will show up on whichever header is first regardless of the value.
Supervisor needs to update to aiohttp 3.8.5. I'm going to put the change in dev shortly and expect it to move to beta and stable within the next week or two. You'll have to correct this code or this addon will no longer work.
The text was updated successfully, but these errors were encountered:
Supervisor received home-assistant/supervisor#4454 from a user of this addon. After some digging the root cause is this bit of code:
HassOSArgonOneAddon/argonOne/run.sh
Lines 78 to 84 in 851bad1
This is not working correctly. It is not actually replacing unix line endings with dos line endings in the HTTP data. I used the following script to confirm this:
Here is the result of this script:
Each line should end with
^M$
instead as is required for a proper HTTP request.This worked in the past because aiohttp did not require proper line endings and accepted simple carriage returns. As of
3.8.5
of aiohttp this is no longer the case and all requests from this addon result in an error like this in the logs:Please note that this has nothing to do with the
Authorization
header, that is simply the first header. The error will show up on whichever header is first regardless of the value.Supervisor needs to update to aiohttp 3.8.5. I'm going to put the change in dev shortly and expect it to move to beta and stable within the next week or two. You'll have to correct this code or this addon will no longer work.
The text was updated successfully, but these errors were encountered: