Re: Using a 404 ErrorDocument to serve content
At 10:59 06.05.2002 -0700, you wrote: >On Mon, 6 May 2002, Perrin Harkins wrote: > > Incidentally, that's how Vignette StoryServer works. You could also do > > this kind of thing with a transhandler (or mod_rewrite) that checks for > > the existence of a static file and rewrites the URL if it can't find > > one. That might be more "correct", but trapping 404 is the best > > possible performance, since there is no additional code in the response > > chain if the static file is there. > > > >fyi, i believe that Vignette is attempting to patent that. Phew, and I just thought that I did not like the design. It might have good performance now, but the idea sounds valid that in an error handler performance does not matter. So if someone changes apache in that direction ... How can they patent it if there already is an article about this? Sincerely, Joachim -- "... ein Geschlecht erfinderischer Zwerge, die fuer alles gemietet werden koennen."- Bertolt Brecht - Leben des Galilei
Re: Using a 404 ErrorDocument to serve content
On Mon, 6 May 2002, Perrin Harkins wrote: > Ken Williams wrote: > > The idea is that I'd put a bunch of JPEGs on the > > server at locations like foo/123.jpg , and then if a request came for > > foo/123-medium.jpg , I'd catch that with a 404 ErrorDocument and > > generate the resized image using Imager. If I wanted to, I could also > > create the resized image on disk, so it wouldn't need to be generated > > next time. > > Incidentally, that's how Vignette StoryServer works. You could also do > this kind of thing with a transhandler (or mod_rewrite) that checks for > the existence of a static file and rewrites the URL if it can't find > one. That might be more "correct", but trapping 404 is the best > possible performance, since there is no additional code in the response > chain if the static file is there. > fyi, i believe that Vignette is attempting to patent that. > - Perrin > m@ =) matthew d. p. k. strelchun-lanier [EMAIL PROTECTED] 415-515-5421 http://www.lanier.org http://sf.pm.org
Re: Using a 404 ErrorDocument to serve content
Ken Williams wrote: > The idea is that I'd put a bunch of JPEGs on the > server at locations like foo/123.jpg , and then if a request came for > foo/123-medium.jpg , I'd catch that with a 404 ErrorDocument and > generate the resized image using Imager. If I wanted to, I could also > create the resized image on disk, so it wouldn't need to be generated > next time. Incidentally, that's how Vignette StoryServer works. You could also do this kind of thing with a transhandler (or mod_rewrite) that checks for the existence of a static file and rewrites the URL if it can't find one. That might be more "correct", but trapping 404 is the best possible performance, since there is no additional code in the response chain if the static file is there. - Perrin
Re: Using a 404 ErrorDocument to serve content
> "Ken" == Ken Williams <[EMAIL PROTECTED]> writes: Ken> I was thinking of writing yet-another-photo-album-server, and I had Ken> the idea that I'd write a handler to serve resized versions of JPEGs Ken> (very original, I know ;-). The idea is that I'd put a bunch of JPEGs Ken> on the server at locations like foo/123.jpg , and then if a request Ken> came for foo/123-medium.jpg , I'd catch that with a 404 ErrorDocument Ken> and generate the resized image using Imager. If I wanted to, I could Ken> also create the resized image on disk, so it wouldn't need to be Ken> generated next time. As usual, Been there, Did That For A Column. 1) Visit any page on the newly redesigned www.stonehenge.com. 2) Type "404 handler" into the bottom "search this site with google" box. 3) Check out the hits... should be the first or second one. After 160 columns, I'm starting to really wonder what there is LEFT to cover. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Using a 404 ErrorDocument to serve content
Hi, I was thinking of writing yet-another-photo-album-server, and I had the idea that I'd write a handler to serve resized versions of JPEGs (very original, I know ;-). The idea is that I'd put a bunch of JPEGs on the server at locations like foo/123.jpg , and then if a request came for foo/123-medium.jpg , I'd catch that with a 404 ErrorDocument and generate the resized image using Imager. If I wanted to, I could also create the resized image on disk, so it wouldn't need to be generated next time. Some questions arise, however. I've got it working by setting $r->content_type("image/jpeg") in the 404 subrequest. Should I also be setting $r->prev->content_type ? Same question for $r->status and $r->prev->status. It seems to be "working" either way, but I don't know what the proper thing to do is. The idea is that I'm not just trying to give the user a friendly 404 error message, I'm trying to fool the user into thinking the requested document really does exist. I've done this a lot with and so on, but I don't think I've ever tried it with an ErrorDocument, so I'm interested in feedback. -Ken