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

Send HTTP data to a web server or CGI program.

Pascal
procedure Post(
    AURL: string; 
    ASource: TIdMultiPartFormDataStream; 
    AResponseContent: TIdStream
); overload;
Parameters 
Description 
ASource 
Multipart data 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. This variant of the Post method is designed is used in the overloaded for an HTTP Request with a content type value of "multipart/form-data". 

Post is overloaded to allow use of a TIdMultiPartFormDataStream object instance in ASource. TIdMultiPartFormDataStream allows preparing a request that adheres to the rules for multipart MIME data streams, where data items are represented as a series of message parts with a content-disposition header value of "form-data". The content-disposition header contains an (additional) parameter of "name", where the value of that parameter is the original field name in the form. 

As with all multipart MIME types, each part in the data stream has an optional "Content-Type" header, which defaults to the value "text/plain". If the contents of a file are returned using the form, then the file input is identified as the appropriate media type, if known, or the value "application/octet-stream". If multiple files are to be returned as the result of a single form entry, they should be represented as a "multipart/mixed" part embedded within the "multipart/form-data". 

Each part in the data stream may be encoded and the "content-transfer-encoding" header supplied when the value of that part does not conform to the default encoding. 

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. 

Post calls an overloaded variant of the method to perform the HTTP transfer.

Exceptions 
Description 
EAssertionFailed 
Raised if the multipart data 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.