in reply to Re^6: mod_perl handler for file downloads: good call or bad
in thread mod_perl handler for file downloads: good call or bad

Seriously, you can do whatever you like. This is basic mod_perl functionality. Maybe it would help you to look at a complete example. Check out Apache::AuthCookie. It displays a form by defining a custom response for 401 errors. There are other ways to do it, like a redirect.
  • Comment on Re^7: mod_perl handler for file downloads: good call or bad

Replies are listed 'Best First'.
Re^8: mod_perl handler for file downloads: good call or bad
by clinton (Priest) on Jun 21, 2007 at 16:02 UTC
    OK, after a bit of research (RFC 2617 - HTTP Authentication), I've figured it out.

    The browser only pops up the basic authentication dialog if it receives an HTTP_UNAUTHORISED(401) return status and a WWW-Authenticate header.

    So instead, you can do what Apache::Cookie does:

    • Unauthenticated user:

      return an HTTP_FORBIDDEN (403) status and use $r->custom_response() to send them the HTML of your login form

    • Authenticated user:

      return OK, and apache will send them the file

    Clint