Changeset 388 for python/vendor/current/Lib/BaseHTTPServer.py
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Lib/BaseHTTPServer.py
r2 r388 245 245 self.close_connection = 1 246 246 requestline = self.raw_requestline 247 if requestline[-2:] == '\r\n': 248 requestline = requestline[:-2] 249 elif requestline[-1:] == '\n': 250 requestline = requestline[:-1] 247 requestline = requestline.rstrip('\r\n') 251 248 self.requestline = requestline 252 249 words = requestline.split() 253 250 if len(words) == 3: 254 [command, path, version]= words251 command, path, version = words 255 252 if version[:5] != 'HTTP/': 256 253 self.send_error(400, "Bad request version (%r)" % version) … … 278 275 return False 279 276 elif len(words) == 2: 280 [command, path]= words277 command, path = words 281 278 self.close_connection = 1 282 279 if command != 'GET': … … 310 307 311 308 """ 312 self.raw_requestline = self.rfile.readline() 313 if not self.raw_requestline: 309 try: 310 self.raw_requestline = self.rfile.readline(65537) 311 if len(self.raw_requestline) > 65536: 312 self.requestline = '' 313 self.request_version = '' 314 self.command = '' 315 self.send_error(414) 316 return 317 if not self.raw_requestline: 318 self.close_connection = 1 319 return 320 if not self.parse_request(): 321 # An error code has been sent, just exit 322 return 323 mname = 'do_' + self.command 324 if not hasattr(self, mname): 325 self.send_error(501, "Unsupported method (%r)" % self.command) 326 return 327 method = getattr(self, mname) 328 method() 329 self.wfile.flush() #actually send the response if not already done. 330 except socket.timeout, e: 331 #a read or a write timed out. Discard this connection 332 self.log_error("Request timed out: %r", e) 314 333 self.close_connection = 1 315 334 return 316 if not self.parse_request(): # An error code has been sent, just exit317 return318 mname = 'do_' + self.command319 if not hasattr(self, mname):320 self.send_error(501, "Unsupported method (%r)" % self.command)321 return322 method = getattr(self, mname)323 method()324 335 325 336 def handle(self): … … 437 448 printf!). 438 449 439 The client host and current date/time are prefixed to440 everymessage.450 The client ip address and current date/time are prefixed to every 451 message. 441 452 442 453 """ 443 454 444 455 sys.stderr.write("%s - - [%s] %s\n" % 445 (self. address_string(),456 (self.client_address[0], 446 457 self.log_date_time_string(), 447 458 format%args))
Note:
See TracChangeset
for help on using the changeset viewer.