wget - 如果 && a.html 都存在,wget 将替换下载的密钥
问题描述
使用 3 个文件设置简单的静态 http-server。假设主机是http://127.0.0.1:8082。
- a && a.html,内容相同,包含指向的链接
b
<body>
<a href="b"></a>
</body>
- b,其中包含 2 个指向同名 url 但后缀不同的链接。
<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
解决方案
推荐阅读
- javascript - 使用 Jquery Validator 和 Sweetalert 进行表单提交确认框
- python - TypeError:non_max_suppression() 得到了一个意外的关键字参数“score_threshold”
- r - visreg:在一个图中覆盖两个模型
- sorting - 角材料表排序行为导致错误的顺序
- bash - Bash script error "unexpected token" determining php command
- node.js - git status 没有显示我更改的文件
- c++ - 将语言环境设置为用户首选的语言环境,除了 std::locale::numeric
- swift - How to populate table view with custom object?
- c++ - 创建蜂窝网络标识符和用户,然后将其保存在 txt 文件中
- java - 是否可以在 Java Spring 中使用具有一个 URI 的两个控制器类?