我对 1.10 及更高版本的 wget 行为有问题。
我正在使用 wget 从我的应用程序下载报告。
版本1.10.2:
>wget-1.10.2.exe --http-user=trader --http-passwd=trader http://192.168.1.222:8080/myapp/reports/FP201010271100
--11:52:46-- http://192.168.1.222:8080/myapp/reports/FP201010271100
=> `FP201010271100.5'
Connecting to 192.168.1.222:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/csv]
[ <=> ] 82,068 --.--K/s
11:52:46 (1019.65 KB/s) - `FP201010271100' saved [82068]
版本1.11.4:
>wget-1.11.4.exe --http-user=trader --http-passwd=trader http://192.168.1.222:8080/myapp/reports/FP201010271100
--2010-10-27 12:15:10-- http://192.168.1.222:8080/myapp/reports/FP201010271100
Connecting to 192.168.1.222:8080... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://192.168.1.222:8080/myapp/spring_security_login [following]
--2010-10-27 12:15:10-- http://192.168.1.222:8080/myapp/spring_security_login
Reusing existing connection to 192.168.1.222:8080.
HTTP request sent, awaiting response... 404 Not Found
2010-10-27 12:15:10 ERROR 404: Not Found.
1.11及以后的版本需要添加一些参数吗?
更新 - Wireshark 转储
版本1.10.2:
No. Time Source Destination Protocol Info
17 13.756462 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM=1
18 13.767667 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1460
19 13.767721 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=1 Ack=1 Win=64240 Len=0
20 13.774991 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [PSH, ACK] Seq=1 Ack=1 Win=64240 Len=189
21 13.776327 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=1 Ack=190 Win=65535 Len=0
22 13.933894 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=1 Ack=190 Win=65535 Len=1420
23 13.934039 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=1421 Ack=190 Win=65535 Len=1276
24 13.934180 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=2697 Win=64240 Len=0
25 13.935194 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=2697 Ack=190 Win=65535 Len=1348
26 13.945109 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=4045 Ack=190 Win=65535 Len=1348
27 13.945473 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=5393 Win=64240 Len=0
28 13.948389 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=5393 Ack=190 Win=65535 Len=1420
29 13.948443 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=6813 Ack=190 Win=65535 Len=1420
30 13.948491 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=8233 Win=64240 Len=0
31 13.948555 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=8233 Ack=190 Win=65535 Len=1420
32 13.948604 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=9653 Win=62820 Len=0
33 13.948650 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=9653 Ack=190 Win=65535 Len=1132
34 13.954507 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=10785 Win=64240 Len=0
35 13.955210 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=10785 Ack=190 Win=65535 Len=1348
36 13.972055 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=12133 Ack=190 Win=65535 Len=1348
37 13.972179 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=13481 Win=64240 Len=0
38 13.973166 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=13481 Ack=190 Win=65535 Len=1348
39 13.973230 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=14829 Ack=190 Win=65535 Len=1348
40 13.973290 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=16177 Win=64240 Len=0
41 13.975002 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=16177 Ack=190 Win=65535 Len=1348
42 13.975035 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=17525 Ack=190 Win=65535 Len=1348
43 13.975057 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=18873 Win=64240 Len=0
44 13.975210 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=18873 Ack=190 Win=65535 Len=1348
45 13.975523 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=20221 Ack=190 Win=65535 Len=1348
46 13.975553 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=21569 Win=64240 Len=0
47 13.983036 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=21569 Ack=190 Win=65535 Len=1348
48 13.983260 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=22917 Ack=190 Win=65535 Len=1420
49 13.983290 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=24337 Win=64240 Len=0
50 13.983324 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=24337 Ack=190 Win=65535 Len=1276
51 13.983833 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=25613 Ack=190 Win=65535 Len=1348
52 13.983867 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=26961 Win=64240 Len=0
53 13.984210 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=26961 Ack=190 Win=65535 Len=1348
54 13.984641 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=28309 Ack=190 Win=65535 Len=1420
55 13.984672 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=29729 Win=64240 Len=0
56 13.984705 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=29729 Ack=190 Win=65535 Len=1276
57 13.984946 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=31005 Ack=190 Win=65535 Len=1348
58 13.984968 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=32353 Win=64240 Len=0
59 13.986763 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=32353 Ack=190 Win=65535 Len=1348
60 13.986792 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=33701 Ack=190 Win=65535 Len=1420
61 13.987044 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=35121 Win=64240 Len=0
62 13.987088 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=35121 Ack=190 Win=65535 Len=1276
63 13.987180 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=36397 Ack=190 Win=65535 Len=1348
64 13.987194 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=37745 Win=64240 Len=0
65 13.993156 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=37745 Ack=190 Win=65535 Len=1420
66 13.993181 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=39165 Ack=190 Win=65535 Len=1276
67 13.993220 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=40441 Win=64240 Len=0
68 14.013124 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=40441 Ack=190 Win=65535 Len=1348
69 14.014498 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=41789 Ack=190 Win=65535 Len=1420
70 14.014539 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=43209 Win=64240 Len=0
71 14.014574 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=43209 Ack=190 Win=65535 Len=1276
72 14.014585 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=44485 Ack=190 Win=65535 Len=1348
73 14.014595 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=45833 Win=64240 Len=0
74 14.015232 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=45833 Ack=190 Win=65535 Len=1348
75 14.015248 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=47181 Ack=190 Win=65535 Len=1348
76 14.015263 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=48529 Win=64240 Len=0
77 14.015911 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=48529 Ack=190 Win=65535 Len=1348
78 14.016112 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=49877 Ack=190 Win=65535 Len=1348
79 14.016132 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=51225 Win=64240 Len=0
80 14.016643 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=51225 Ack=190 Win=65535 Len=1348
81 14.016865 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=52573 Ack=190 Win=65535 Len=1348
82 14.016887 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=53921 Win=64240 Len=0
83 14.017095 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=53921 Ack=190 Win=65535 Len=1348
84 14.018786 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=55269 Ack=190 Win=65535 Len=1420
85 14.018823 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=56689 Win=64240 Len=0
86 14.018981 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=56689 Ack=190 Win=65535 Len=1276
87 14.018994 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=57965 Ack=190 Win=65535 Len=1348
88 14.019008 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=59313 Win=64240 Len=0
89 14.024666 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=59313 Ack=190 Win=65535 Len=1420
90 14.024685 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=60733 Ack=190 Win=65535 Len=1276
91 14.024712 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=62009 Win=64240 Len=0
92 14.025221 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=62009 Ack=190 Win=65535 Len=1348
93 14.026959 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=63357 Ack=190 Win=65535 Len=1348
94 14.027000 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=64705 Win=64240 Len=0
95 14.027035 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=64705 Ack=190 Win=65535 Len=1348
96 14.027045 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=66053 Ack=190 Win=65535 Len=1348
97 14.027053 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=67401 Win=64240 Len=0
98 14.027637 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=67401 Ack=190 Win=65535 Len=1348
99 14.028162 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=68749 Ack=190 Win=65535 Len=1348
100 14.028190 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=70097 Win=64240 Len=0
101 14.028634 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=70097 Ack=190 Win=65535 Len=1348
102 14.029058 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=71445 Ack=190 Win=65535 Len=1348
103 14.029076 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=72793 Win=64240 Len=0
104 14.029392 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=72793 Ack=190 Win=65535 Len=1348
105 14.029819 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=74141 Ack=190 Win=65535 Len=1348
106 14.029841 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=75489 Win=64240 Len=0
107 14.030139 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=75489 Ack=190 Win=65535 Len=1348
108 14.030510 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=76837 Ack=190 Win=65535 Len=1420
109 14.030530 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=78257 Win=64240 Len=0
110 14.030557 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=78257 Ack=190 Win=65535 Len=1276
111 14.031644 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=79533 Ack=190 Win=65535 Len=1348
112 14.031673 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=80881 Win=64240 Len=0
113 14.032084 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [PSH, ACK] Seq=80881 Ack=190 Win=65535 Len=1411
114 14.032093 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [FIN, ACK] Seq=82292 Ack=190 Win=65535 Len=0
115 14.032104 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [ACK] Seq=190 Ack=82293 Win=62829 Len=0
116 14.040620 10.0.2.15 172.25.9.238 TCP kazaa > glrpc [FIN, ACK] Seq=190 Ack=82293 Win=62829 Len=0
117 14.041564 172.25.9.238 10.0.2.15 TCP glrpc > kazaa [ACK] Seq=82293 Ack=191 Win=65535 Len=0
版本1.11.4:
No. Time Source Destination Protocol Info
1 0.000000 10.0.2.15 172.25.9.238 TCP mpc-lifenet > glrpc [SYN] Seq=0 Win=64240 Len=0 MSS=1460 SACK_PERM=1
2 0.021323 172.25.9.238 10.0.2.15 TCP glrpc > mpc-lifenet [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1460
3 0.021379 10.0.2.15 172.25.9.238 TCP mpc-lifenet > glrpc [ACK] Seq=1 Ack=1 Win=64240 Len=0
4 0.026476 10.0.2.15 172.25.9.238 giFT Response: GET /intraday/faces/reports/FP201010271100 HTTP/1.0
5 0.026990 172.25.9.238 10.0.2.15 TCP glrpc > mpc-lifenet [ACK] Seq=1 Ack=143 Win=65535 Len=0
6 0.040137 172.25.9.238 10.0.2.15 giFT Request: HTTP/1.0 302 Found
7 0.078133 10.0.2.15 172.25.9.238 giFT Response: GET /intraday/spring_security_login HTTP/1.0
8 0.078741 172.25.9.238 10.0.2.15 TCP glrpc > mpc-lifenet [ACK] Seq=237 Ack=278 Win=65535 Len=0
9 0.097840 172.25.9.238 10.0.2.15 giFT Request: HTTP/1.0 404 Not Found
10 0.102113 10.0.2.15 172.25.9.238 TCP mpc-lifenet > glrpc [RST, ACK] Seq=278 Ack=1585 Win=0 Len=0
11 0.103253 172.25.9.238 10.0.2.15 giFT Request: ipt src="/myapp/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js" type="text/javascript"
12 0.103481 10.0.2.15 172.25.9.238 TCP mpc-lifenet > glrpc [RST] Seq=278 Win=0 Len=0
13 0.103657 172.25.9.238 10.0.2.15 giFT Request: .startBody = new Date();
14 0.103906 10.0.2.15 172.25.9.238 TCP mpc-lifenet > glrpc [RST] Seq=278 Win=0 Len=0
15 0.104174 172.25.9.238 10.0.2.15 TCP glrpc > mpc-lifenet [RST, ACK] Seq=3779959295 Ack=278 Win=0 Len=0
16 0.112019 172.25.9.238 10.0.2.15 TCP glrpc > mpc-lifenet [RST, ACK] Seq=3779959295 Ack=278 Win=0 Len=0
答案1
只需添加--auth-no-challenge
参数即可。
如果指定此选项,Wget 将为所有请求发送基本 HTTP 身份验证信息(明文用户名和密码),就像 Wget 1.10.2 及之前版本默认情况下所做的那样。
欲了解详细信息,请阅读错误描述
答案2
我刚刚在我的机器上检查了 wget 1.12,你的参数很好。输出看起来好像服务器向两个进程发送了不同的数据:
第一个直接给你“200”(因为一切都很好),第二个发送“302”意味着重定向。但它重定向到的页面(http://192.168.1.222:8080/myapp/spring_security_login)不存在。我会首先查看服务器应用程序,因为 wget 中的基本 HTTP 身份验证在相当长一段时间内没有发生变化(我的所有脚本仍在运行,其中一些已经使用多年)