首页 > 解决方案 > 如果 && a.html 都存在,wget 将替换下载的密钥

问题描述

使用 3 个文件设置简单的静态 http-server。假设主机是http://127.0.0.1:8082

<body>
    <a href="b"></a>
</body>
<body>
    <a href="a"></a>
    <a href="a.html"></a>
</body>

我尝试wget -E -m -p -k http://127.0.0.1:8082/a并期望两个链接b都将转换为相对路径。但事实上,结果是,

<body>
    <a href="http://127.0.0.1:8082/a"></a>
    <a href="a.html"></a>
</body>

我猜 wget 将 && a.html 视为同一个文件(与 -E 一样)。在b中转换链接时,已经存在的a被误认为没有下载,因为a.html覆盖了下载的key。


[zhong@localhost wget]$ wget -E -m -p -k http://127.0.0.1:8082/a
- 2019-02-09 20:58:42 -- http://127.0.0.1:8082/a
Connecting 127.0.0.1:8082... Connected.
HTTP request has been issued, waiting for response... 200 OK
Length: 35 [text/html]
Save to "127.0.0.1:8082/a.html"

127.0.0.1:8082/a.html 100%[=========================>] 35 - - KB/s takes 0s

2019-02-09 20:58:42 (4.17 MB/s) - Preserved "127.0.0.1:8082/a.html" [35/35])

Robots.txt is being loaded; please ignore the error message.
- 2019-02-09 20:58:42 -- http://127.0.0.1:8082/robots.txt
Reuse existing connections to 127.0.0.1:8082.
An HTTP request has been issued and is awaiting a response... 404 Not Found

2019-02-09 20:58:42 Error 404: Not Found.
Conversion from UTF-8 to UTF-8 is not supported
- 2019-02-09 20:58:42 -- http://127.0.0.1:8082/b
Reuse existing connections to 127.0.0.1:8082.
HTTP request has been issued, waiting for response... 200 OK
Length: 61 [text/html]
Save to "127.0.0.1:8082/b.html"

127.0.0.1:8082/b.html 100%[=========================>] 61 - - KB/s takes 0s

2019-02-09 20:58:42 (7.27 MB/s) - Preserved "127.0.0.1:8082/b.html" [61/61])
Conversion from UTF-8 to UTF-8 is not supported

- 2019-02-09 20:58:42 -- http://127.0.0.1:8082/a.html
Reuse existing connections to 127.0.0.1:8082.
HTTP request has been issued, waiting for response... 200 OK
Length: 35 [text/html]
Save to "127.0.0.1:8082/a.html"

127.0.0.1:8082/a.html 100%[=========================>] 35 - - KB/s takes 0s

2019-02-09 20:58:42 (2.78 MB/s) - Preserved "127.0.0.1:8082/a.html" [35/35])

Download completed -- 2019-02-09 20:58:42--
Total time: 0.009s
Downloaded: 3 files, 131 in 0s (4.46 MB/s)
Links in 127.0.0.1:8082/a.html are being converted... 1-0
Links in 127.0.0.1:8082/b.html are being converted... 1-1
Links in two files have been converted in 0.001 seconds

标签: wget

解决方案


推荐阅读