You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2004/07/15 06:25:18 UTC
cvs commit: ws-axis/c/src/transport/libwww LibWWWTransport.cpp Makefile.am
samisa 2004/07/14 21:25:18
Modified: c/src/transport/libwww LibWWWTransport.cpp Makefile.am
Log:
Added post support with 100-continue in place.
Revision Changes Path
1.2 +58 -7 ws-axis/c/src/transport/libwww/LibWWWTransport.cpp
Index: LibWWWTransport.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/libwww/LibWWWTransport.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LibWWWTransport.cpp 15 Jul 2004 03:13:35 -0000 1.1
+++ LibWWWTransport.cpp 15 Jul 2004 04:25:18 -0000 1.2
@@ -44,6 +44,24 @@
return status;
}
+PUBLIC HTChunk * HTPostAnchorToChunk (HTParentAnchor * source,
+ HTAnchor * destination,
+ HTRequest * request)
+{
+ if (source && destination && request) {
+ HTChunk * chunk = NULL;
+ HTStream * target = HTStreamToChunk(request, &chunk, 0);
+ HTRequest_setOutputStream(request, target);
+ if (HTPostAnchor(source, destination, request) == YES)
+ return chunk;
+ else {
+ HTChunk_delete(chunk);
+ return NULL;
+ }
+ }
+ return NULL;
+}
+
LibWWWTransport::LibWWWTransport()
:m_pRequest(NULL), m_pResult(NULL), m_pcData(NULL), m_pcProxy(NULL), m_iBytesLeft(0), m_pcReceived(NULL)
@@ -232,7 +250,7 @@
const char* LibWWWTransport::getSessionId()
{
- //TODO
+ return "TODO";
}
const char* LibWWWTransport::getServiceName()
@@ -272,11 +290,11 @@
AXIS_TRANSPORT_STATUS LibWWWTransport::flushOutput()
{
- //HTRequest * request = NULL;
- //HTParentAnchor* src = NULL;
- //HTAnchor * dst = NULL;
-//#ifdef HT_EXT
+
+#ifdef HT_EXT_CONTINUE //this block sends the message immediately after HTTP headers
+ //without using 100-continue
+
HTRequest_setOutputFormat(m_pRequest, WWW_SOURCE);
HTRequest_setOutputFormat(m_pRequest, HTAtom_for ("text/xml"));
HTRequest_setMethod(m_pRequest, METHOD_EXT_0);
@@ -308,8 +326,41 @@
}
else
return TRANSPORT_FAILED;
-//#endif //HT_EXT
-
+//#endif //ifdef HT_EXT
+#else
+//#if !defined(HT_EXT)
+
+ HTParentAnchor* src = NULL;
+ HTAnchor * dst = NULL;
+
+ dst = HTAnchor_findAddress(m_pcEndpointUri);
+ src = HTTmpAnchor(NULL);
+ HTAnchor_setDocument(src, m_pcData);
+ HTAnchor_setFormat(src, WWW_SOURCE);
+ HTRequest_setOutputFormat(m_pRequest, HTAtom_for ("text/xml"));
+ HTAnchor_setLength(src, strlen(m_pcData));
+
+ if (m_pResult)
+ HTChunk_delete(m_pResult);
+
+ m_pResult = HTPostAnchorToChunk(src, dst, m_pRequest);
+ HTEventList_loop(m_pRequest);
+
+ if(m_pResult)
+ {
+ m_pcReceived = HTChunk_data(m_pResult);
+ if(m_pcReceived)
+ {
+ m_iBytesLeft = strlen(m_pcReceived);
+ return TRANSPORT_FINISHED;
+ }
+ else
+ return TRANSPORT_FAILED;
+ }
+ else
+ return TRANSPORT_FAILED;
+
+#endif //!defined(HT_EXT)
}
void LibWWWTransport::setProxy(const char* pcProxyHost, unsigned int uiProxyPort)
1.2 +1 -1 ws-axis/c/src/transport/libwww/Makefile.am
Index: Makefile.am
===================================================================
RCS file: /home/cvs/ws-axis/c/src/transport/libwww/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.am 15 Jul 2004 03:13:35 -0000 1.1
+++ Makefile.am 15 Jul 2004 04:25:18 -0000 1.2
@@ -1,5 +1,5 @@
lib_LTLIBRARIES = libaxis_LibWWWTransport.la
-AM_CPPFLAGS = $(CPPFLAGS)
+AM_CPPFLAGS = $(CPPFLAGS) -DHT_EXT_CONTINUE
libaxis_LibWWWTransport_la_SOURCES = LibWWWTransport.cpp
#libaxis_LibWWWTransport_la_LIBADD = "`libwww-config --libs`"
libaxis_LibWWWTransport_la_LDFLAGS="`libwww-config --libs`"