Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-12

Is CGIApp compatible with methods PUT and DELETE?

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

silvioprog

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?

Silvio Cl?cio ==================================== Site - <silvioprog.com.br> LazSolutions - <code.google.com/p/lazsolutions> ==================================== -------------- next part -------------- A non-text attachment was scrubbed... Name: cgi1.zip Type: application/zip Size: 1627 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111226/85a0541f/attachment.zip> -------------- next part -------------- A non-text attachment was scrubbed... Name: cgi2.zip Type: application/zip Size: 2215 bytes Desc: not available URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111226/85a0541f/attachment-0001.zip>

Reply by email

Michael Van Canneyt
to silvioprog
silvioprog wrote 33 lines
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.

Reply by email

silvioprog
to Michael Van Canneyt

2011/12/26 Michael Van Canneyt :

Show quoted text 46 lines
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> ====================================

Reply by email