[fpc-pascal] Premature end of headers using fcl-web and POST
Felipe Monteiro de Carvalho
felipemonteiro.carvalho at gmail.com
Tue Nov 1 08:39:56 CET 2011
Hello,
Ok, it seams that I found a workaround. It works correctly if I use this:
lData := ARequest.Content;
instead of
lData := ARequest.ContentFields.Text;
It seams that the string is filled correctly, even if the TStringList
isn't filled.
I think this could be improved by adding this code:
procedure TRequest.InitPostVars;
Var
...
DataStr: string;
begin
...
else if Pos('APPLICATION/X-WWW-FORM-URLENCODED',Uppercase(CT))<>0 then
ProcessUrlEncoded(M, ContentFields)
// For other data just load it to a TStringList and let the
// user application process it
else
begin
SetLength(DataStr, M.Size);
M.ReadBuffer(DataStr[1], M.Size);
ContentFields.Text := DataStr;
end;
But I was not able to test it yet, because my build script (located in
C:\Programas\lazarus31\fpc\2.5.1\source\packages):
set path=C:\Programas\lazarus31\fpc\2.5.1\bin\i386-win32
make fcl-web
pause
Fails with:
C:\Programas\lazarus31\fpc\2.5.1\source\packages>set path=C:\Programas\lazarus31
\fpc\2.5.1\bin\i386-win32
C:\Programas\lazarus31\fpc\2.5.1\source\packages>make fcl-web
make -C fcl-web all
make[1]: Entering directory `C:/Programas/lazarus31/fpc/2.5.1/source/packages/fc
l-web'
C:/Programas/lazarus31/fpc/2.5.1/bin/i386-win32/ppc386.exe fpmake.pp -n -Fu../..
/rtl -Fu../../packages/hash/units/i386-win32 -Fu../../packages/paszlib -Fu../../
packages/fcl-process -Fu../../packages/fpmkunit
Fatal: Can't find unit system used by fpmake
Fatal: Compilation aborted
make[1]: *** [fpmake] Error 1
make[1]: Leaving directory `C:/Programas/lazarus31/fpc/2.5.1/source/packages/fcl
-web'
make: *** [fcl-web] Error 2
Even while a nearly identical script works for FPC 2.4.2 for building fcl-web.
On Tue, Nov 1, 2011 at 7:53 AM, Vincent Snijders
<vincent.snijders at gmail.com> wrote:
> You can send arbitrary data using MULTIPART/FORM-DATA
Indeed, but I'd rather specify my own mime-type and not use any
pre-defined format for packaging my data. This kind of thing just adds
overhead and slowness.
--
Felipe Monteiro de Carvalho
More information about the fpc-pascal
mailing list