• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 668
  • Last Modified:

help with webBroker in Delphi 2009

I am trying to understand how to write a CGI application in Delpi 2009 using webBroker.  I have a test html page that contains a form that collects username and password and submits it to the server using POST.  My CGI program contains the following event handler for the action -
procedure TWebModule4.WebModule4actLogin1Action(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var username,password : string;

username := Request.ContentFields.Values['username'];
password := Request.ContentFields.Values['password'];
Response.Content := '<h1>Test Results</h1>';
Response.Content := Response.Content + Request.Content + '<br/>';
Response.Content := Response.Content + ' Username: '+ username + '<br/>'
                    + 'Password: ' + password;
Handled := true;



There is currently only one action defined, its pathinfo is set to /login, and it is the default.

My html for the form looks like

     <form action = "/cgi-bin/WESLoginCGI.exe/login" method = "post">
    <legend>Customer Login</legend>
     <ol id="frmList">
     <li>      <label for="username">Username:</label>
                 <input type="text" name="username" id="frmusername" maxlength=50 size=15/> </li>
      <li>      <label for="password">Password: </label>
                  <input type="password" name="password" id="frmpassword" maxlength=50 size=15/> </li>
                <input id="btnSubmit" type="submit" value="Submit" />

I am viewing the web pages on an Apache 2.2.15 server installed locally running under XP.  The pages display correctly, except that the returned page from the CGI application does not contain any of the request.content,  the entered password or the username; its as if they have never been received by the application, and I cant see what I am doing wrong.  Has anyone any suggestions ? (please dont suggest doing it an entirely different way, I want to understand this problem).
1 Solution
Change the method = "post" to method = "get" in your form, and it will work again.

This is a bug in Delphi, see http://qc.embarcadero.com/wc/qcmain.aspx?d=81026
Angus_CrossleyAuthor Commented:
Thank you, thought I was going mad.  Have recompiled the same code under Delphi 2005 and all working fine.

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now