1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/Webware/WebKit/HTTPRequest.py-0.8.1.diff Sun Feb 01 18:46:33 2004 +0000
1.3 @@ -0,0 +1,65 @@
1.4 +--- HTTPRequest.py Thu Jul 31 23:08:06 2003
1.5 ++++ HTTPRequest.py Sun Feb 1 18:03:56 2004
1.6 +@@ -240,6 +240,53 @@
1.7 + # @@ 2000-03-26 ce: maybe belongs in section below. clean up docs
1.8 + return self._environ['REMOTE_USER']
1.9 +
1.10 ++ ## Languages ##
1.11 ++
1.12 ++ def _contentPreferences(self, accept_preference):
1.13 ++ """
1.14 ++ Returns the preferences as requested by the user agent. The preferences are
1.15 ++ returned as a list of codes in the same order as they appeared in the
1.16 ++ appropriate environment variable. In other words, the explicit weighting
1.17 ++ criteria are ignored.
1.18 ++
1.19 ++ As the 'accept_preference' parameter, values for language and charset
1.20 ++ preferences are appropriate.
1.21 ++ """
1.22 ++
1.23 ++ accept_defs = accept_preference.split(",")
1.24 ++ accept_prefs = []
1.25 ++ for accept_def in accept_defs:
1.26 ++ t = accept_def.split(";")
1.27 ++ if len(t) >= 1:
1.28 ++ accept_prefs.append(t[0].strip())
1.29 ++ return accept_prefs
1.30 ++
1.31 ++ def contentLanguages(self):
1.32 ++ """
1.33 ++ Returns the language preferences.
1.34 ++ """
1.35 ++
1.36 ++ try:
1.37 ++ return self._contentPreferences(self._environ["HTTP_ACCEPT_LANGUAGE"])
1.38 ++ except KeyError:
1.39 ++ return []
1.40 ++
1.41 ++ def contentCharsets(self):
1.42 ++ """
1.43 ++ Returns the character set preferences.
1.44 ++ """
1.45 ++
1.46 ++ try:
1.47 ++ return self._contentPreferences(self._environ["HTTP_ACCEPT_CHARSET"])
1.48 ++ except KeyError:
1.49 ++ return []
1.50 ++
1.51 ++ def contentType(self):
1.52 ++ """
1.53 ++ Returns the content type of the request.
1.54 ++ """
1.55 ++
1.56 ++ return self._environ.get('CONTENT_TYPE', None)
1.57 +
1.58 + ## Remote info ##
1.59 +
1.60 +@@ -503,7 +550,7 @@
1.61 + you want to be sure you get the entire body of the request.
1.62 + """
1.63 + fs = self.fieldStorage()
1.64 +- if rewind:
1.65 ++ if fs is not None and fs.file is not None and rewind:
1.66 + fs.file.seek(0)
1.67 + return fs.file
1.68 +