Curl
wget: 伺服器返回錯誤: HTTP/1.1 401 Unauthorized from BusyBox
我知道應該在軸開發人員社區論壇上提出 Axis 相機 API 特定問題,但是這個問題對於 http 網路訪問來說似乎是通用的,所以試圖在這裡獲得一些幫助
我將 Axis IP 攝影機連接到本地網路。我在通過 BusyBox 中的 wget/curl 命令訪問相機 API 時遇到問題(同一本地網路中的嵌入式板)
從視窗 cygwin 的 wget 命令通過其 API 訪問相機時,它給了我有效的響應:
admin@LAPTOP /cygdrive/c/axis $ wget -O imageformat.txt 'http://root:pass@192.168.0.90/axis-cgi/param.cgi?action=list&group=Properties.Image.Format' --2021-06-30 11:13:07-- http://root:*password*@192.168.0.90/axis-cgi/param.cgi?action=list&group=Properties.Image.Format Connecting to 192.168.0.90:80... connected. HTTP request sent, awaiting response... 401 Unauthorized Authentication selected: Digest realm="AXIS_ACCC8E6E45B0", nonce="XTNm1/7FBQA=2e3d1152262381d33e3cf6abe6c728db4921c928", algorithm=MD5, qop="auth" Reusing existing connection to 192.168.0.90:80. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/plain] Saving to: ‘imageformat.txt’ imageformat.txt [ <=> ] 47 --.-KB/s in 0s 2021-06-30 11:13:07 (470 KB/s) - ‘imageformat.txt’ saved [47]
但是,當我嘗試從 BusyBox shell 的 wget/curl 命令實現相同的功能時,它以“錯誤:HTTP/1.1 401 Unauthorized”失敗,我確信相機憑據(使用者名/密碼)是正確的(因為我能夠訪問相機來自具有相同憑據的瀏覽器和 Windows cygwin shell):
root@admin:~# curl 'http://root:pass@192.168.0.90/axis-cgi/param.cgi?action=list&group=Properties.Image.Format' <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>401 Unauthorized</title> </head><body> <h1>Unauthorized</h1> <p>This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.</p> </body></html> root@mainboard-sbs:~# wget -O imageformat.txt 'http://root:pass@192.168.0.90/axis-cgi/param.cgi?action=list&group=Properties.Image.Format' Connecting to 192.168.0.90 (192.168.0.90:80) wget: server returned error: HTTP/1.1 401 Unauthorized
可能是什麼問題?我是否缺少來自busybox 的wget 的任何身份驗證/證書參數?
Version on windows machine: admin@LAPTOP /cygdrive/c/axis $ wget --version GNU Wget 1.21.1 built on cygwin. Version on busybox machine: root@admin:~# wget BusyBox v1.24.1 (2019-02-19 13:37:55 IST) multi-call binary.
因此,如果有一天它可以幫助某人,我將發布自己查詢的答案…
wget(v1.18)附帶busybox(v1.24.1)不是全功能的wget,它安裝了最少的開關,所以將wget配方更新到v1.21.1解決了這個問題。