14K
14K

Reputation: 85

RawHeaders.Values in Delphi 2010

I'm using the component in delphi indy idhttp 2010 and I have the following problem, I'm trying to get all the values ​​of rawheaders idHTTP1.Request.RawHeaders.Values ​​['User-Agent'], the only one I know of is user agent and I wonder where I can find the list of values ​​to use in RawHeaders.Values​​.

Does anyone could help me?

Upvotes: 0

Views: 1783

Answers (1)

Arioch 'The
Arioch 'The

Reputation: 16045

Your question can be read in few ways.

You ask about "to get all the values ​​of rawheaders" - that is "read, not modify". And then you tell about "values ​​to use in RawHeaders.Values​​" - which is "write, not read".

Actually it is hard to guess what did you meant here.

Like

  • idHTTP1.Request.RawHeaders.SaveToFile('1.txt');
  • s := idHTTP1.Request.RawHeaders.CommaText;
  • with idHTTP1.Request.RawHeaders do for i := 0 to Count - 1 do begin s := Strings[i]; ... end;
  • for s in idHTTP1.Request.RawHeaders do begin ... end;

etc.


  • Alternatively if you want to write some sane and safe values, you are to start from documentation for idHTTP1.Request: http://www.indyproject.org/docsite/html/TIdEntityHeaderInfo.html
  • There you can see the link to "Hypertext Transfer Protocol version 1.1" where you can find most of them
  • Or you can add some custom non-standard headers with "X-" prefix, after testing that your server would not break when found them.
  • Also note that there are some frequently use though non-standard headers or their parameters, like in content-disposition. Some of them are probably retroactively described by communities like HTML5 working group. Or maybe not,
  • Also note that there are a number of sub-protocols built on top of HTTP. Like WebDAV. Like file transfer in Gnutella2 protocol, etc. They may add their own custom headers, that were not described in their founding HTTP protocol. Read the documentation on those protocols, you may be interested in (if any).

Upvotes: 1

Related Questions