mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	handle missing QUERY_STRING
This commit is contained in:
		
							parent
							
								
									3b7b8131a6
								
							
						
					
					
						commit
						1c9daa8ba6
					
				
					 1 changed files with 12 additions and 1 deletions
				
			
		
							
								
								
									
										13
									
								
								Lib/cgi.py
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								Lib/cgi.py
									
										
									
									
									
								
							|  | @ -1,4 +1,13 @@ | ||||||
| #!/usr/local/bin/python | #!/usr/local/bin/python | ||||||
|  | 
 | ||||||
|  | # XXX TODO | ||||||
|  | # - proper doc strings instead of this rambling dialogue style | ||||||
|  | # - more utilities, e.g. | ||||||
|  | #   - print_header(type="test/html", blankline=1) -- print MIME header | ||||||
|  | #   - utility to format a nice error message in HTML | ||||||
|  | #   - utility to format a Location: ... response, including HTML | ||||||
|  | #   - utility to catch errors and display traceback | ||||||
|  | 
 | ||||||
| # | # | ||||||
| # A class for wrapping the WWW Forms Common Gateway Interface (CGI)  | # A class for wrapping the WWW Forms Common Gateway Interface (CGI)  | ||||||
| # Michael McLay, NIST  mclay@eeel.nist.gov  6/14/94 | # Michael McLay, NIST  mclay@eeel.nist.gov  6/14/94 | ||||||
|  | @ -47,8 +56,10 @@ def parse(): | ||||||
| 	if environ['REQUEST_METHOD'] == 'POST': | 	if environ['REQUEST_METHOD'] == 'POST': | ||||||
| 		qs = sys.stdin.read(string.atoi(environ['CONTENT_LENGTH'])) | 		qs = sys.stdin.read(string.atoi(environ['CONTENT_LENGTH'])) | ||||||
| 		environ['QUERY_STRING'] = qs | 		environ['QUERY_STRING'] = qs | ||||||
| 	else: | 	elif environ.has_key('QUERY_STRING'): | ||||||
| 		qs = environ['QUERY_STRING'] | 		qs = environ['QUERY_STRING'] | ||||||
|  | 	else: | ||||||
|  | 		environ['QUERY_STRING'] = qs = '' | ||||||
| 	return parse_qs(qs) | 	return parse_qs(qs) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Guido van Rossum
						Guido van Rossum