mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Issue #10429: IMAP.starttls() stored the capabilities as bytes objects,
rather than strings.
This commit is contained in:
		
							parent
							
								
									36c0dbc9be
								
							
						
					
					
						commit
						dbe7519da9
					
				
					 3 changed files with 20 additions and 11 deletions
				
			
		|  | @ -196,13 +196,7 @@ def __init__(self, host = '', port = IMAP4_PORT): | |||
|         else: | ||||
|             raise self.error(self.welcome) | ||||
| 
 | ||||
|         typ, dat = self.capability() | ||||
|         if dat == [None]: | ||||
|             raise self.error('no CAPABILITY response from server') | ||||
|         dat = str(dat[-1], "ASCII") | ||||
|         dat = dat.upper() | ||||
|         self.capabilities = tuple(dat.split()) | ||||
| 
 | ||||
|         self._get_capabilities() | ||||
|         if __debug__: | ||||
|             if self.debug >= 3: | ||||
|                 self._mesg('CAPABILITIES: %r' % (self.capabilities,)) | ||||
|  | @ -737,10 +731,7 @@ def starttls(self, ssl_context=None): | |||
|             self.sock = ssl_context.wrap_socket(self.sock) | ||||
|             self.file = self.sock.makefile('rb') | ||||
|             self._tls_established = True | ||||
|             typ, dat = self.capability() | ||||
|             if dat == [None]: | ||||
|                 raise self.error('no CAPABILITY response from server') | ||||
|             self.capabilities = tuple(dat[-1].upper().split()) | ||||
|             self._get_capabilities() | ||||
|         else: | ||||
|             raise self.error("Couldn't establish TLS session") | ||||
|         return self._untagged_response(typ, dat, name) | ||||
|  | @ -956,6 +947,15 @@ def _command_complete(self, name, tag): | |||
|         return typ, data | ||||
| 
 | ||||
| 
 | ||||
|     def _get_capabilities(self): | ||||
|         typ, dat = self.capability() | ||||
|         if dat == [None]: | ||||
|             raise self.error('no CAPABILITY response from server') | ||||
|         dat = str(dat[-1], "ASCII") | ||||
|         dat = dat.upper() | ||||
|         self.capabilities = tuple(dat.split()) | ||||
| 
 | ||||
| 
 | ||||
|     def _get_response(self): | ||||
| 
 | ||||
|         # Read response and store. | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Antoine Pitrou
						Antoine Pitrou