从重定向到自身的URL获取内容长度

时间:2012-01-01 09:54:04

标签: redirect header http-content-length

我想从它向我发送此标题的网址中获取内容长度:

  

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连接:Keep-Alive Content-Type:text / plain; charset = UTF-8

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

1 个答案:

答案 0 :(得分:0)

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

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进行连接)。