Jump to content
ToddFrankson

D5-D7 ISAPI vs D12.3 ISAPI

Recommended Posts

So, I am revisiting an ISAPI dll I wrote some time back....

 

I have a bunch of actions.  In particular I have an /index and a /header action.

 

Header generates a header based on input from which action is called and which "options" the end user has selected prior to the call for the action. Simple stuff....

In D5-D7,  this isapi dll could call the header via a get from the Index action (or any other) and everything worked fine (also a footer but we aren't going there yet).

 

Upgrading it to D12.3 

 

If I call the header directly {http://127.0.0.1/script/CC_Web.dll/getheader?cat=6&mob=n) in my browser, it returns the expected header fine

 

Wen called from within an action:

procedure TWebModule1.WebModule1indexAction(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);

var

myHeader:String;

Begin

.......

// nmHttp is a visual component TIDHttp;

MyHeader:=nmHttp1.Get('http://127.0.0.1/script/CC_Web.dll/getheader?cat=6&mob='+Mobile);

Response.Content:=MyHeader;

Response.SendResponse;

Handled:=true;

End;

 

My header is blank.  Occasionally I get an Http 1.1 5 error.  Is there something new that ISAPI can not call actions within the same ISAPAI from one action to another?

 

 

If I type this in the browser: http://127.0.0.1/script/CC_Web.dll/getheader?cat=6&mob=n, the header renders perfectly.

 

 

Share this post


Link to post

Is your ISAPI DLL multi-threaded?

 

Here's what I think is happening: the web server is handling an action (indexAction) and before it's finished and can return the result, you're trying to call another action on the same server by making a Get request out to the internet and back to the localhost. But since the server is still trying to get a response to the first request and if your ISAPI server is single-threaded, it can't process the second request until the first request is finished; therefore, it's probably timing out and returning blank.

 

Instead of making another HTTP request, why not just call the desired action directly? And by "call the action directly" I making make a procedural call within your code--not an external HTTP request which goes out to the internet and back to the current server. Why would you do that, anyway?

 

Now, you said it worked when built under D5/D7? Perhaps that was an earlier version of Indy that had a bug or there was some other setting different. Or I'm way off in my understanding of what's really going on.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×