EldoS | Feel safer!

Software components for data protection, secure storage and transfer

POST mit stream

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#29926
Posted: 06/25/2014 04:13:47
by Walter Schrabmair (Priority Standard support level)
Joined: 05/03/2013
Posts: 150

Hi,
I would like to post a MEMOBOX as MemoryStream.
But when I post the memorystream I get Content-Lenght: 0

Code
Headers sent:
POST /search.aspx?searchtype=msds HTTP/1.0
Cookie: $Version="1"; ecm="user_id=0&isMembershipUser=0&site_id=&username=&new_site=/&unique_id=0&site_preview=0&langvalue=1033&DefaultLanguage=1033&NavLanguage=1033&LastValidLanguageID=1033&DefaultCurrency=840&SiteCurrency=840&ContType=&UserCulture=1033&dm=www.avantormaterials.com&SiteLanguage=1033&Country=United States&CountryKey=Americas:United States"; $Path="/"; $Domain="www.avantormaterials.com"; EktGUID="0c5580b0-0027-450e-9783-7c3501275e92"; $Path="/"; $Domain="www.avantormaterials.com"; EkAnalytics="0"; $Path="/"; $Domain="www.avantormaterials.com"; AvantorLangcookie="Language=1033&Country=United States&CountryKey=Americas:United States"; $Path="/"; $Domain="www.avantormaterials.com"; AvantorAlert="true"; $Path="/"; $Domain="www.avantormaterials.com"; ASP.NET_SessionId="davkkmvwhk3hdlagq0va230j"; $Path="/"; $Domain="www.avantormaterials.com"
Host: www.avantormaterials.com
User-Agent: SecureBlackbox
Accept-Encoding: gzip, deflate
Content-Length: 0

here my code:
Code
      MyPostStream := TMemoryStream.Create;
      XMLDATAMemo.Lines.SaveToStream(MyPOSTStream);




      stage:=9;
      ElHttpsClient1.Post( 'https://www.avantormaterials.com/search.aspx?searchtype=msds',MyPoststream);
      MMLOG3.Lines.SaveToFile('mmlog3_headers.txt');


What make I wrong?
Thanks
#29927
Posted: 06/25/2014 04:16:30
by Eugene Mayevski (EldoS Corp.)

You need to set MyPostStream.Position back to 0 after writing to it. Our components don't rewind any passed streams (that's by design).


Sincerely yours
Eugene Mayevski
#29928
Posted: 06/25/2014 04:16:41
by Vsevolod Ievgiienko (EldoS Corp.)

Try to modify the code next way:
Code
MyPostStream := TMemoryStream.Create;
XMLDATAMemo.Lines.SaveToStream(MyPOSTStream);
MyPOSTStream.Position := 0; // add this line
#29929
Posted: 06/25/2014 04:24:21
by Walter Schrabmair (Priority Standard support level)
Joined: 05/03/2013
Posts: 150

thanks a lot.

One more question: How can I put the sent data in a MemoBox?
I know that there is the event OnSentData but how can I put the Buffer in a Memobox? Please show me some code how it is done. Thanks a lot!
#29930
Posted: 06/25/2014 04:26:45
by Vsevolod Ievgiienko (EldoS Corp.)

Please check our HTTPGet sample. It does similar thing in OnData event handler.
#29931
Posted: 06/25/2014 05:04:55
by Walter Schrabmair (Priority Standard support level)
Joined: 05/03/2013
Posts: 150

I will do, thanks.
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

Topic viewed 606 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!