You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by da...@apache.org on 2004/01/27 05:13:23 UTC
cvs commit: ws-axis/c/src/client/transport/axis AxisTransport.cpp Channel.cpp HttpTransport.cpp Makefile.am TransportFactory.cpp
damitha 2004/01/26 20:13:23
Modified: c/src/client/transport/axis AxisTransport.cpp Channel.cpp
HttpTransport.cpp Makefile.am TransportFactory.cpp
Log:
Applied ssl security patch given by
Mark Elrod
Vindicia, Inc.
2755 Campus Drive, Suite 240
San Mateo, California 94403
Revision Changes Path
1.14 +1 -1 ws-axis/c/src/client/transport/axis/AxisTransport.cpp
Index: AxisTransport.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/client/transport/axis/AxisTransport.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- AxisTransport.cpp 15 Jan 2004 13:45:22 -0000 1.13
+++ AxisTransport.cpp 27 Jan 2004 04:13:23 -0000 1.14
@@ -88,7 +88,7 @@
{
//Step 1 - Open Transport layer connection taking into account protocol and endpoint URI in m_Soap
Url objUrl(m_pSoap->so.http->uri_path);
- m_pHttpTransport = TransportFactory::GetTransport(objUrl);
+ m_pHttpTransport = TransportFactory::GetTransport(objUrl, false);
memset(&m_SendBuffers, 0, sizeof(sendbuffers)*NO_OF_SERIALIZE_BUFFERS);
if(m_pHttpTransport->Init())
{
1.7 +2 -0 ws-axis/c/src/client/transport/axis/Channel.cpp
Index: Channel.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/client/transport/axis/Channel.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Channel.cpp 14 Jan 2004 12:57:11 -0000 1.6
+++ Channel.cpp 27 Jan 2004 04:13:23 -0000 1.7
@@ -153,6 +153,7 @@
CloseChannel();
throw ChannelException("Cannot open a channel");
}
+
return true;
}
@@ -195,6 +196,7 @@
//cout << "no need for linux" << endl;
// other OS specific Intitialization goes here
#endif
+
return true;
}
1.14 +59 -13 ws-axis/c/src/client/transport/axis/HttpTransport.cpp
Index: HttpTransport.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/client/transport/axis/HttpTransport.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- HttpTransport.cpp 14 Jan 2004 12:57:11 -0000 1.13
+++ HttpTransport.cpp 27 Jan 2004 04:13:23 -0000 1.14
@@ -72,12 +72,49 @@
using namespace std;
/**
+ * Create HTTP transport with provided URL as remote address,
+ * set HTTP category default to POST
+ */
+HttpTransport::HttpTransport(Url url, bool secure) : m_Typ(POST)
+{
+ m_Url = url;
+ m_IsHttpHeader = 0;
+ m_HttpBindDone = false;
+ m_Secure = secure;
+
+ if(secure) {
+ m_Channel = new SecureChannel();
+ } else {
+ m_Channel = new Channel();
+ }
+}
+
+/**
+ * Create HTTP transport with provided remote address as URL-string,
+ * set HTTP category default to POST
+ */
+HttpTransport::HttpTransport(std::string& strUrl, bool secure) : m_Typ(POST)
+{
+ m_Url = Url(strUrl);
+ m_strUrl = strUrl;
+ m_IsHttpHeader = 0;
+ m_HttpBindDone = false;
+
+ if(secure) {
+ m_Channel = new SecureChannel();
+ } else {
+ m_Channel = new Channel();
+ }
+}
+
+/**
* Shutdown any established channel
*/
HttpTransport::~HttpTransport()
{
- m_Channel.Close();
+ m_Channel->Close();
+ delete m_Channel;
}
/**
@@ -95,8 +132,8 @@
{
m_bStatus = true;
std::string host = m_Url.GetHostName();
- m_Channel.Open(host, m_Url.GetPort());
- m_Channel.SetTransportHandler(this);
+ m_Channel->Open(host, m_Url.GetPort());
+ m_Channel->SetTransportHandler(this);
#ifdef _DEBUG
cout << "Transport:init() successfull" << endl;
#endif
@@ -111,7 +148,7 @@
void HttpTransport::Fini()
{
- m_Channel.Close();
+ m_Channel->Close();
}
/**
@@ -149,19 +186,20 @@
if(m_IsHttpHeader == 1)
{
//printf("m_IsHttpHeader == 1\n");
- m_Channel >> m_PayLoad;
+ *m_Channel >> m_PayLoad;
*pPayLoad = m_PayLoad.c_str();
return *this;
}
- //printf("tmpPacket:%s\n", tmpPacket.c_str());
+ //printf("tmpPacket:%s\n", tmpPacket.c_str());
+ //*m_Channel >> tmpPacket;
-#ifdef _DEBUG
- std::cout << "\n\n\nGot the message:\r\n\r\n" << tmpPacket << "\n\n";
-#endif
+//#ifdef _DEBUG
+ //std::cout << "\n\n\nGot the message:\r\n\r\n" << tmpPacket << "\n\n";
+//#endif
do //process will step into this only if http validation is not done. That is, until the stream
//contain the httpd header.
{
- m_Channel >> tmpPacket;
+ *m_Channel >> tmpPacket;
// Validate the HTTP packet
if(m_IsHttpHeader == 1) //if header is validated but payload has zero length, process will steop into this.
@@ -202,7 +240,8 @@
{
HTTPBind(); // Bind the SOAP-Envelop with HTTP headers
// Write to the established channel
- m_Channel << p_Payload;
+ *m_Channel << p_Payload;
+ //*m_Channel << m_OutMsg.str();
return *this;
}
@@ -228,13 +267,20 @@
unsigned short port = m_Url.GetPort();
- if(port != HTTP_PORT)
+ if(!m_Secure && port != HTTP_PORT)
{
char buff[8];
sprintf(buff, "%u", port);
m_OutHttpHeaders += ":";
m_OutHttpHeaders += buff;
}
+ else if(m_Secure && port != HTTPS_PORT)
+ {
+ char buff[8];
+ sprintf(buff, "%u", port);
+ m_OutHttpHeaders += ":";
+ m_OutHttpHeaders += buff;
+ }
m_OutHttpHeaders += "\r\n";
m_OutHttpHeaders += "Content-Type: text/xml; charset=\"UTF-8\"\r\n"; // We have to support other charsets
@@ -259,7 +305,7 @@
}
m_OutHttpHeaders += "\r\n";
- m_Channel << m_OutHttpHeaders.c_str();
+ *m_Channel << m_OutHttpHeaders.c_str();
m_HttpBindDone = true;
}
1.5 +2 -1 ws-axis/c/src/client/transport/axis/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/ws-axis/c/src/client/transport/axis/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Makefile.am 12 Jan 2004 12:20:52 -0000 1.4
+++ Makefile.am 27 Jan 2004 04:13:23 -0000 1.5
@@ -1,7 +1,8 @@
noinst_LTLIBRARIES = libtransport.la
AM_CPPFLAGS = -Wshadow -Wall -pedantic
libtransport_la_SOURCES = Channel.cpp HttpTransport.cpp Receiver.cpp Sender.cpp \
- Transport.cpp TransportFactory.cpp Url.cpp AxisTransport.cpp
+ Transport.cpp TransportFactory.cpp Url.cpp AxisTransport.cpp SecureChannel.cpp
libtransport_la_LIBADD = -lstdc++
INCLUDES = -I$(AXISCPP_HOME)/include
+
1.5 +2 -2 ws-axis/c/src/client/transport/axis/TransportFactory.cpp
Index: TransportFactory.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/client/transport/axis/TransportFactory.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TransportFactory.cpp 14 Jan 2004 12:57:11 -0000 1.4
+++ TransportFactory.cpp 27 Jan 2004 04:13:23 -0000 1.5
@@ -61,11 +61,11 @@
#include <axis/client/transport/axis/HttpTransport.hpp>
-Transport* TransportFactory::GetTransport(Url& url)
+Transport* TransportFactory::GetTransport(Url& url, bool secure)
{
if(url.GetProtocol() == Url::http)
{
- return new HttpTransport(url);
+ return new HttpTransport(url, secure);
}
else if(url.GetProtocol() == Url::https)
{