http_servlet_redirect
—
HTTP redirect servlet
PDEL Library (libpdel, -lpdel)
http_servlet_redirect_create
()
creates a new servlet that responds to all queries with an HTTP "302
Found" status code and supplies the new redirect URL
url in the "Location" header. This causes
the client to retry the transaction at the new URL.
The append_url argument determines whether
and how the originally requested URL is included in the redirect URL and may
equal one of the following:
HTTP_SERVLET_REDIRECT_NO_APPEND
- url is always returned unmodified; the originally
requested URL is discarded.
HTTP_SERVLET_REDIRECT_APPEND_QUERY
- The query string component of the originally requested URL is appended to
url as additional query string argument(s).
HTTP_SERVLET_REDIRECT_APPEND_URI
- This causes the path and query string components of the originally
requested URL (i.e., the URI) to be appended to url,
in effect mapping the original URL into the corresponding
"subdirectory" of url.
HTTP_SERVLET_REDIRECT_APPEND_URL
- The originally requested URL is URL-encoded and appended as an additional
query string argument to the redirect URL url. This
is useful for example when redirecting to a login page that will redirect
back to the originally requested URL after a successful login.
On failure, http_servlet_redirect_create
()
returns NULL
and sets errno to
an appropriate value.
The PDEL library was developed at Packet Design, LLC.
http://www.packetdesign.com/
Archie Cobbs
⟨archie@freebsd.org⟩