1.1 --- a/WebStack/Webware.py Thu Mar 25 22:19:41 2004 +0000
1.2 +++ b/WebStack/Webware.py Thu Mar 25 22:20:25 2004 +0000
1.3 @@ -55,11 +55,21 @@
1.4
1.5 """
1.6 A framework-specific method which returns all request headers.
1.7 + NOTE: If duplicate header names are permitted, then this interface will
1.8 + NOTE: need to change.
1.9 """
1.10
1.11 - # NOTE: Webware doesn't really provide access to headers in the request.
1.12 + # Use the Webware environment and some assumptions about variable names.
1.13 + # NOTE: Using lower case for the header names.
1.14
1.15 - return {}
1.16 + env = self.trans.request().environ()
1.17 + headers = {}
1.18 + for cgi_key, value in env.items():
1.19 + if cgi_key.startswith("HTTP_"):
1.20 + header_name = cgi_key[len("HTTP_"):].replace("_", "-").lower()
1.21 + headers[header_name] = value
1.22 +
1.23 + return headers
1.24
1.25 def get_header_values(self, key):
1.26
1.27 @@ -69,9 +79,14 @@
1.28 'key' is treated as a case-insensitive string.
1.29 """
1.30
1.31 - # NOTE: Webware doesn't really provide access to headers in the request.
1.32 + # Use the Webware environment and some assumptions about variable names.
1.33
1.34 - return []
1.35 + env = self.trans.request().environ()
1.36 + cgi_key = "HTTP_" + key.replace("-", "_").upper()
1.37 + if env.has_key(cgi_key):
1.38 + return [env[cgi_key]]
1.39 + else:
1.40 + return []
1.41
1.42 def get_content_type(self):
1.43
1.44 @@ -117,10 +132,7 @@
1.45 request.
1.46 """
1.47
1.48 - # NOTE: Webware does not seem to prefix the "path info" in a way
1.49 - # NOTE: consistent with the other frameworks.
1.50 -
1.51 - return "/" + self.trans.request().pathInfo()
1.52 + return self.trans.request().extraURLPath()
1.53
1.54 def get_query_string(self):
1.55