On 31.10.2011 16:56, Felipe Monteiro de Carvalho wrote:
Ok, I figured part of it out. I can get past the exception if I use 2.5.1

And the action was necessary, which is really strange because it
worked nicely without it when using GET

But now my problem is that I cannot get my POST data. I tryed this so far:

lData := ARequest.ContentFields.Text;

but it is empty.


If you'd look at the current version of TRequest.InitPostVars, you'd know why it is empty ;)

=== source begin ===

procedure TRequest.InitPostVars;

Var
  M  : TCapacityStream;
  Cl : Integer;
  CT : String;

begin
{$ifdef CGIDEBUG}
  SendMethodEnter('InitPostVars');
{$endif}
  CL:=ContentLength;
  if CL<>0 then
    begin
    M:=TCapacityStream.Create;
    Try
      if CL<>0 then
        begin
        M.Capacity:=Cl;
        M.WriteBuffer(Content[1], Cl);
        end;
      M.Position:=0;
      CT:=ContentType;
      if Pos('MULTIPART/FORM-DATA',Uppercase(CT))<>0 then
        ProcessMultiPart(M,CT, ContentFields)
else if Pos('APPLICATION/X-WWW-FORM-URLENCODED',Uppercase(CT))<>0 then
        ProcessUrlEncoded(M, ContentFields)
    finally
     M.Free;
    end;
    end;
{$ifdef CGIDEBUG}
  SendMethodExit('InitPostVars');
{$endif}
        end;

=== source end ===

So it seems that you MUST set the contenttype either to MULTIPART/FORM-DATA or APPLICATION/X-WWW-FORM-URLENCODED.

Maybe TRequest should be extended by something like an "unknown content type handler"...

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to