Re: RE : RE : [fpc-pascal] Premature end of headers using fcl-web and POST

2011-11-01 Thread Michael Van Canneyt
On Tue, 1 Nov 2011, Ludo Brands wrote: On Tue, Nov 1, 2011 at 9:04 AM, Ludo Brands wrote: Note the "per the HTML specs". HTTP specs aren't that strict. But what exaxtly do these specs ban? Because I am sending via XMLHttpRequest in JavaScript, and there you can specify any mime-type that y

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-11-01 Thread Felipe Monteiro de Carvalho
On Tue, Nov 1, 2011 at 8:39 AM, Felipe Monteiro de Carvalho wrote: >    begin >      SetLength(DataStr, M.Size); >      M.ReadBuffer(DataStr[1], M.Size); >      ContentFields.Text := DataStr; >    end; Actually this code is wrong, for it to be proper it would need to first check if the mime-type

RE : RE : [fpc-pascal] Premature end of headers using fcl-web and POST

2011-11-01 Thread Ludo Brands
> On Tue, Nov 1, 2011 at 9:04 AM, Ludo Brands > wrote: > > Note the "per the HTML specs". HTTP specs aren't that strict. > > But what exaxtly do these specs ban? Because I am sending via > XMLHttpRequest in JavaScript, and there you can specify any > mime-type that you want. You can send any d

Re: RE : [fpc-pascal] Premature end of headers using fcl-web and POST

2011-11-01 Thread Felipe Monteiro de Carvalho
On Tue, Nov 1, 2011 at 9:04 AM, Ludo Brands wrote: > Note the "per the HTML specs". HTTP specs aren't that strict. But what exaxtly do these specs ban? Because I am sending via XMLHttpRequest in JavaScript, and there you can specify any mime-type that you want. You can send any data and I haven't

RE : [fpc-pascal] Premature end of headers using fcl-web and POST

2011-11-01 Thread Ludo Brands
> >> So it seems that you MUST set the contenttype either to > >> MULTIPART/FORM-DATA or APPLICATION/X-WWW-FORM-URLENCODED. > > > > Yes, this is as per the HTML specs. > > They actually prohibit sending arbitrary data? oh, boy, these > people like rules and inneficiency =D But there must be > s

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-11-01 Thread Felipe Monteiro de Carvalho
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 cod

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread Vincent Snijders
2011/11/1 Felipe Monteiro de Carvalho : > On Mon, Oct 31, 2011 at 7:30 PM, Michael Van Canneyt > wrote: >>> So it seems that you MUST set the contenttype either to >>> MULTIPART/FORM-DATA or APPLICATION/X-WWW-FORM-URLENCODED. >> >> Yes, this is as per the HTML specs. > > They actually prohibit sen

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread Felipe Monteiro de Carvalho
On Mon, Oct 31, 2011 at 7:30 PM, Michael Van Canneyt wrote: >> So it seems that you MUST set the contenttype either to >> MULTIPART/FORM-DATA or APPLICATION/X-WWW-FORM-URLENCODED. > > Yes, this is as per the HTML specs. They actually prohibit sending arbitrary data? oh, boy, these people like rul

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread Sven Barth
On 31.10.2011 19:30, Michael Van Canneyt wrote: Maybe TRequest should be extended by something like an "unknown content type handler"... This can of course be done, the question is what this handler should do ? Handler gets ContentType, transmitted data (the TMemoryStream) and the ContentFie

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread Michael Van Canneyt
On Mon, 31 Oct 2011, Sven Barth wrote: 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 proble

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread Sven Barth
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 trye

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread ABorka
On 10/31/2011 10:14, Felipe Monteiro de Carvalho wrote: There is no form and no form data here. I want to pass raw data via post. And yes, I checked that it is sent correctly. Then your Content-Type header is neither "MULTIPART/FORM-DATA" nor "APPLICATION/X-WWW-FORM-URLENCODED" when you use PO

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread Felipe Monteiro de Carvalho
There is no form and no form data here. I want to pass raw data via post. And yes, I checked that it is sent correctly. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread ABorka
On 10/31/2011 08: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 trye

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread Felipe Monteiro de Carvalho
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

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread Felipe Monteiro de Carvalho
If I remove the line from JavaScript which sets the content type I just get: exception at 0043004B: Unsupported content type: "text/plain; charset=UTF-8". =/ -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org ht

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread Felipe Monteiro de Carvalho
Ok, the exception was a great addition =) It corners the error here: procedure TRequest.InitPostVars; Var M : TCapacityStream; Cl : Integer; B : Byte; CT : String; begin {$ifdef CGIDEBUG} SendMethodEnter('InitPostVars'); {$endif} CL:=ContentLength; M:=TCapacityStream.Create; Tr

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread Felipe Monteiro de Carvalho
On Mon, Oct 31, 2011 at 4:23 PM, Michael Van Canneyt wrote: > Where is the action ? If you specify a module, then you must specify an > action as well. actions are not necessary. In my module there is a property DefActionWhenUnknown=True (it is like this by default). Also if this was the problem

Re: [fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread Michael Van Canneyt
On Mon, 31 Oct 2011, Felipe Monteiro de Carvalho wrote: Hello, So I advanced my CGI using HTTP GET so far, but I'd like to migrate to HTTP POST. But I always get this error message in the apache logs: Premature end of script headers: openpoker3.cgi, referer: http://localhost:8080/cgi-bin/ope

[fpc-pascal] Premature end of headers using fcl-web and POST

2011-10-31 Thread Felipe Monteiro de Carvalho
Hello, So I advanced my CGI using HTTP GET so far, but I'd like to migrate to HTTP POST. But I always get this error message in the apache logs: Premature end of script headers: openpoker3.cgi, referer: http://localhost:8080/cgi-bin/openpoker3.cgi?module=MainPage The request doesn't even get to