Hi, Remy. I wonder, what Indy10 means by 'Content-Length' for TIdMultipartFormDataStream?
I have next code:
AMultiPartFormData := TIdMultipartFormDataStream.Create; // Size=-1, OK
AField := AMultiPartFormData.AddFormField(AId, '', '', 'application/octet-stream'); // size = 222, might be OK
DataStream.CopyFrom(AStream, ALength); // ALength = 100500 bytes
ADataStream.Position := 0;
AField.FieldStream := ADataStream; // after that size became even smaller 220 bytes! why? i expect to see it >= ALength
moreover i must also sent 'Content-MD5' header and have no idea what should be there... In previous version of code with Alcinoe library we had there
CalculateMD5ForStream(ADataStream); and everything works well!
@rlebeau, i've just checked change of size via Debug Watch . As i said above it happens only in case when my stream position is at the end.
I have another question, my HTTP protocol has KeepAlive=True and i see that in this case no disconnection happens:
if not Response.KeepAlive then begin
// TODO: do not disconnect if hoNoReadMultipartMIME is in effect
// TODO: do not disconnect if hoNoReadChunked is in effect
but i wonder whether is it a good idea to disconnect in case when socket error occurs? E.g. 'connection reset by peer'?