【问题标题】:Get content-length from a URL which redirects to itself从重定向到自身的 URL 获取内容长度
【发布时间】:2012-01-31 07:57:53
【问题描述】:

我想从它向我发送此标头的 URL 中获取内容长度:

HTTP/1.1 301 永久移动日期:2012 年 1 月 1 日星期日 09:34:44 GMT 服务器:Apache 位置:https://www.sugarsync.com,www.sugarsync.com/pf/D6304231_0192919_76577 Keep-Alive:timeout=300,max= 9793 连接:保持活动内容类型:文本/纯文本;字符集=UTF-8

问题在于原始 URL 与此标头中发送的新 URL 相同!换句话说:我从 URL:https://www.sugarsync.com/pf/D6304231_0192919_76577 获取标题,在我得到的标题中,它重定向到同一页面。

【问题讨论】:

    标签: redirect header http-content-length


    【解决方案1】:

    您提供的网址似乎没有问题:

    C:\Users\rleahy>openssl s_client -quiet -connect sugarsync.com:443
    Loading 'screen' into random state - done
    depth=1 /C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certificates
    .godaddy.com/repository/CN=Go Daddy Secure Certification Authority/serialNumber=
    07969287
    verify error:num=20:unable to get local issuer certificate
    verify return:0
    HEAD /pf/D6304231_0192919_76577 HTTP/1.1
    host:www.sugarsync.com
    
    HTTP/1.1 200 OK
    Date: Sun, 01 Jan 2012 10:16:13 GMT
    Server: Apache
    Set-Cookie: JSESSIONID=22C35505626E63560F5F00BDE86BD458; Path=/; Secure
    Content-Disposition: attachment;filename="Algorithms(01).rar"
    Accept-Ranges: bytes
    Etag: file_1319015834000
    Last-Modified: Wed, 19 Oct 2011 09:17:14 GMT
    Content-Length: 468987
    Content-Type: application/x-download
    Set-Cookie: NSC_wt_xxx.tvhbstzod.dpn_443=ffffffff090d78d545525d5f4f58455e445a4a4
    2378b;path=/;secure;httponly
    

    您确定不是使用 HTTP 而不是 HTTPS 连接吗?使用 HTTP 连接确实会给出 301(实际上是要求您使用 HTTPS 进行连接)。

    【讨论】:

      猜你喜欢
      • 2019-09-23
      • 1970-01-01
      • 2011-06-16
      • 1970-01-01
      • 1970-01-01
      • 2018-03-21
      • 1970-01-01
      • 1970-01-01
      • 2023-03-16
      相关资源
      最近更新 更多