#1 2019-04-20 05:35:07

mapes
Member
Registered: 2016-10-30
Posts: 16

MultiPartFormDataEncode

Hi,

crc := 'A8FBDC27';
MultiPartFormDataAddField('crc',crc,fMultipart);

after decode on server side
crc = 'A8FBDC2'

I think problem is in MultiPartFormDataEncode:

W.Add('--%'#13#10'Content-Disposition: form-data; name="%"'#13#10+
    'Content-Type: %'#13#10#13#10'%'#10'--%'#13#10,
     [bound,Name,ContentType,Content,bound]) else begin

should be

W.Add('--%'#13#10'Content-Disposition: form-data; name="%"'#13#10+
    'Content-Type: %'#13#10#13#10'%'#13#10'--%'#13#10,
     [bound,Name,ContentType,Content,bound]) else begin

Offline

#2 2019-04-20 12:34:35

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,672
Website

Re: MultiPartFormDataEncode

I doubt changing one line feed from #13#10 to #10 is the right answer.
In HTTP, line feeds are always #13#10 IIRC.

Note: perhaps a git pull request is easier for everyone!
smile

Offline

#3 2019-04-20 18:07:13

mapes
Member
Registered: 2016-10-30
Posts: 16

Re: MultiPartFormDataEncode

Of course I have first tried this solution.

in MultiPartFormDataDecode

you have this line:

part.Content := copy(Body,i,j-i-2); // -2 to ignore latest #13#10

So in this case changing one line feed from #10 to #13#10 seems like right answer :-)

Offline

#4 2019-04-24 15:27:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,672
Website

Re: MultiPartFormDataEncode

Offline

#5 2019-04-25 18:07:31

mapes
Member
Registered: 2016-10-30
Posts: 16

Re: MultiPartFormDataEncode

Thanks ab, works.

Offline

Board footer

Powered by FluxBB