amtm icon indicating copy to clipboard operation
amtm copied to clipboard

"https_proxy=xxxx" env variable causes Entware update check to fail.

Open Max33Verstappen opened this issue 1 year ago • 5 comments

Starting from version 5.0, if I run https_proxy=xxxx amtm, all the Entware servers fail to reach, while other modules are fine. The issue is not present in 4.x. https_proxy=xxxx opkg update itself works as expected. 2024-12-10_12 49 33 956_putty_ftp-user@ssh192 168 33 123_-_KiTTY

Max33Verstappen avatar Dec 10 '24 05:12 Max33Verstappen

What do you expect me to do?

I use curl -IsL https://$server | head -n 1 | grep 'OK\|Found' to check if they are responding. The three servers are bin.entware.net, entware.diversion.ch and mirrors.cernet.edu.cn/entware

Can you play around and see if curl needs a proxy option added to the command? I have currently no way of testing a proxy environment.

decoderman avatar Dec 10 '24 16:12 decoderman

Sorry, I should've clarified a few things.

  1. It seems that the "curl" from firmware (i.e. /usr/sbin/curl) doesn't support proxies, thus ignoring these env vars, so there's no issue used this way.
  2. Because of the reason above, I mount the "curl" from "entware" (i.e. /opt/bin/curl) to override the /usr/sbin/curl.
  3. As a consequence, when using the /opt/bin/curl with a proxy, executing curl -IsL https://bin.entware.net, and when succeeding, the output is: 2024-12-12_02 39 11 508_putty_ftp-user@ssh192 168 33 123_-_KiTTY Note there're two extra lines, which cause curl -IsL https://$server/ | head -n 1 | grep 'OK\|Found' to always return false.

So this's NOT necessarily a bug when running on its bare bones, but it may cause this issue when used with the "curl" supporting proxies and used with one.

-------Edit------ If curl is installed from "entware", /opt/bin has precedence above /usr/sbin in $PATH and is used with a proxy, the problem also occurs.

Max33Verstappen avatar Dec 11 '24 18:12 Max33Verstappen

If curl is installed from "entware", /opt/bin has precedence above /usr/sbin in $PATH and is used with a proxy, the problem also occurs.

I would prefer not to have to change the new method with curl instead of the venerable ping to determine if a server is reachable during the install and subsequent Entware operations within amtm. It gets convoluted quickly in the code logic.

As you are the only one reporting this so far I can offer to modify the logic to use /opt/bin/curl if present. But this only comes into effect for operations after Entware is installed and you'd have to install the package yourself to benefit from it.

decoderman avatar Dec 13 '24 14:12 decoderman

Are you still looking for a resolution of this? Say, if you increase | head -n 1 to | head -n 4 or so will it work with a proxy?

decoderman avatar Apr 12 '25 11:04 decoderman

Sorry for the late reply. Yes. | head -n 3 does the job. The output is: Image

Max33Verstappen avatar Apr 15 '25 10:04 Max33Verstappen