cvs: pear /SOAP Base.php /SOAP/Server Email.php Email_Gateway.php /SOAP/Transport SMTP.php

From: Date: Mon, 13 May 2002 22:05:49 +0000
Subject: cvs: pear /SOAP Base.php /SOAP/Server Email.php Email_Gateway.php /SOAP/Transport SMTP.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-3808@lists.php.net to get a copy of this message
shane Mon May 13 18:05:49 2002 EDT Modified files: /pear/SOAP Base.php /pear/SOAP/Server Email.php Email_Gateway.php /pear/SOAP/Transport SMTP.php Log: more email support fixes

Index: pear/SOAP/Base.php diff -u pear/SOAP/Base.php:1.8 pear/SOAP/Base.php:1.9 --- pear/SOAP/Base.php:1.8 Mon May 13 02:47:09 2002 +++ pear/SOAP/Base.php Mon May 13 18:05:38 2002 @@ -17,7 +17,7 @@ // | Authors: Dietrich Ayala <dietrich@ganx4.com> Original Author | // +----------------------------------------------------------------------+ // -// $Id: Base.php,v 1.8 2002/05/13 06:47:09 shane Exp $ +// $Id: Base.php,v 1.9 2002/05/13 22:05:38 shane Exp $ // require_once 'PEAR.php'; @@ -89,7 +89,7 @@ * Common base class of all Soap lclasses * * @access public -* @version $Id: Base.php,v 1.8 2002/05/13 06:47:09 shane Exp $ +* @version $Id: Base.php,v 1.9 2002/05/13 22:05:38 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates */ @@ -764,7 +764,7 @@ return; } else if (isset($structure->parts)) { $data = $structure->parts[0]->body; - $headers = $structure->parts[0]->headers; + $headers = array_merge($structure->headers,$structure->parts[0]->headers); if (count($structure->parts) > 1) { $mime_parts = array_splice($structure->parts,1); // prepare the parts for the soap parser @@ -811,7 +811,7 @@ * class used to handle QNAME values in XML * * @access public -* @version $Id: Base.php,v 1.8 2002/05/13 06:47:09 shane Exp $ +* @version $Id: Base.php,v 1.9 2002/05/13 22:05:38 shane Exp $ * @package SOAP::Client * @author Shane Caraveo <shane@php.net> Conversion to PEAR and updates */ Index: pear/SOAP/Server/Email.php diff -u pear/SOAP/Server/Email.php:1.3 pear/SOAP/Server/Email.php:1.4 --- pear/SOAP/Server/Email.php:1.3 Mon May 13 16:47:21 2002 +++ pear/SOAP/Server/Email.php Mon May 13 18:05:43 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more | // +----------------------------------------------------------------------+ // -// $Id: Email.php,v 1.3 2002/05/13 20:47:21 shane Exp $ +// $Id: Email.php,v 1.4 2002/05/13 22:05:43 shane Exp $ // require_once 'SOAP/Server.php'; @@ -36,7 +36,7 @@ * function call * * @access public -* @version $Id: Email.php,v 1.3 2002/05/13 20:47:21 shane Exp $ +* @version $Id: Email.php,v 1.4 2002/05/13 22:05:43 shane Exp $ * @package SOAP::Server * @author Shane Caraveo <shane@php.net> */ @@ -77,11 +77,14 @@ // join lines back together $enctext = preg_replace("/[\r|\n]/", '', $match[2]); $data = base64_decode($enctext); - } else if (strcasecmp($this->headers['content-transfer-encoding'],'quoted-printable')==0) { - $data = $match[2]; + #} else if (strcasecmp($this->headers['content-transfer-encoding'],'quoted-printable')==0) { + # $data = $match[2]; + #} else { + # $this->makeFault('Client','Invalid Content-Transfer-Encoding'); + # return FALSE; + #} } else { - $this->makeFault('Client','Invalid Content-Transfer-Encoding'); - return FALSE; + $data = $match[2]; } // if no content, return false Index: pear/SOAP/Server/Email_Gateway.php diff -u pear/SOAP/Server/Email_Gateway.php:1.3 pear/SOAP/Server/Email_Gateway.php:1.4 --- pear/SOAP/Server/Email_Gateway.php:1.3 Mon May 13 16:47:21 2002 +++ pear/SOAP/Server/Email_Gateway.php Mon May 13 18:05:45 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> Port to PEAR and more | // +----------------------------------------------------------------------+ // -// $Id: Email_Gateway.php,v 1.3 2002/05/13 20:47:21 shane Exp $ +// $Id: Email_Gateway.php,v 1.4 2002/05/13 22:05:45 shane Exp $ // require_once 'SOAP/Server/Email.php'; @@ -40,7 +40,7 @@ * email * * @access public -* @version $Id: Email_Gateway.php,v 1.3 2002/05/13 20:47:21 shane Exp $ +* @version $Id: Email_Gateway.php,v 1.4 2002/05/13 22:05:45 shane Exp $ * @package SOAP::Server * @author Shane Caraveo <shane@php.net> */ @@ -50,20 +50,15 @@ { $this->endpoint = $endpoint; $response = ''; + $useEncoding='Mime'; // we have a full set of headers, need to find the first blank line $this->_parseEmail($data); if ($this->soapfault) { $response = $this->getFaultMessage(); } - // get the character encoding of the incoming request - // treat incoming data as UTF-8 if no encoding set - if (!$response && !$this->_getContentEncoding($this->headers['content-type'])) { - $this->xml_encoding = SOAP_DEFAULT_ENCODING; - // an encoding we don't understand, return a fault - $this->makeFault('Server','Unsupported encoding, use one of ISO-8859-1, US-ASCII, UTF-8'); - $response = $this->getFaultMessage(); - } + if ($this->headers['content-type']=='application/dime') + $useEncoding='DIME'; # call the HTTP Server if (!$response) { @@ -80,6 +75,32 @@ $response = $soap_transport->send($data, $options); if ($soap_transport->fault) { $response = $soap_transport->fault->message(); + } else { + foreach ($soap_transport->transport->attachments as $cid=>$body) { + $this->attachments[] = array('body' => $body, 'cid' => $cid, 'encoding' => 'base64'); + } + if (count($this->attachments)) { + if ($useEncoding == 'Mime') { + $soap_msg = $this->_makeMimeMessage($response); + } else { + // default is dime + $soap_msg = $this->_makeDIMEMessage($response); + $header['Content-Type'] = 'application/dime'; + } + if (PEAR::isError($soap_msg)) { + return $this->raiseSoapFault($soap_msg); + } + if (is_array($soap_msg)) { + $response = $soap_msg['body']; + if (count($soap_msg['headers'])) { + if (isset($options['headers'])) { + $options['headers'] = array_merge($options['headers'],$soap_msg['headers']); + } else { + $options['headers'] = $soap_msg['headers']; + } + } + } + } } } Index: pear/SOAP/Transport/SMTP.php diff -u pear/SOAP/Transport/SMTP.php:1.10 pear/SOAP/Transport/SMTP.php:1.11 --- pear/SOAP/Transport/SMTP.php:1.10 Mon May 13 16:47:21 2002 +++ pear/SOAP/Transport/SMTP.php Mon May 13 18:05:46 2002 @@ -16,7 +16,7 @@ // | Authors: Shane Caraveo <Shane@Caraveo.com> | // +----------------------------------------------------------------------+ // -// $Id: SMTP.php,v 1.10 2002/05/13 20:47:21 shane Exp $ +// $Id: SMTP.php,v 1.11 2002/05/13 22:05:46 shane Exp $ // // Status: rough draft, untested // @@ -38,7 +38,7 @@ * TODO: use PEAR smtp and Mime classes * * @access public -* @version $Id: SMTP.php,v 1.10 2002/05/13 20:47:21 shane Exp $ +* @version $Id: SMTP.php,v 1.11 2002/05/13 22:05:46 shane Exp $ * @package SOAP::Transport::SMTP * @author Shane Caraveo <shane@php.net> */ @@ -100,8 +100,10 @@ // if the content type is already set, we assume that Mime encoding // is already done - if (!isset($headers['Content-Type'])) { - // do an inline Mime encoding + if (isset($headers['Content-Type'])) { + $out = $msg; + } else { + // do a simple inline Mime encoding $headers['Content-Disposition'] = 'inline'; $headers['Content-Type'] = "text/xml; charset=\"$this->encoding\""; if (array_key_exists('transfer-encoding', $options)) {
« previous php.pear.cvs (#3808) next »