在Delphi 2010中获取服务器数据

时间:2013-06-09 18:30:17

标签: delphi http indy

我有一个问题我正在尝试在delphi 2010中使用indy中的组件idhttp,问题是我在尝试使用idHTTP1.Head()时获取以下信息:

HTTP/1.1 200 OK
Date: Mon, 16 Jun 2003 2:53:29 GMT
Server: Apache/1.3.3 (Unix) (Red Hat / Linux)
Last-Modified: Wed, October 7, 1998 11:18:14 GMT
ETag: "1813-49b-361b4df6"
Accept-Ranges: bytes
Content-Length: 1179
Connection: close
Content-Type: text / html

问题不在于我必须要获取此信息,因为我无法使用idHTTP1.Request.RawHeaders.Values​​,有人可以说我必须这样做。

1 个答案:

答案 0 :(得分:3)

你在找错了地方。您需要查看IdHTTP1.**Response**.RawHeaders。此外,所有这些值实际上都具有与之关联的各个属性,例如:

IdHTTP1.Response.ResponseVersion
IdHTTP1.Response.ResponseCode
IdHTTP1.Response.ResponseText
IdHTTP1.Response.Date
IdHTTP1.Response.Server
IdHTTP1.Response.LastModified
IdHTTP1.Response.ETag
IdHTTP1.Response.AcceptRanges
IdHTTP1.Response.ContentLength (also IdHTTP1.Response.HasContentLength)
IdHTTP1.Response.Connection
IdHTTP1.Response.ContentType