[Lazarus] Is CGIApp compatible with methods PUT and DELETE?

silvioprog silvioprog at gmail.com
Tue Dec 27 12:39:56 CET 2011


2011/12/26 Michael Van Canneyt <michael at freepascal.org>:
> On Mon, 26 Dec 2011, silvioprog wrote:
>> Hi,
>>
>> I'm tried with two differents projects. I'm sending both projects to
>> test in attached.
>>
>> When I try execute "http://localhost/cgi-bin/rest" with PUT (or
>> DELETE) method, the response of server is:
>>
>> HTTP/1.1 500 Internal Server Error
>> Date: Mon, 26 Dec 2011 18:25:20 GMT
>> Server: Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8
>> mod_perl/2.0.4 Perl/v5.10.1
>> Vary: accept-language,accept-charset
>> Accept-Ranges: bytes
>> Connection: close
>> Content-Type: text/html; charset=iso-8859-1
>> Content-Language: en
>> Expires: Mon, 26 Dec 2011 18:25:20 GMT
>>
>> But if I build a CGI project with WriteLn work fine. :/ Eg.
>>
>> program rest;
>>
>> uses
>>  SysUtils;
>>
>> begin
>>  WriteLn('Content-Type: text/plain');
>>  WriteLn;
>>  WriteLn(GetEnvironmentVariable('REQUEST_METHOD'));
>> end.
>>
>> So, is CGIApp compatible with methods PUT and DELETE?
> Currently not. When a request arrives, the fcl-web code tries to initialize
> the request variables.
>
> The problem is that the InitRequestVars can only initialize the request
> variables for GET and POST. I can of course skip initialization if the
> method is not one of those.
>
> It's easily fixable, the main problem is that for PUT and DELETE, I do not
> know how to initialize the request variables, I have not found any
> description of how to do this.
>
> Michael.

No problem.

I'm building a REST server. I did an example using writeln/readln, in
this example I get the variables sent by PUT method.

Thx. :)

-- 
Silvio Clécio
====================================
Site - <silvioprog.com.br>
LazSolutions - <code.google.com/p/lazsolutions>
====================================




More information about the Lazarus mailing list