自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

從命令行使用 wget 調(diào)試網(wǎng)頁(yè)錯(cuò)誤

系統(tǒng) Linux
調(diào)試 Web 服務(wù)器的一種方法是使用 wget 命令行程序,使用 -S 選項(xiàng)來(lái)顯示所有的服務(wù)器響應(yīng)。當(dāng)使用 wget 進(jìn)行調(diào)試時(shí),我也喜歡使用 -O 選項(xiàng)將輸出保存到一些臨時(shí)文件中,以備以后需要查看其內(nèi)容。

[[424697]]

調(diào)試 Web 服務(wù)器的一種方法是使用 wget 命令行程序。

有時(shí)在管理一個(gè)網(wǎng)站時(shí),事情會(huì)被搞得一團(tuán)糟。你可能會(huì)刪除一些陳舊的內(nèi)容,用重定向到其他頁(yè)面來(lái)代替。后來(lái),在做了其他改動(dòng)后,你發(fā)現(xiàn)一些網(wǎng)頁(yè)變得完全無(wú)法訪問(wèn)了。你可能會(huì)在瀏覽器中看到一個(gè)錯(cuò)誤:“該頁(yè)面沒(méi)有正確重定向”,并建議你檢查你的 cookie。 

Redirect loop example in Firefox

調(diào)試這種情況的一個(gè)方法是使用 wget 命令行程序,使用 -S 選項(xiàng)來(lái)顯示所有的服務(wù)器響應(yīng)。當(dāng)使用 wget 進(jìn)行調(diào)試時(shí),我也喜歡使用 -O 選項(xiàng)將輸出保存到一些臨時(shí)文件中,以備以后需要查看其內(nèi)容。

  1. $ wget -O /tmp/test.html -S http://10.0.0.11/announce/
  2. --2021-08-24 17:09:49-- http://10.0.0.11/announce/
  3. Connecting to 10.0.0.11:80... connected.
  4.  
  5. HTTP request sent, awaiting response...
  6.  
  7. HTTP/1.1 302 Found
  8. Date: Tue, 24 Aug 2021 22:09:49 GMT
  9. Server: Apache/2.4.48 (Fedora)
  10. X-Powered-By: PHP/7.4.21
  11. Location: http://10.0.0.11/assets/
  12. Content-Length: 0
  13. Keep-Alive: timeout=5, max=100
  14. Connection: Keep-Alive
  15. Content-Type: text/html; charset=UTF-8
  16. Location: http://10.0.0.11/assets/ [following]
  17. --2021-08-24 17:09:49-- http://10.0.0.11/assets/
  18. Reusing existing connection to 10.0.0.11:80.
  19.  
  20. HTTP request sent, awaiting response...
  21. HTTP/1.1 302 Found
  22. Date: Tue, 24 Aug 2021 22:09:49 GMT
  23. Server: Apache/2.4.48 (Fedora)
  24. X-Powered-By: PHP/7.4.21
  25. Location: http://10.0.0.11/announce/
  26. Content-Length: 0
  27. Keep-Alive: timeout=5, max=99
  28. Connection: Keep-Alive
  29. Content-Type: text/html; charset=UTF-8
  30. Location: http://10.0.0.11/announce/ [following]
  31. --2021-08-24 17:09:49-- http://10.0.0.11/announce/
  32. Reusing existing connection to 10.0.0.11:80.
  33. .
  34. .
  35. .
  36. 20 redirections exceeded.

我在這個(gè)輸出中省略了很多重復(fù)的內(nèi)容。通過(guò)閱讀服務(wù)器的響應(yīng),你可以看到 http://10.0.0.11/announce/ 立即重定向到 http://10.0.0.11/assets/,然后又重定向到 http://10.0.0.11/announce/。以此類推。這是一個(gè)無(wú)休止的循環(huán),wget 將在 20 次重定向后退出。但有了這些調(diào)試信息,你可以修復(fù)重定向,避免循環(huán)。 

 

責(zé)任編輯:龐桂玉 來(lái)源: Linux中國(guó)
相關(guān)推薦

2014-04-10 10:10:16

KVMDebianUbuntu

2020-12-06 08:00:46

scanimage命令行Linux

2012-02-08 16:37:36

ibmdw

2018-03-14 14:27:00

2023-08-01 13:31:18

模型Alpacaicuna

2020-10-31 08:20:39

curl命令命令行互聯(lián)網(wǎng)

2018-06-19 16:05:27

LinuxStratis存儲(chǔ)

2010-05-27 14:48:45

SVN命令行使用說(shuō)明

2009-09-22 14:17:05

2022-06-16 14:54:53

hilog工具鴻蒙

2016-12-15 08:30:02

Linux命令

2017-03-13 08:50:35

科技新聞早報(bào)

2010-05-11 11:34:44

2010-02-04 15:17:48

Linux wget

2019-02-13 09:20:13

Linux命令行more

2022-06-30 12:19:22

Linux

2019-08-27 08:00:10

OpenStack命令虛擬機(jī)

2019-07-15 05:50:19

Linux命令行VirtualBox版

2019-01-22 13:46:01

LinuxUnix系統(tǒng)命令行

2014-10-22 12:03:14

Linux嗅探HTTP
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)