You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Jason S. Priebe" <pr...@wral-tv.com> on 1998/03/26 16:59:51 UTC

API question

-----BEGIN PGP SIGNED MESSAGE-----

Hope this is the appropriate place for this question.  I'm working to
make my mod_trailer comply with the API, per Dean's suggestions.  I'm
looking at the API docs regarding sub_req_lookup_uri(), and they say
that this routine does everything up to actually sending a response.
I took this to mean that if I do the following:

  rr = sub_req_lookup_uri(my_uri, r);

then rr->status would be of some use.  Unfortunately, if I make a
request to the server for a non-existent document, rr->status contains
'200', so it isn't giving me useful information.

However, rr->finfo.st_mode _does_ appear to be useful, since it is
properly set to 0 when I request the non-existent document.  So I
modified my code to use the value of rr->finfo.st_mode to determine
whether to call send_http_header().  If rr->finfo.st_mode == 0, then
I assume that when I call run_sub_req(rr), an error handler will
take over and send the appropriate headers.

Can anybody shed some light on this?

- --------------------------------------------------
Jason Priebe                           WRAL OnLine
priebe@wral-tv.com                     Raleigh, NC
see http://www.wral-tv.com/~priebe/ for public key                

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBNRp7euqkj/9w/z2hAQFl6wP/cOkWCxE5m435BowvKatKkd+oabWvASXA
N624tNKuAj1rdxCaMb2MLreAGlYNMk5anld3HZzkzP7uE+35wWfQOGNJ+WrqJwLi
nzOMnt7GXiRyNXMPAykU1iCAuR/WgqSQmtFCdaDnPRJ6wd6QYDGYWGVrfU4X7C/2
u77ipF9QBeg=
=BHDp
-----END PGP SIGNATURE-----


Re: API question

Posted by Dean Gaudet <dg...@arctic.org>.
You could say the docs are wrong.  For many requests, no attempt is made
to generate the "file does not exist" error until the handler is already
run.  For files it's definately the case that rr->finfo.st_mode == 0 is an
indicator the file doesn't exist.  But for more complex URIs this may not
be the case.  It's a flaw in the API.

run_sub_req() may not actually do the error handling the way you want... 
you may want to just punt your handler if rr->finfo.st_mode == 0 and let
the core take over with error messages. 

Dean

On Thu, 26 Mar 1998, Jason S. Priebe wrote:

> Hope this is the appropriate place for this question.  I'm working to
> make my mod_trailer comply with the API, per Dean's suggestions.  I'm
> looking at the API docs regarding sub_req_lookup_uri(), and they say
> that this routine does everything up to actually sending a response.
> I took this to mean that if I do the following:
> 
>   rr = sub_req_lookup_uri(my_uri, r);
> 
> then rr->status would be of some use.  Unfortunately, if I make a
> request to the server for a non-existent document, rr->status contains
> '200', so it isn't giving me useful information.
> 
> However, rr->finfo.st_mode _does_ appear to be useful, since it is
> properly set to 0 when I request the non-existent document.  So I
> modified my code to use the value of rr->finfo.st_mode to determine
> whether to call send_http_header().  If rr->finfo.st_mode == 0, then
> I assume that when I call run_sub_req(rr), an error handler will
> take over and send the appropriate headers.
> 
> Can anybody shed some light on this?
> 
> --------------------------------------------------
> Jason Priebe                           WRAL OnLine
> priebe@wral-tv.com                     Raleigh, NC
> see http://www.wral-tv.com/~priebe/ for public key                
> Signature by unknown keyid: 0x70FF3DA1
>