使用Idhttp控件post了一个数据包之后,服务器返回302数据包如下:
HTTP/1.1 302 Found
Date: Fri, 19 Oct 2007 08:37:15 GMT
Server: Apache
X-Powered-By: PHP/4.4.7
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: ?receipt=13325460&soccer=1
Keep-Alive: timeout=30
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=gb2312
正常情况应该重定向到:
GET /user_as/betting-entry.php?receipt=13325460&soccer=1 HTTP/1.1
而我的程序重定向到了:
GET /user_as/?receipt=13325460&soccer=1 HTTP/1.1
不知道为什么??(对比过post的数据包,没有差别)请达人解答,谢谢
HTTP/1.1 302 Found
Date: Fri, 19 Oct 2007 08:37:15 GMT
Server: Apache
X-Powered-By: PHP/4.4.7
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: ?receipt=13325460&soccer=1
Keep-Alive: timeout=30
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=gb2312
正常情况应该重定向到:
GET /user_as/betting-entry.php?receipt=13325460&soccer=1 HTTP/1.1
而我的程序重定向到了:
GET /user_as/?receipt=13325460&soccer=1 HTTP/1.1
不知道为什么??(对比过post的数据包,没有差别)请达人解答,谢谢
begin
Result := wnGoToURL;
Request.URL := LLocation;
// GDG 21/11/2003. If it's a 303, we should do a get this time
// RLebeau 7/15/2004 - do a GET on 302 as well, as mentioned in RFC 2616
// RLebeau 1/11/2008 - turns out both situations are WRONG! RFCs 2068 an
// 2616 specifically state that changing the method to GET in response
// to 302 and 303 is errorneous. Indy 9 did it right by reusing the
// original method and source again and only changing the URL, so lets
// revert back to that same behavior!
{
if (LResponseCode = 302) or (LResponseCode = 303) then begin
Request.Source := nil;
Request.Method := Id_HTTPMethodGet;
end else begin
Request.Method := LMethod;
end;
}
Request.Method := LMethod;
end else begin
Result := wnJustExit;
Response.Location := LLocation;
end;