Internet Direct (Indy)
Home
PreviousUpNext
TIdCustomHTTP.Post Method (string, TIdStream, TIdStream)

Send HTTP data to a web server or CGI program.

Pascal
procedure Post(
    AURL: string; 
    ASource: TIdStream; 
    AResponseContent: TIdStream
); overload;
Parameters 
Description 
ASource 
TStrings or stream containing the request data.
 
AResponseContent 
Destination for response data. 
URL 
Location of the host or CGI application.
 

Post is an overloaded method that is used to send data specified in ASource to the resource location in AURL. Post is overloaded to allow use of either TIdStrings or TIdStream object instances in ASource, and also provides procedure- and function-based variants of the method to allow String return values or storage of return values in AResponseContent. 

By default, Indy will restrict all POST requests to the use of HTTP version 1.0 in the headers for the request. This occurs because some HTTP servers do not respect the RFC for HTTP 1.1 to the full extent of the specification. In particular, most servers do not send or expect to receive the 100-Continue HTTP header. 

To use HTTP version 1.1 requests when calling the Post method, include the value hoKeepOrigProtocol in the HTTPOptions property. Please note that this does not include retaining a HTTP persistent connection for the session; persistent connections established using the HTTP 'Keep-Alive' header are always closed prior to performing an HTTP Post operation. 

This variant of the Post method prepares an HTTP request from the values in ASource, but does not perform any preprocessing for the content type of the request or values in the ASource stream. Set the ContentType property in the Reqest to indicate if ASource contains form-url encoded or multipart data. 

Post calls a protected method in the HTTP client to perform the HTTP transfer.

Exceptions 
Description 
EAssertionFailed 
Raised if the source stream or the stream for the response content are unassigned. 
Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Website http://www.indyproject.org.
Post feedback to the Indy Documentation newsgroup.