This is a very simple parse solution, but works.

            HeaderList := TStringList.Create;
            HeaderList.NameValueSeparator := ':';
            HeaderList.Text := YourHeaderString; //must be a string with 
header items delimited by carriage return and line feed, as it came in 
the raw request.

In this case you get a strings list where the names are the headers 
fields and the values are the fields data.
you can easily consult/add/change a field.
Example:
              i:=HeaderList.IndexOfName('Content-length');
              HeaderList.Values['Connection'] := ' Keep-Alive';
              HeaderList.Values['Transfer-Encoding'] := ' chunked';

To transform again in raw header
YourHeaderString:=HeaderList.Text;

> I am looking for a way to PARSE and ALTER http request headers.
>
> Currently I have the Header in a STRING, and want to ADD Headers if they do
> not EXIST.
>
> I am not sure what Class to use: I have looked at
>
> var
> web : TWebRequest;
>
> web := TWebRequest.Create;
> web.Content := s; // set the Header , not even sure this is correct.
>
> any help appreciated.
>
>
>
>
>
>   

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to