Re: [Zope] Accessing HTTP request headers
I need to know how to access the HTTP headers the client sent from within a product class that inherits from Folder. ----- Original Message ----- From: Ed Leafe <ed@leafe.com> Date: Tue, 8 Apr 2003 05:31:18 -0400 To: "Matt Ficken" <mattficken@mail.com> Subject: Re: [Zope] Accessing HTTP request headers
On Tuesday, April 8, 2003, at 12:07 AM, Matt Ficken wrote:
No, I actually need access to the headers the client sent. I've looked through parts of the Zope source and can't find a method that will do what I want. Is there an existing method to access the client's headers?
Dunno if this helps, but here's how you can list all the headers in ZPT:
<table border="1" tal:define="hdrkeys python:request.keys()"> <tr tal:repeat="kk hdrkeys"> <td tal:content="kk">key</td> <td tal:content="python:request.values()[repeat['kk'].index]">val</td> </tr> </table>
___/ / __/ / ____/ Ed Leafe http://leafe.com/ http://opentech.leafe.com
-- __________________________________________________________ Sign-up for your own FREE Personalized E-mail at Mail.com http://www.mail.com/?sr=signup
On Tuesday, April 8, 2003, at 12:02 PM, Matt Ficken wrote:
I need to know how to access the HTTP headers the client sent from within a product class that inherits from Folder.
If you're in Python, why can't you use context.REQUEST.keys() to get the header keys, and from them get the associated values? ___/ / __/ / ____/ Ed Leafe http://leafe.com/ http://opentech.leafe.com
Matt Ficken wrote:
I need to know how to access the HTTP headers the client sent from within a product class that inherits from Folder.
You can find all HTTP-Headers from the client in the REQUEST-Object, especially in the environ-attribut. Please check this with: <dtml-var "REQUEST.environ"> But note: All HTTP-Headers from the client get a prefix from ZServer: HTTP_ So if the client sends the header: ACCEPT_ENCODING Zserver will translate this to: HTTP_ACCEPT_ENCODING So, there's no need to write your own Header-Parser...;) Cheers, Maik
participants (3)
-
Ed Leafe -
Maik Jablonski -
Matt Ficken