Tuesday, June 15, 2004

Web App Debugger problem

Lachlan was wondering if I had a workaround for:
http://qc.borland.com/wc/wc.exe/details?ReportID=7738

Ok, that problem really sucks. The problem is that a lot of the Delphi code actually depends on the prog id being part of the path info. Here's the fix:

Copy "SockHTTP" from the Delphi Source\Internet folder into your project folder, and most importantly, Add it to your project. Then, change the TSockWebRequest.GetStringVariable to:

function TSockWebRequest.GetStringVariable(
Index: Integer): string;
var iPos : integer;
begin
Result := FIntf.GetStringVariable(Index);
if Index=4 then // pathinfo
begin
result := Copy(Result, 2, Length(Result));
iPos := Pos('/', Result);
if iPos>0 then
Result := Copy(Result, iPos,
Length(Result))
else
Result := '/';
end;
end;


Also change TSockWebRequest.GetInternalPathInfo to: (You'll need to comment out a few lines)

function
TSockWebRequest.GetInternalPathInfo: string;
var
P: Integer;
begin
if UsingStub then
begin
Result := PathInfo;
Assert(Length(Result) > 0, 'Unexpected length');

(* COMMENTED BY DEEPAK

Assert(Result[1] = '/', 'Unexpected value');
Delete(Result, 1, 1);
// Remove first section of path. This is a reference
// to the progid.
P := Pos('/', Result); {do not localize}
if P > 0 then
Delete(Result, 1, P-1)
else
Result := '/';

END COMMENTED BY DEEPAK *)

end
else
Result := inherited GetInternalPathInfo;
end;


Remember, Copy the SockHTTP.pas to your project folder, don't edit it in the Borland source folder!

2 Comments:

Blogger LachlanG said...

Thanks that's been a thorn in my side for a while. I'll amend the QC entry with your workaround if you haven't already.

2:06 PM  
Blogger Deepak Shenoy said...

Saw the QC entry modified, thanks!

5:37 AM  

Post a Comment

<< Home