httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boyle Owen" <Owen.Bo...@swx.com>
Subject RE: [users@httpd] Newbie question: how to get client headers back?
Date Mon, 05 Jan 2004 08:27:13 GMT
> -----Original Message-----
> From: Claudio Lapidus [mailto:clapidus@hotmail.com]
> 
> I need to setup a test page to verify the behavior of clients 
> and proxies.
> The selected approach is to have a page that prints back literally all
> headers received by the server in the HTTP request from the 
> client. So I
> need a way to dump these client headers in a dynamically 
> generated document
> for serving back to the client. In order to ease the parsing 
> in the client
> side, it would be useful if this document could be generated 
> as text/plain
> and containing nothing but the mentioned headers.

All client headers are made available to the apache process handling the
request as environment variables. The header is modified slightly;

- prefix "HTTP_" is added
- all alphabetic characters are converted to upper-case
- hyphens are converted to underscores

e.g. If the request contains:

Shoe-size: 44

then the environment variable will be "HTTP_SHOE_SIZE".

How you access the environment variables depends on your handler -
assuming CGI and Perl, you can get all this from the %ENV hash, e.g.

print $ENV{HTTP_SHOE_SIZE};

will output "44".

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 

> 
> I waded through SSI and CGI documentation, but I couldn't 
> find the exact
> commands to achieve this.
> 
> Anybody knows a simple solution to this one?
> 
> (Sorry if this is a FAQ, but I'm completely new to apache and 
> really don't
> know even the proper places where to look for answers.)
> 
> thanks in advance
> cl.
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP 
> Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 
Diese E-mail ist eine private und persönliche Kommunikation. Sie hat
keinen Bezug zur Börsen- bzw. Geschäftstätigkeit der SWX Gruppe. This
e-mail is of a private and personal nature. It is not related to the
exchange or business activities of the SWX Group. Le présent e-mail est
un message privé et personnel, sans rapport avec l'activité boursière du
Groupe SWX.

This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please notify the sender urgently
and then immediately delete the message and any copies of it from your
system. Please also immediately destroy any hardcopies of the message.
You must not, directly or indirectly, use, disclose, distribute, print,
or copy any part of this message if you are not the intended recipient.
The sender’s company reserves the right to monitor all e-mail
communications through their networks. Any views expressed in this
message are those of the individual sender, except where the message
states otherwise and the sender is authorised to state them to be the
views of the sender’s company. 



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message