V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
piapia123
V2EX  ›  程序员

请教一个问题, wget/telnet 在 centos 和 ubuntu 上行为不一致

  •  
  •   piapia123 · 2019-11-26 11:47:27 +08:00 · 984 次点击
    这是一个创建于 1819 天前的主题,其中的信息可能已经有所发展或是发生改变。

    请求同一个 URL: http://www.ygsw6.com/Meguihong/?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl

    ubuntu wget 返回期望结果(400 bad request):

    ubuntu@10-23-194-231:~$ wget -d http://www.ygsw6.com/Meguihong/?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl
    DEBUG output created by Wget 1.19.4 on linux-gnu.
    
    Reading HSTS entries from /home/ubuntu/.wget-hsts
    URI encoding = ‘UTF-8’
    Converted file name 'index.html?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl' (UTF-8) -> 'index.html?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl' (UTF-8)
    --2019-11-26 11:35:21--  http://www.ygsw6.com/Meguihong/?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl
    Resolving www.ygsw6.com (www.ygsw6.com)... 103.71.50.207
    Caching www.ygsw6.com => 103.71.50.207
    Connecting to www.ygsw6.com (www.ygsw6.com)|103.71.50.207|:80... connected.
    Created socket 3.
    Releasing 0x000055c545103040 (new refcount 1).
    
    ---request begin---
    GET /Meguihong/?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl HTTP/1.1
    User-Agent: Wget/1.19.4 (linux-gnu)
    Accept: */*
    Accept-Encoding: identity
    Host: www.ygsw6.com
    Connection: Keep-Alive
    
    ---request end---
    HTTP request sent, awaiting response...
    ---response begin---
    HTTP/1.1 400 Bad Request
    Content-Type: text/html; charset=us-ascii
    Server: Microsoft-HTTPAPI/2.0
    Date: Tue, 26 Nov 2019 03:38:16 GMT
    Connection: close
    Content-Length: 334
    
    ---response end---
    400 Bad Request
    URI content encoding = ‘us-ascii’
    Closed fd 3
    2019-11-26 11:35:22 ERROR 400: Bad Request.
    

    centos wget 一直重试 retrying:

    [root@10-23-103-1 ~]# wget -d http://www.ygsw6.com/Meguihong/?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl
    DEBUG output created by Wget 1.14 on linux-gnu.
    
    URI encoding = ‘UTF-8’
    Converted file name 'index.html?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl' (UTF-8) -> 'index.html?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl' (UTF-8)
    Converted file name 'index.html?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl' (UTF-8) -> 'index.html?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl' (UTF-8)
    --2019-11-26 11:42:30--  http://www.ygsw6.com/Meguihong/?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl
    Resolving www.ygsw6.com (www.ygsw6.com)... 103.71.50.207
    Caching www.ygsw6.com => 103.71.50.207
    Connecting to www.ygsw6.com (www.ygsw6.com)|103.71.50.207|:80... connected.
    Created socket 3.
    Releasing 0x0000000001ef6d30 (new refcount 1).
    
    ---request begin---
    GET /Meguihong/?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl HTTP/1.1
    User-Agent: Wget/1.14 (linux-gnu)
    Accept: */*
    Host: www.ygsw6.com
    Connection: Keep-Alive
    
    ---request end---
    HTTP request sent, awaiting response... No data received.
    Closed fd 3
    Retrying.
    
    --2019-11-26 11:42:32--  (try: 2)  http://www.ygsw6.com/Meguihong/?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl
    Found www.ygsw6.com in host_name_addresses_map (0x1ef6d30)
    Connecting to www.ygsw6.com (www.ygsw6.com)|103.71.50.207|:80... connected.
    Created socket 3.
    Releasing 0x0000000001ef6d30 (new refcount 1).
    
    ---request begin---
    GET /Meguihong/?7Ek3Nf1Gg7Al9El7Gt8Mu3Qr5Jj4Nl HTTP/1.1
    User-Agent: Wget/1.14 (linux-gnu)
    Accept: */*
    Host: www.ygsw6.com
    Connection: Keep-Alive
    
    ---request end---
    HTTP request sent, awaiting response... No data received.
    Closed fd 3
    Retrying.
    

    又分别 telnet 了该 url 的 host 的 80 端口

    ubuntu telnet 保持连接:

    ubuntu@10-23-194-231:~$ telnet www.ygsw6.com 80
    Trying 103.71.50.207...
    Connected to www.ygsw6.com.
    Escape character is '^]'.
    

    centos telnet 断开连接:

    [root@10-23-103-1 ~]# telnet www.ygsw6.com 80
    Trying 103.71.50.207...
    Connected to www.ygsw6.com.
    Escape character is '^]'.
    Connection closed by foreign host.
    

    想请教下各位有遇到类似问题么

    1 条回复    2019-11-26 11:58:32 +08:00
    imn1
        1
    imn1  
       2019-11-26 11:58:32 +08:00
    1.14 没有处理 400 ?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3631 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 10:45 · PVG 18:45 · LAX 02:45 · JFK 05:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.