openwrt_hass_devicetracker
openwrt_hass_devicetracker copied to clipboard
Use netcat instead of curl to save space
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
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 -tiny
package.
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. I think it supports https, not sure about redirects.
Any idea how I could test this?
@nstrelow http redirect (301) is supported with netcat, according to this page: http://infoheap.com/use-netcat-nc-to-test-http-url-redirection/
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