这是您的脚本中发生的事情;这不是 HTTP 问题。重定向将导致使用相同方法 (307/308) 或GET
(302/303) 发出请求。被重定向的 AGET
永远不会变成POST
; 因此,您的问题与注销脚本中的重定向无关。
在您的情况下, schedule-so.php 似乎有某种时区检测代码。这是发生的事情:
首先注销。
GET http://dev.bridgebase.com/barmar_test/new_vugraph/webutil.php?op=logout HTTP/1.1
Host: dev.bridgebase.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.56 Safari/537.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,es;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: PHPSESSID=ub7ov6vvsrrpgq0g7cdoieqne3
这会导致预期的重定向。
HTTP/1.1 302 Moved Temporarily
Server: nginx/1.2.1
Date: Fri, 14 Sep 2012 23:00:38 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.4.3-6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php#
0
浏览器GET
的schedule-so.php。
GET http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php HTTP/1.1
Host: dev.bridgebase.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.56 Safari/537.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,es;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: PHPSESSID=ub7ov6vvsrrpgq0g7cdoieqne3
然后 schedule-so.php 以一个自动提交的表单作为响应。
HTTP/1.1 200 OK
Server: nginx/1.2.1
Date: Fri, 14 Sep 2012 23:00:38 GMT
Content-Type: text/html
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.4.3-6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Cache-control: private
Content-Length: 989
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script type="text/javascript">
function get_tz()
{
var now = new Date()
document.tz_form.offset.value = now.getTimezoneOffset()
document.tz_form.submit()
}
</script>
<object><noscript>
<p> Javascript support is needed for this page (to get your local timezone).<br />
Your browser either has no Javascript support,
or has such support disabled.<br />
As an alternative, click <a href="http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php?offset=0">here</a> to continue.<br />
All times will be GMT.</p> </noscript></object>
</head>
<body onload='get_tz()'>
<form name="tz_form" action="/barmar_test/new_vugraph/schedule-so.php" method="post">
<input type='hidden' name='offset' />
</form>
</body>
</html>
...而且onload
,JavaScript 导致表单提交,这就是 的POST
来源。
POST http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php HTTP/1.1
Host: dev.bridgebase.com
Connection: keep-alive
Content-Length: 10
Cache-Control: max-age=0
Origin: http://dev.bridgebase.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.56 Safari/537.4
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,es;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: PHPSESSID=ub7ov6vvsrrpgq0g7cdoieqne3
offset=240
终于登陆日程页面了。
HTTP/1.1 200 OK
Server: nginx/1.2.1
Date: Fri, 14 Sep 2012 23:00:38 GMT
Content-Type: text/html
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.4.3-6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Cache-control: private
Content-Length: 35892
...
因此,您需要get_tz()
在 schedule-so.php 中查找并找出将其发送到浏览器的原因。我的猜测是用户的时区存储在会话中(在注销期间会被删除)。
要更好地了解 HTTP 请求中发生的情况,请使用Fiddler。