Commits

Robert Brewer  committed ddb5c52

Fix for #1220 (requestline not properly splitted when request line (including r"\r\n") are exactly 256 bytes long).

  • Participants
  • Parent commits 48ec086

Comments (0)

Files changed (3)

File cherrypy/test/test_http.py

         self.assertEqual(response.fp.read(22), ntob("Malformed Request-Line"))
         c.close()
 
+    def test_request_line_split_issue_1220(self):
+        Request_URI = "/index?intervenant-entreprise-evenement_classaction=evenement-mailremerciements&_path=intervenant-entreprise-evenement&intervenant-entreprise-evenement_action-id=19404&intervenant-entreprise-evenement_id=19404&intervenant-entreprise_id=28092"
+        self.assertEqual(len("GET %s HTTP/1.1\r\n" % Request_URI), 256)
+        self.getPage(Request_URI)
+        self.assertBody("Hello world!")
+
     def test_malformed_header(self):
         if self.scheme == 'https':
             c = HTTPSConnection('%s:%s' % (self.interface(), self.PORT))

File cherrypy/wsgiserver/wsgiserver2.py

             self._check_length()
             res.append(data)
             # See https://bitbucket.org/cherrypy/cherrypy/issue/421
-            if len(data) < 256 or data[-1:] == "\n":
+            if len(data) < 256 or data[-1:] == LF:
                 return EMPTY.join(res)
 
     def readlines(self, sizehint=0):

File cherrypy/wsgiserver/wsgiserver3.py

             self._check_length()
             res.append(data)
             # See https://bitbucket.org/cherrypy/cherrypy/issue/421
-            if len(data) < 256 or data[-1:] == "\n":
+            if len(data) < 256 or data[-1:] == LF:
                 return EMPTY.join(res)
 
     def readlines(self, sizehint=0):