EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Strange httpsclient post file behaviour

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#21353
Posted: 09/07/2012 05:52:47
by Birger Jansen (Standard support level)
Joined: 07/19/2012
Posts: 73

I have created a httpsclient that performs several functions with ssl and client certificate checks. This works fine for the GET requests.

Now, I want to upload a file with a post-request and followed the example to create this code:

Code
  fs := TFileStream.Create(sFile, fmOpenRead + fmShareDenyWrite);
  try
    if not FHTTPSClient.Active then
    begin
      FHTTPSClient.Post(sReq, nil, 'datafile', ExtractFileName(sFile),fs, 'text/plain', False);
      FHTTPSClient.Close(True);
    end;
  finally
    fs.Free;
  end;


The server complained that it couldn'r decode the stream, so I added an OnSendData to check the contents that are being send:

POST [xxx] HTTP/1.0
Content-Type: multipart/form-data; boundary=---------------------------114782935
826962
Host: [xxx]
User-Agent: SecureBlackbox
Accept-Encoding: gzip, deflate
Content-Length: 226


-----------------------------114782935826962--
-----------------------------114782935826962
Content-Disposition: form-data; name="datafile"; filename="0.txt"
Content-Type: text/plain

line1
line2
line3
line4
line5


Somehow the boundary end is placed at the beginning of the content instead of at the end.

What am I doing wrong?
#21354
Posted: 09/07/2012 06:02:55
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for reporting the problem.

We'll fix this and write you back.
#21355
Posted: 09/07/2012 07:16:24
by Vsevolod Ievgiienko (EldoS Corp.)

I've just sent you a fix via Helpdesk.

Reply

Statistics

Topic viewed 1153 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!