Use netcat instead of curl to save space#14
Conversation
curl+libcurl are ~141kB. Netcat, if not by default included in busybox, is 12kB
| echo | ||
| echo $payload; | ||
| sleep 1 | ||
| ) | nc $hass_host 8123` |
| @@ -1,5 +1,6 @@ | |||
| config hass 'global' | |||
| option host 'ip.or.name.example:8123' | |||
| option host 'ip.or.name.example' | |||
There was a problem hiding this comment.
why not just split/cut the previous host option to maintain backwards compatibility?
There was a problem hiding this comment.
Hmm, because now port is mandatory.
I could default to 80 if no port is given
|
Thanks for your efforts. This is a regression though (no https, redirect, iffy response handling with sleep, etc.), so I think the best approach would be to build a separate |
|
The netcat package has a lot more options than the busybox version, which has no way of setting anything besides the host and port. Therefore some workarounds and possible downsides. The "real" netcat package supports waiting for the output of the command, so I could remove sleep. Any idea how I could test this? |
|
@nstrelow http redirect (301) is supported with netcat, according to this page: |
|
I still think https out of the box is very useful |
|
if you want this to be implemented it needs to be a separate code path, not replace the curl version |
Curl is very feature rich, but comes as a heavy package, which is not needed for the simple POST to HA.
Use netcat instead, which is included in busybox by default.
While building, DEPENDS ensures that if netcat is not included in busybox, the full version of netcat is included.
Size comparison according to openwrt pkgdata:
curl(42kB)+libcurl=(99kB) = 141kB
netcat (if not included) = 12kB
Closes #13