Practical mod_perl / HTML Book /



previous page: A.3. Redirecting POST Requests
  
page up: HTML Version of the book
  
next page: A.5. Handling Cookies

A.4. Redirecting While Maintaining Environment Variables


Let's say you have a module that sets some environment variables. Redirecting most likely tells the web browser to fetch the new page. This makes it a totally new request, so no environment variables are preserved.

However, if you're using internal_redirect( ), you can make the environment variables visible in the subprocess via subprocess_env( ). The only nuance is that the %ENV keys will be prefixed with REDIRECT_. For example, $ENV{CONTENT_LENGTH} will become:

$r->subprocess_env->{REDIRECT_CONTENT_LENGTH};

 

Continue to:

  • prev: A.3. Redirecting POST Requests
  • Table of Contents
  • next: A.5. Handling Cookies







TOP
previous page: A.3. Redirecting POST Requests
  
page up: HTML Version of the book
  
next page: A.5. Handling Cookies


Menu

  • HTML Book
  • PDF Book
  • Download Code
  • Table of Contents
  • Errata
  • mod_perl2 User's Guide
  • Sitemap

Search


Add to Google




Creative Commons License


Written by
Eric Cholet (Logilune) and
Stas Bekman (StasoSphere & Free Books).


[ Privacy Policy | Terms of Use | About Us | Search ]

© 2007 StasoSphere.com