Robert Brewer avatar Robert Brewer committed 8ca1c59

Backport of [1717]. See #727.

Comments (0)

Files changed (2)

cherrypy/_cplogging.py

     def access(self):
         """Write to the access log."""
         request = cherrypy.request
+        inheaders = request.headers
         remote = request.remote
         response = cherrypy.response
         outheaders = response.headers
                     'r': request.request_line,
                     's': response.status.split(" ", 1)[0],
                     'b': outheaders.get('Content-Length', '') or "-",
-                    'f': outheaders.get('referer', ''),
-                    'a': outheaders.get('user-agent', ''),
+                    'f': inheaders.get('Referer', ''),
+                    'a': inheaders.get('User-Agent', ''),
                     }
         try:
             self.access_log.log(logging.INFO, s)

cherrypy/test/test_core.py

         f.write("")
         f.close()
         
-        self.getPage("/flatten/as_string")
+        self.getPage("/flatten/as_string",
+                     headers=[('Referer', 'http://www.cherrypy.org/'),
+                              ('User-Agent', 'Mozilla/5.0')])
         self.assertBody('content')
         self.assertStatus(200)
         
                 haslength = True
         line = data[-2].strip()
         if haslength:
-            if not line.endswith('] "GET %s/flatten/as_string HTTP/1.1" 200 7 "" ""'
+            if not line.endswith('] "GET %s/flatten/as_string HTTP/1.1" 200 7 '
+                                 '"http://www.cherrypy.org/" "Mozilla/5.0"'
                                  % self.prefix()):
                 self.fail(line)
         else:
-            if not line.endswith('] "GET %s/flatten/as_string HTTP/1.1" 200 - "" ""'
+            if not line.endswith('] "GET %s/flatten/as_string HTTP/1.1" 200 - '
+                                 '"http://www.cherrypy.org/" "Mozilla/5.0"'
                                  % self.prefix()):
                 self.fail(line)
         
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.