On Fri, 11 Feb 2005 16:21:49 -0500, Dossy Shiobara <[EMAIL PROTECTED]> wrote:
> On 2005.02.11, Stephen Deasey <[EMAIL PROTECTED]> wrote:
> > > Why introduce Ns_ConnSetUrl()?  Why not change Ns_SetRequestUrl() to do
> > > this?
> >
> > Ns_SetRequestUrl(Ns_Request * request, char *url);
> > Ns_ConnSetUrl(Ns_Conn *conn, char *url);
> >
> > The 'original URL' is a property of the current connection, not a
> > Ns_Request structure which is generic and has no back pointer itself
> > to an Ns_Conn.  I thought was cleaner to add the new Ns_ConnSetUrl
> > call, which obviously takes a pointer to the current conn.
>
> Very cool.  I thought that the private Request structure (similar to how
> we have a private Conn and a public Ns_Conn structure pair) might have a
> pointer back to the Conn/Ns_Conn that the request is being processed by.
> I just looked and that's not the case.
>
> Would it be better to add a pointer to the Conn in the private Request
> structure rather than introducing a new (and similar) C API to one that
> already exists?


I don't think so.  Adding a dependency on Ns_Conn to Ns_Request would
make the code lex flexible.  At the moment Ns_Request can be re-used
in other situations, and adding that dependency would complicate that.


> I'd be in favor of having the request processor set the originalUrl
> attribute of the Conn instead of only changing it when Ns_ConnSetUrl()
> is called.  So, in the case where no "redirect" has happened,
> originalUrl == url will be true.  Then, we don't need to introduce this
> new Ns_ConnSetUrl() at all?


You would have to hope that 404 and 500 errors are a relatively rare
event on a production site, so the overhead of copying the URL twice,
once for Ns_Request.url and again for Conn.originalUrl, is excessive
IMO.

In the supplied patch, Conn.origUrl is computed lazily only when
Ns_ConnSetUrl() is called.  The only way to retrieve it is via
Ns_ConnOriginalUrl(), which simply returns Ns_Request.url in the
common case where Ns_ConnSetUrl() hasn't been called.

If you decide instead to expose originalUrl as a public member of the
Ns_Conn struct, then things would be different.  But that seems
unnecessarily complicated, and the majority of the public members of
Ns_Conn have simple wrapper functions anyway.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to