Freespider on IIS (5.1) Web server
lazarus / 38-Networking and Web Programming
----------------------------------------------------------------------
tjpren · 2012-02-06 06:41
Hi All,
I've moved my testing from a WAMP web server to Microsoft IIS web
server, as that is what my company uses. The WAMP runs faultlessly.
On IIS 5.1,the Freespider example works OK, except when I try to write
to a Dataset Table (option 3 of the example). The web page just sits
till I get a time-out error. The error log shows an error of 502,
which seem to be a CGI related error.
I'm wondering if anyone has encountered a similar IIS error,and solved
it?
Regards
----------------------------------------------------------------------
tjpren · 2012-02-07 10:10
Hello All,
I Haven't solved the problem, but have got more info.
The code here is the part I have isolated, which is giving me the
problems:
Code: [Select]procedure TDataModule1.saDatasettableRequest(Sender:
TObject;
Request: TSpiderRequest; var Response: TSpiderResponse);
begin
SpiderForm1.Action:= ExePath + '/datasettable';
SpiderForm1.AddText('Enter Subscriber ID: ');
SpiderForm1.AddInput(itText, 'id', '');
SpiderForm1.AddText('Enter Subscriber Name: ');
SpiderForm1.AddInput(itText, 'subname', '');
SpiderForm1.AddText('Address: ');
SpiderForm1.AddInput(itText, 'address', '');
SpiderForm1.AddText('Telephone Number: ');
SpiderForm1.AddInput(itText, 'telephone', '');
SpiderForm1.AddInput(itSubmit, 'add', 'Add');
Response.Add(SpiderForm1.Contents);
if FileExists('sub.dat') then
MemDataset1.LoadFromFile('sub.dat');
MemDataset1.Open;
if Request.ContentFields.IndexOfName('add') <> -1 then
begin
Response.Content.Add('Saving data..');
MemDataset1.Append;
MemDataset1.FieldByName('ID').AsString:= Request.Form('id');
MemDataset1.FieldByName('SubName').AsString:=
Request.Form('subname');
MemDataset1.FieldByName('Address').AsString:=
Request.Form('address');
MemDataset1.FieldByName('Telephone').AsString:=
Request.Form('telephone');
MemDataset1.Post;
MemDataset1.SaveToFile('sub.dat');
end;
Response.Add(SpiderTable2.Contents);
Response.Add('
Main');
end;
Speciifically, when I submit data from the form using the POST method
of the Spiderform.
Basically the page just hangs.
From what I can see of the issue on the internet, it is around a
malformed Header.
It's curious that it's OK on Apache, but crashes on IIS.
Anyone got any thoughts?
Regards
----------------------------------------------------------------------
tjpren · 2012-02-09 05:42
Hello,
Just wondering if the Freespider author had a chance to look over my
problem?
Regards
----------------------------------------------------------------------
Leledumbo · 2012-02-09 06:56
just PM him, find a user named motaz
----------------------------------------------------------------------
motaz · 2012-02-09 07:56
Hello tjpren, maybe the problem caused by writing to a file.
Code: [Select] MemDataset1.SaveToFile('sub.dat');
Try disable that line and see what happened.
----------------------------------------------------------------------
tjpren · 2012-02-09 09:43
Hi Motaz,
No. I tried disabling the save function, but I still get the app
timing out, and the 502 error.
it seems that in IIS, when the saDatasettableRequest procedure is
called a second time within the cgi after the user input is completed,
it seems to hang.
I admit that it propbably is only an issue with microsoft, but I'm
constrained to use that at work.
Any other thoughts?
Regards
----------------------------------------------------------------------
stoppok · 2012-02-09 11:00
Hi,
I'm just struggeling with the same problem and I have identified the
source:
In spiderutils.pas ~line 312 you will find this loop:
while not Eof do
begin
Readln(Line);
Lines:= Lines + Line;
end;
Seems there are two problems:
* eof will never become True
* readln is waiting for CR/LF and blocks
I have tried a loop which reads one character at a time but that does
not work because of the eof problem
regards,
Stefan
----------------------------------------------------------------------
tjpren · 2012-02-09 11:28
Hello Stoppok,
Glad I'm not alone. I take it you also are runnung IIS on a windows
machine?
I'm wondering whether its an IIS thing.
I've also tried splitting up the code -
1. setting up an input page
2. re-directing to a static page - maybe a page that confirms the data
3. then going back to a cgi page that writes data
So far though, I've failed in doing step 2 - redirecting to a static
page.
Regards
----------------------------------------------------------------------
stoppok · 2012-02-09 12:04
Hi,
I think i have fixed the bug, but I am not sure if it will work with
apache and other versions of IIS.
regards,
Stefan
----------------------------------------------------------------------
stoppok · 2012-02-09 17:14
Freespider 1.2.5 includes my patch and is available at
http://code.sd/freespider.htm
regards
----------------------------------------------------------------------
tjpren · 2012-02-10 09:11
Stefan,
You are a genius. Excellent.
It works brilliantly on IIS 5.1, and also works on Apache (WAMP).
Many thanks.
I had also looked through Spiderutils.pas, but my programming
abilities are not great. You've done well.
Regards
----------------------------------------------------------------------
tjpren · 2012-02-14 08:13
Stefan,
I tested today, and confirmed to my satisfaction at least, that your
mods also work on IIS 7.5 present in Win7.
Again thanks
Regards