Delphi w Indy 10: idHTTPRequest POST always is HTTP 1.0, how to make it HTTP 1.1?

Include the hoKeepOrigProtocol option into the HTTPOptions property set (set it to True). Except that keep the ProtocolVersion property set to pv1_1 (which is the default value).

In the TIdCustomHTTP.Post method code there's a comment explaining the current behavior:

Currently when issuing a POST, IdHTTP will automatically set the protocol to version 1.0 independently of the value it had initially. This is because there are some servers that don't respect the RFC to the full extent. In particular, they don't respect sending/not sending the Expect: 100-Continue header. Until we find an optimum solution that does NOT break the RFC, we will restrict POSTS to version 1.0.

A few lines below is the change to the version 1.0 with the following comment:

// If hoKeepOrigProtocol is SET, it is possible to assume that the developer
// is sure in operations of the server
if not (hoKeepOrigProtocol in FOptions) then begin
  if Connected then begin
    Disconnect;
  end;
  FProtocolVersion := pv1_0;
end;

And the above code is skipped (the version is not changed) if you have the hoKeepOrigProtocol option included in the HTTPOptions.

Tags:

Delphi

Indy