[fpc-pascal] fpweb and reading the contents of a request

Michael Van Canneyt michael at freepascal.org
Mon Oct 17 16:01:40 CEST 2011



On Mon, 17 Oct 2011, Felipe Monteiro de Carvalho wrote:

> On Mon, Oct 17, 2011 at 3:55 PM, Michael Van Canneyt
> <michael at freepascal.org> wrote:
>> As far as I know, this will always be empty, for the simple reason that the
>> request is executed asynchronously. You must attach a callback which is
>> executed once the request is ready, and read ResponseText after that.
>
> Ah, no, my problem is not in the JavaScript ... my syncronous request
> works fine in Opera at least.

? AFAIK xhttprequest is never synchronous...

> My problem is in fpweb:
>
> procedure TwebLobbyServer.DataModuleRequest(Sender: TObject;
>  ARequest: TRequest; AResponse: TResponse; var Handled: Boolean);
> begin
>  WebDebugOut('[TwebLobbyServer.DataModuleRequest] ARequest.Content='
> + ARequest.Content); <--------------- HERE
>
> This is where I get an empty ARequest.Content

Did you properly encode the content ?

Michael.



More information about the fpc-pascal mailing list