-
Notifications
You must be signed in to change notification settings - Fork 31
Use netcat instead of curl to save space #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
curl+libcurl are ~141kB. Netcat, if not by default included in busybox, is 12kB
echo | ||
echo $payload; | ||
sleep 1 | ||
) | nc $hass_host 8123` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
harcoded port
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch 👍
@@ -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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just split/cut the previous host option to maintain backwards compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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