openwrt_hass_devicetracker icon indicating copy to clipboard operation
openwrt_hass_devicetracker copied to clipboard

Use netcat instead of curl to save space

Open nstrelow opened this issue 5 years ago • 5 comments

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

nstrelow avatar Dec 05 '18 01:12 nstrelow

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.

mueslo avatar Dec 05 '18 11:12 mueslo

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 avatar Dec 05 '18 13:12 nstrelow

@nstrelow http redirect (301) is supported with netcat, according to this page: http://infoheap.com/use-netcat-nc-to-test-http-url-redirection/

SamJongenelen avatar May 21 '19 20:05 SamJongenelen

I still think https out of the box is very useful

ohadlevy avatar Jul 18 '19 08:07 ohadlevy

if you want this to be implemented it needs to be a separate code path, not replace the curl version

mueslo avatar Nov 22 '19 12:11 mueslo