Changeset 3e63a0b8 in github
- Timestamp:
- Mar 11, 2011 3:23:50 AM (2 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 129aeff
- Parents:
- 4591de7
- Files:
-
- 2 edited
-
CHANGELOG (modified) (1 diff)
-
program/lib/Net/SMTP.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
r4591de7 r3e63a0b8 2 2 =========================== 3 3 4 - PEAR::Net_SMTP 1.5.1 4 5 - Allow multiple concurrent compose sessions 5 6 - Force names of unique constraints in PostgreSQL DDL -
program/lib/Net/SMTP.php
r14015da r3e63a0b8 107 107 108 108 /** 109 * The socket I/O timeout value in seconds. 110 * @var int 111 * @access private 112 */ 113 var $_timeout = 0; 114 115 /** 109 116 * The most recent server response code. 110 117 * @var int … … 149 156 * @param string $localhost The value to give when sending EHLO or HELO. 150 157 * @param boolean $pipeling Use SMTP command pipelining 158 * @param integer $timeout Socket I/O timeout in seconds. 151 159 * 152 160 * @access public 153 161 * @since 1.0 154 162 */ 155 function Net_SMTP($host = null, $port = null, $localhost = null, $pipelining = false) 163 function Net_SMTP($host = null, $port = null, $localhost = null, 164 $pipelining = false, $timeout = 0) 156 165 { 157 166 if (isset($host)) { … … 167 176 168 177 $this->_socket = new Net_Socket(); 178 $this->_timeout = $timeout; 169 179 170 180 /* Include the Auth_SASL package. If the package is not … … 180 190 181 191 /** 192 * Set the socket I/O timeout value in seconds plus microseconds. 193 * 194 * @param integer $seconds Timeout value in seconds. 195 * @param integer $microseconds Additional value in microseconds. 196 * 197 * @access public 198 * @since 1.5.0 199 */ 200 function setTimeout($seconds, $microseconds = 0) { 201 return $this->_socket->setTimeout($seconds, $microseconds); 202 } 203 204 /** 182 205 * Set the value of the debugging flag. 183 206 * … … 370 393 * 371 394 * @param int $timeout The timeout value (in seconds) for the 372 * socket connection .395 * socket connection attempt. 373 396 * @param bool $persistent Should a persistent socket connection 374 397 * be used? … … 387 410 return PEAR::raiseError('Failed to connect socket: ' . 388 411 $result->getMessage()); 412 } 413 414 /* 415 * Now that we're connected, reset the socket's timeout value for 416 * future I/O operations. This allows us to have different socket 417 * timeout values for the initial connection (our $timeout parameter) 418 * and all other socket operations. 419 */ 420 if (PEAR::isError($error = $this->setTimeout($this->_timeout))) { 421 return $error; 389 422 } 390 423 … … 618 651 $digest = &Auth_SASL::factory('digestmd5'); 619 652 $auth_str = base64_encode($digest->getResponse($uid, $pwd, $challenge, 620 $this->host, "smtp", $authz)); 653 $this->host, "smtp", 654 $authz)); 621 655 622 656 if (PEAR::isError($error = $this->_put($auth_str))) { … … 831 865 $args .= ' XVERP=' . $params['verp']; 832 866 } 833 } elseif (is_string($params) ) {867 } elseif (is_string($params) && !empty($params)) { 834 868 $args .= ' ' . $params; 835 869 } … … 920 954 } 921 955 922 /* RFC 1870, section 3, subsection 3 states "a value of zero 923 * indicates that no fixed maximum message size is in force". 924 * Furthermore, it says that if "the parameter is omitted no 925 * information is conveyed about the server's fixed maximum 926 * message size". */ 927 if (isset($this->_esmtp['SIZE']) && ($this->_esmtp['SIZE'] > 0)) { 928 /* Start by considering the size of the optional headers string. 929 * We also account for the addition 4 character "\r\n\r\n" 930 * separator sequence. */ 931 $size = (is_null($headers)) ? 0 : strlen($headers) + 4; 932 933 if (is_resource($data)) { 934 $stat = fstat($data); 935 if ($stat === false) { 936 return PEAR::raiseError('Failed to get file size'); 937 } 938 $size += $stat['size']; 939 } else { 940 $size += strlen($data); 941 } 942 943 if ($size >= $this->_esmtp['SIZE']) { 944 $this->disconnect(); 945 return PEAR::raiseError('Message size exceeds server limit'); 946 } 956 /* Start by considering the size of the optional headers string. We 957 * also account for the addition 4 character "\r\n\r\n" separator 958 * sequence. */ 959 $size = (is_null($headers)) ? 0 : strlen($headers) + 4; 960 961 if (is_resource($data)) { 962 $stat = fstat($data); 963 if ($stat === false) { 964 return PEAR::raiseError('Failed to get file size'); 965 } 966 $size += $stat['size']; 967 } else { 968 $size += strlen($data); 969 } 970 971 /* RFC 1870, section 3, subsection 3 states "a value of zero indicates 972 * that no fixed maximum message size is in force". Furthermore, it 973 * says that if "the parameter is omitted no information is conveyed 974 * about the server's fixed maximum message size". */ 975 $limit = (isset($this->_esmtp['SIZE'])) ? $this->_esmtp['SIZE'] : 0; 976 if ($limit > 0 && $size >= $limit) { 977 $this->disconnect(); 978 return PEAR::raiseError('Message size exceeds server limit'); 947 979 } 948 980 … … 975 1007 } 976 1008 } else { 977 if (!isset($size))978 $size = strlen($data);979 1009 /* 980 1010 * Break up the data by sending one chunk (up to 512k) at a time.
Note: See TracChangeset
for help on using the changeset viewer.
