mirror of
				https://github.com/python/cpython.git
				synced 2025-10-25 18:54:53 +00:00 
			
		
		
		
	At Jim Fulton's request (actually, as a compromise :-), default the
content-type to application/x-www-form-urlencoded only when the method is POST. Ditto for when the content-type is unrecognized -- only fall back to urlencoded with POST.
This commit is contained in:
		
							parent
							
								
									094189f108
								
							
						
					
					
						commit
						ce900defc5
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -841,7 +841,7 @@ def __init__(self, fp=None, headers=None, outerboundary="", | |||
|         # but it happens to be something we don't understand. | ||||
|         if self.headers.has_key('content-type'): | ||||
|             ctype, pdict = parse_header(self.headers['content-type']) | ||||
|         elif self.outerboundary: | ||||
|         elif self.outerboundary or method != 'POST': | ||||
|             ctype, pdict = "text/plain", {} | ||||
|         else: | ||||
|             ctype, pdict = 'application/x-www-form-urlencoded', {} | ||||
|  | @ -867,7 +867,7 @@ def __init__(self, fp=None, headers=None, outerboundary="", | |||
|             self.read_urlencoded() | ||||
|         elif ctype[:10] == 'multipart/': | ||||
|             self.read_multi(environ, keep_blank_values, strict_parsing) | ||||
|         elif self.outerboundary: | ||||
|         elif self.outerboundary or method != 'POST': | ||||
|             # we're in an inner part, but the content-type wasn't something we  | ||||
|             # understood.  default to read_single() because the resulting | ||||
|             # FieldStorage won't be a mapping (and doesn't need to be). | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Guido van Rossum
						Guido van Rossum