summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-06-21 09:46:14 +0000
committermcorino <mcorino@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2010-06-21 09:46:14 +0000
commit5d9c0de54e085d60b67c7a463cd58e1820154b7d (patch)
treea72991d10226c3c7a79172d3b40c4f9ef57709cf
parent1f9ab197260c6ab80fb183617517a16ea0671525 (diff)
downloadATCD-5d9c0de54e085d60b67c7a463cd58e1820154b7d.tar.gz
Mon Jun 21 09:41:30 UTC 2010 Martin Corino <mcorino@remedy.nl>
* protocols/ace/INet/BidirStreamBuffer.cpp: * protocols/ace/INet/BidirStreamBuffer.h: * protocols/ace/INet/BufferedStreamBuffer.cpp: * protocols/ace/INet/BufferedStreamBuffer.h: * protocols/ace/INet/ClientRequestHandler.cpp: * protocols/ace/INet/ClientRequestHandler.h: * protocols/ace/INet/ConnectionCache.cpp: * protocols/ace/INet/ConnectionCache.h: * protocols/ace/INet/HeaderBase.cpp: * protocols/ace/INet/HeaderBase.h: * protocols/ace/INet/HTTP_ClientRequestHandler.cpp: * protocols/ace/INet/HTTP_ClientRequestHandler.h: * protocols/ace/INet/HTTP_Header.cpp: * protocols/ace/INet/HTTP_Header.h: * protocols/ace/INet/HTTP_IOStream.cpp: * protocols/ace/INet/HTTP_IOStream.h: * protocols/ace/INet/HTTP_Request.cpp: * protocols/ace/INet/HTTP_Request.h: * protocols/ace/INet/HTTP_Response.cpp: * protocols/ace/INet/HTTP_Response.h: * protocols/ace/INet/HTTP_Session.cpp: * protocols/ace/INet/HTTP_Session.h: * protocols/ace/INet/HTTP_Status.cpp: * protocols/ace/INet/HTTP_Status.h: * protocols/ace/INet/HTTP_StreamPolicyBase.cpp: * protocols/ace/INet/HTTP_StreamPolicyBase.h: * protocols/ace/INet/HTTP_StreamPolicy.cpp: * protocols/ace/INet/HTTP_StreamPolicy.h: * protocols/ace/INet/HTTP_URL.cpp: * protocols/ace/INet/HTTP_URL.h: * protocols/ace/INet/HTTP_URL.inl: * protocols/ace/INet/IOS_util.cpp: * protocols/ace/INet/IOS_util.h: * protocols/ace/INet/Request.cpp: * protocols/ace/INet/Request.h: * protocols/ace/INet/RequestHandler.cpp: * protocols/ace/INet/RequestHandler.h: * protocols/ace/INet/Response.cpp: * protocols/ace/INet/Response.h: * protocols/ace/INet/Sock_IOStream.cpp: * protocols/ace/INet/Sock_IOStream.h: * protocols/ace/INet/StreamHandler.cpp: * protocols/ace/INet/StreamHandler.h: * protocols/ace/INet/StreamInterceptor.cpp: * protocols/ace/INet/StreamInterceptor.h: * protocols/ace/INet/String_IOStream.cpp: * protocols/ace/INet/String_IOStream.h: * protocols/ace/INet/URLBase.cpp: * protocols/ace/INet/URLBase.h: * protocols/ace/INet/URLBase.inl: Some clean up and reorganization to prepare for new additions. Standardized include statements. Added some (it's a start!) documentation. * protocols/ace/INet/inet.mpc: Added ACE_ROOT/protocols to includes.
-rw-r--r--ACE/ChangeLog60
-rw-r--r--ACE/protocols/ace/INet/BidirStreamBuffer.cpp2
-rw-r--r--ACE/protocols/ace/INet/BidirStreamBuffer.h11
-rw-r--r--ACE/protocols/ace/INet/BufferedStreamBuffer.cpp2
-rw-r--r--ACE/protocols/ace/INet/BufferedStreamBuffer.h5
-rw-r--r--ACE/protocols/ace/INet/ClientRequestHandler.cpp4
-rw-r--r--ACE/protocols/ace/INet/ClientRequestHandler.h10
-rw-r--r--ACE/protocols/ace/INet/ConnectionCache.cpp4
-rw-r--r--ACE/protocols/ace/INet/ConnectionCache.h4
-rw-r--r--ACE/protocols/ace/INet/HTTP_ClientRequestHandler.cpp4
-rw-r--r--ACE/protocols/ace/INet/HTTP_ClientRequestHandler.h18
-rw-r--r--ACE/protocols/ace/INet/HTTP_Header.cpp4
-rw-r--r--ACE/protocols/ace/INet/HTTP_Header.h8
-rw-r--r--ACE/protocols/ace/INet/HTTP_IOStream.cpp6
-rw-r--r--ACE/protocols/ace/INet/HTTP_IOStream.h8
-rw-r--r--ACE/protocols/ace/INet/HTTP_Request.cpp4
-rw-r--r--ACE/protocols/ace/INet/HTTP_Request.h8
-rw-r--r--ACE/protocols/ace/INet/HTTP_Response.cpp4
-rw-r--r--ACE/protocols/ace/INet/HTTP_Response.h10
-rw-r--r--ACE/protocols/ace/INet/HTTP_Session.cpp8
-rw-r--r--ACE/protocols/ace/INet/HTTP_Session.h16
-rw-r--r--ACE/protocols/ace/INet/HTTP_Status.cpp6
-rw-r--r--ACE/protocols/ace/INet/HTTP_Status.h4
-rw-r--r--ACE/protocols/ace/INet/HTTP_StreamPolicy.cpp2
-rw-r--r--ACE/protocols/ace/INet/HTTP_StreamPolicy.h10
-rw-r--r--ACE/protocols/ace/INet/HTTP_StreamPolicyBase.cpp2
-rw-r--r--ACE/protocols/ace/INet/HTTP_StreamPolicyBase.h6
-rw-r--r--ACE/protocols/ace/INet/HTTP_URL.cpp153
-rw-r--r--ACE/protocols/ace/INet/HTTP_URL.h35
-rw-r--r--ACE/protocols/ace/INet/HTTP_URL.inl40
-rw-r--r--ACE/protocols/ace/INet/HeaderBase.cpp4
-rw-r--r--ACE/protocols/ace/INet/HeaderBase.h4
-rw-r--r--ACE/protocols/ace/INet/IOS_util.cpp2
-rw-r--r--ACE/protocols/ace/INet/IOS_util.h2
-rw-r--r--ACE/protocols/ace/INet/Request.cpp2
-rw-r--r--ACE/protocols/ace/INet/Request.h4
-rw-r--r--ACE/protocols/ace/INet/RequestHandler.cpp2
-rw-r--r--ACE/protocols/ace/INet/RequestHandler.h6
-rw-r--r--ACE/protocols/ace/INet/Response.cpp2
-rw-r--r--ACE/protocols/ace/INet/Response.h4
-rw-r--r--ACE/protocols/ace/INet/Sock_IOStream.cpp4
-rw-r--r--ACE/protocols/ace/INet/Sock_IOStream.h6
-rw-r--r--ACE/protocols/ace/INet/StreamHandler.cpp24
-rw-r--r--ACE/protocols/ace/INet/StreamHandler.h31
-rw-r--r--ACE/protocols/ace/INet/StreamInterceptor.cpp2
-rw-r--r--ACE/protocols/ace/INet/StreamInterceptor.h4
-rw-r--r--ACE/protocols/ace/INet/String_IOStream.cpp48
-rw-r--r--ACE/protocols/ace/INet/String_IOStream.h21
-rw-r--r--ACE/protocols/ace/INet/URLBase.cpp227
-rw-r--r--ACE/protocols/ace/INet/URLBase.h77
-rw-r--r--ACE/protocols/ace/INet/URLBase.inl56
-rw-r--r--ACE/protocols/ace/INet/inet.mpc1
52 files changed, 660 insertions, 331 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index e82343ccf3d..d644a6c8d81 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,63 @@
+Mon Jun 21 09:41:30 UTC 2010 Martin Corino <mcorino@remedy.nl>
+
+ * protocols/ace/INet/BidirStreamBuffer.cpp:
+ * protocols/ace/INet/BidirStreamBuffer.h:
+ * protocols/ace/INet/BufferedStreamBuffer.cpp:
+ * protocols/ace/INet/BufferedStreamBuffer.h:
+ * protocols/ace/INet/ClientRequestHandler.cpp:
+ * protocols/ace/INet/ClientRequestHandler.h:
+ * protocols/ace/INet/ConnectionCache.cpp:
+ * protocols/ace/INet/ConnectionCache.h:
+ * protocols/ace/INet/HeaderBase.cpp:
+ * protocols/ace/INet/HeaderBase.h:
+ * protocols/ace/INet/HTTP_ClientRequestHandler.cpp:
+ * protocols/ace/INet/HTTP_ClientRequestHandler.h:
+ * protocols/ace/INet/HTTP_Header.cpp:
+ * protocols/ace/INet/HTTP_Header.h:
+ * protocols/ace/INet/HTTP_IOStream.cpp:
+ * protocols/ace/INet/HTTP_IOStream.h:
+ * protocols/ace/INet/HTTP_Request.cpp:
+ * protocols/ace/INet/HTTP_Request.h:
+ * protocols/ace/INet/HTTP_Response.cpp:
+ * protocols/ace/INet/HTTP_Response.h:
+ * protocols/ace/INet/HTTP_Session.cpp:
+ * protocols/ace/INet/HTTP_Session.h:
+ * protocols/ace/INet/HTTP_Status.cpp:
+ * protocols/ace/INet/HTTP_Status.h:
+ * protocols/ace/INet/HTTP_StreamPolicyBase.cpp:
+ * protocols/ace/INet/HTTP_StreamPolicyBase.h:
+ * protocols/ace/INet/HTTP_StreamPolicy.cpp:
+ * protocols/ace/INet/HTTP_StreamPolicy.h:
+ * protocols/ace/INet/HTTP_URL.cpp:
+ * protocols/ace/INet/HTTP_URL.h:
+ * protocols/ace/INet/HTTP_URL.inl:
+ * protocols/ace/INet/IOS_util.cpp:
+ * protocols/ace/INet/IOS_util.h:
+ * protocols/ace/INet/Request.cpp:
+ * protocols/ace/INet/Request.h:
+ * protocols/ace/INet/RequestHandler.cpp:
+ * protocols/ace/INet/RequestHandler.h:
+ * protocols/ace/INet/Response.cpp:
+ * protocols/ace/INet/Response.h:
+ * protocols/ace/INet/Sock_IOStream.cpp:
+ * protocols/ace/INet/Sock_IOStream.h:
+ * protocols/ace/INet/StreamHandler.cpp:
+ * protocols/ace/INet/StreamHandler.h:
+ * protocols/ace/INet/StreamInterceptor.cpp:
+ * protocols/ace/INet/StreamInterceptor.h:
+ * protocols/ace/INet/String_IOStream.cpp:
+ * protocols/ace/INet/String_IOStream.h:
+ * protocols/ace/INet/URLBase.cpp:
+ * protocols/ace/INet/URLBase.h:
+ * protocols/ace/INet/URLBase.inl:
+ Some clean up and reorganization to prepare for
+ new additions.
+ Standardized include statements.
+ Added some (it's a start!) documentation.
+
+ * protocols/ace/INet/inet.mpc:
+ Added ACE_ROOT/protocols to includes.
+
Fri Jun 18 20:32:54 UTC 2010 Steve Huston <shuston@riverace.com>
* tests/Service_Config_Test.cpp: Disable error logging around the
diff --git a/ACE/protocols/ace/INet/BidirStreamBuffer.cpp b/ACE/protocols/ace/INet/BidirStreamBuffer.cpp
index 3bf61ac11eb..d20d8dd072b 100644
--- a/ACE/protocols/ace/INet/BidirStreamBuffer.cpp
+++ b/ACE/protocols/ace/INet/BidirStreamBuffer.cpp
@@ -3,7 +3,7 @@
#ifndef ACE_IOS_BIDIR_STREAM_BUFFER_CPP
#define ACE_IOS_BIDIR_STREAM_BUFFER_CPP
-#include "BidirStreamBuffer.h"
+#include "ace/INet/BidirStreamBuffer.h"
#include "ace/OS_Memory.h"
#include "ace/OS_NS_string.h"
diff --git a/ACE/protocols/ace/INet/BidirStreamBuffer.h b/ACE/protocols/ace/INet/BidirStreamBuffer.h
index be24fdf44e0..7212776bc8e 100644
--- a/ACE/protocols/ace/INet/BidirStreamBuffer.h
+++ b/ACE/protocols/ace/INet/BidirStreamBuffer.h
@@ -34,12 +34,19 @@ namespace ACE
* @brief Encapsulates bidirectional streambuffer attached
* to a StreamHandler implementation.
*
+ * Implements a C++ standard bidirectional streambuffer using
+ * a streamed connection handler as data source/destination.
+ * Used as a base for implementing C++ standard streams capable
+ * of performing C++ standard formatted input and output on
+ * any streamed connection that can be represented by a stream
+ * handler.
*/
template <class ACE_CHAR_T, class STREAM_HANDLER, class TR = std::char_traits<ACE_CHAR_T> >
class BasicBidirStreamBuffer
: public std::basic_streambuf<ACE_CHAR_T, TR>
{
public:
+ // useful traits
typedef std::basic_streambuf<ACE_CHAR_T, TR> base_type;
typedef std::basic_ios<ACE_CHAR_T, TR> ios_type;
typedef ACE_CHAR_T char_type;
@@ -49,8 +56,10 @@ namespace ACE
typedef typename base_type::off_type off_type;
typedef typename ios_type::openmode openmode;
+ /// Constructor
BasicBidirStreamBuffer (STREAM_HANDLER* sh, std::streamsize bufsz, openmode mode);
+ /// Destructor
virtual ~BasicBidirStreamBuffer ();
virtual int_type overflow (int_type c);
@@ -114,7 +123,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "BidirStreamBuffer.cpp"
+#include "ace/INet/BidirStreamBuffer.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
diff --git a/ACE/protocols/ace/INet/BufferedStreamBuffer.cpp b/ACE/protocols/ace/INet/BufferedStreamBuffer.cpp
index 95ad4f02e78..b6c3f4ab749 100644
--- a/ACE/protocols/ace/INet/BufferedStreamBuffer.cpp
+++ b/ACE/protocols/ace/INet/BufferedStreamBuffer.cpp
@@ -3,7 +3,7 @@
#ifndef ACE_BUFFERED_STREAM_BUFFER_CPP
#define ACE_BUFFERED_STREAM_BUFFER_CPP
-#include "BufferedStreamBuffer.h"
+#include "ace/INet/BufferedStreamBuffer.h"
#include "ace/OS_Memory.h"
#include "ace/OS_NS_string.h"
diff --git a/ACE/protocols/ace/INet/BufferedStreamBuffer.h b/ACE/protocols/ace/INet/BufferedStreamBuffer.h
index d13af00bfcf..a7313ad7608 100644
--- a/ACE/protocols/ace/INet/BufferedStreamBuffer.h
+++ b/ACE/protocols/ace/INet/BufferedStreamBuffer.h
@@ -18,7 +18,7 @@
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Auto_Ptr.h"
-#include "StreamInterceptor.h"
+#include "ace/INet/StreamInterceptor.h"
#include <streambuf>
#include <iosfwd>
#include <ios>
@@ -48,6 +48,7 @@ namespace ACE
typedef typename base_type::int_type int_type;
typedef typename base_type::pos_type pos_type;
typedef typename base_type::off_type off_type;
+ typedef typename ios_type::seekdir seekdir;
typedef typename ios_type::openmode openmode;
typedef StreamInterceptorBase<char_type, char_traits> interceptor_type;
@@ -91,7 +92,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "BufferedStreamBuffer.cpp"
+#include "ace/INet/BufferedStreamBuffer.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
diff --git a/ACE/protocols/ace/INet/ClientRequestHandler.cpp b/ACE/protocols/ace/INet/ClientRequestHandler.cpp
index e3bf416ea1a..5f58ff8d053 100644
--- a/ACE/protocols/ace/INet/ClientRequestHandler.cpp
+++ b/ACE/protocols/ace/INet/ClientRequestHandler.cpp
@@ -1,10 +1,10 @@
// $Id$
-#include "ClientRequestHandler.h"
+#include "ace/INet/ClientRequestHandler.h"
#include "ace/Functor_String.h"
#if !defined (__ACE_INLINE__)
-#include "ClientRequestHandler.inl"
+#include "ace/INet/ClientRequestHandler.inl"
#endif
ACE_RCSID(NET_CLIENT,ACE_INet_ClientRequestHandler,"$Id$")
diff --git a/ACE/protocols/ace/INet/ClientRequestHandler.h b/ACE/protocols/ace/INet/ClientRequestHandler.h
index 20bbf88ee40..227934c89e7 100644
--- a/ACE/protocols/ace/INet/ClientRequestHandler.h
+++ b/ACE/protocols/ace/INet/ClientRequestHandler.h
@@ -15,10 +15,10 @@
#include "ace/Synch_Traits.h"
#include "ace/Null_Mutex.h"
#include "ace/Thread_Mutex.h"
-#include "INet_Export.h"
-#include "URLBase.h"
-#include "RequestHandler.h"
-#include "ConnectionCache.h"
+#include "ace/INet/INet_Export.h"
+#include "ace/INet/URLBase.h"
+#include "ace/INet/RequestHandler.h"
+#include "ace/INet/ConnectionCache.h"
#include <iostream>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -105,7 +105,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
-#include "ClientRequestHandler.inl"
+#include "ace/INet/ClientRequestHandler.inl"
#endif
#include /**/ "ace/post.h"
diff --git a/ACE/protocols/ace/INet/ConnectionCache.cpp b/ACE/protocols/ace/INet/ConnectionCache.cpp
index c469698ecff..a22eaa0bebf 100644
--- a/ACE/protocols/ace/INet/ConnectionCache.cpp
+++ b/ACE/protocols/ace/INet/ConnectionCache.cpp
@@ -1,9 +1,9 @@
// $Id$
-#include "ConnectionCache.h"
+#include "ace/INet/ConnectionCache.h"
#if !defined (__ACE_INLINE__)
-#include "ConnectionCache.inl"
+#include "ace/INet/ConnectionCache.inl"
#endif
ACE_RCSID(NET_CLIENT,ACE_INet_ConnectionCache,"$Id$")
diff --git a/ACE/protocols/ace/INet/ConnectionCache.h b/ACE/protocols/ace/INet/ConnectionCache.h
index 33e2ecfcf78..5bfba94e2a1 100644
--- a/ACE/protocols/ace/INet/ConnectionCache.h
+++ b/ACE/protocols/ace/INet/ConnectionCache.h
@@ -16,7 +16,7 @@
#include "ace/Condition_Thread_Mutex.h"
#include "ace/Null_Mutex.h"
#include "ace/Hash_Map_Manager_T.h"
-#include "INet_Export.h"
+#include "ace/INet/INet_Export.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -224,7 +224,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
-#include "ConnectionCache.inl"
+#include "ace/INet/ConnectionCache.inl"
#endif
#include /**/ "ace/post.h"
diff --git a/ACE/protocols/ace/INet/HTTP_ClientRequestHandler.cpp b/ACE/protocols/ace/INet/HTTP_ClientRequestHandler.cpp
index 038b765fe1a..944d00558c8 100644
--- a/ACE/protocols/ace/INet/HTTP_ClientRequestHandler.cpp
+++ b/ACE/protocols/ace/INet/HTTP_ClientRequestHandler.cpp
@@ -1,9 +1,9 @@
// $Id$
-#include "HTTP_ClientRequestHandler.h"
+#include "ace/INet/HTTP_ClientRequestHandler.h"
#if !defined (__ACE_INLINE__)
-#include "HTTP_ClientRequestHandler.inl"
+#include "ace/INet/HTTP_ClientRequestHandler.inl"
#endif
#include "ace/Auto_Ptr.h"
diff --git a/ACE/protocols/ace/INet/HTTP_ClientRequestHandler.h b/ACE/protocols/ace/INet/HTTP_ClientRequestHandler.h
index 7ec97e84e00..c64f30e749e 100644
--- a/ACE/protocols/ace/INet/HTTP_ClientRequestHandler.h
+++ b/ACE/protocols/ace/INet/HTTP_ClientRequestHandler.h
@@ -19,14 +19,14 @@
#include "ace/Synch_Traits.h"
#include "ace/Thread_Mutex.h"
-#include "INet_Export.h"
-#include "IOS_util.h"
-#include "StreamInterceptor.h"
-#include "ClientRequestHandler.h"
-#include "HTTP_Request.h"
-#include "HTTP_Response.h"
-#include "HTTP_Session.h"
-#include "HTTP_URL.h"
+#include "ace/INet/INet_Export.h"
+#include "ace/INet/IOS_util.h"
+#include "ace/INet/StreamInterceptor.h"
+#include "ace/INet/ClientRequestHandler.h"
+#include "ace/INet/HTTP_Request.h"
+#include "ace/INet/HTTP_Response.h"
+#include "ace/INet/HTTP_Session.h"
+#include "ace/INet/HTTP_URL.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -135,7 +135,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
-#include "HTTP_ClientRequestHandler.inl"
+#include "ace/INet/HTTP_ClientRequestHandler.inl"
#endif
#include /**/ "ace/post.h"
diff --git a/ACE/protocols/ace/INet/HTTP_Header.cpp b/ACE/protocols/ace/INet/HTTP_Header.cpp
index fd32835263d..bf016df4764 100644
--- a/ACE/protocols/ace/INet/HTTP_Header.cpp
+++ b/ACE/protocols/ace/INet/HTTP_Header.cpp
@@ -1,11 +1,11 @@
// $Id$
-#include "HTTP_Header.h"
+#include "ace/INet/HTTP_Header.h"
#include "ace/OS_NS_stdlib.h"
#include <string>
#if !defined (__ACE_INLINE__)
-#include "HTTP_Header.inl"
+#include "ace/INet/HTTP_Header.inl"
#endif
ACE_RCSID(NET_CLIENT,ACE_HTTP_Header,"$Id$")
diff --git a/ACE/protocols/ace/INet/HTTP_Header.h b/ACE/protocols/ace/INet/HTTP_Header.h
index 93901018254..558ca663516 100644
--- a/ACE/protocols/ace/INet/HTTP_Header.h
+++ b/ACE/protocols/ace/INet/HTTP_Header.h
@@ -17,8 +17,8 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "INet_Export.h"
-#include "HeaderBase.h"
+#include "ace/INet/INet_Export.h"
+#include "ace/INet/HeaderBase.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -33,7 +33,7 @@ namespace ACE
*
*/
class ACE_INET_Export Header
- : public virtual ACE::INet::HeaderBase
+ : public ACE::INet::HeaderBase
{
public:
/// Constructor
@@ -91,7 +91,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
-#include "HTTP_Header.inl"
+#include "ace/INet/HTTP_Header.inl"
#endif
#include /**/ "ace/post.h"
diff --git a/ACE/protocols/ace/INet/HTTP_IOStream.cpp b/ACE/protocols/ace/INet/HTTP_IOStream.cpp
index f6c2613b07b..e09faefa394 100644
--- a/ACE/protocols/ace/INet/HTTP_IOStream.cpp
+++ b/ACE/protocols/ace/INet/HTTP_IOStream.cpp
@@ -1,10 +1,10 @@
// $Id$
-#include "HTTP_IOStream.h"
-#include "IOS_util.h"
+#include "ace/INet/HTTP_IOStream.h"
+#include "ace/INet/IOS_util.h"
#if !defined (__ACE_INLINE__)
-#include "HTTP_IOStream.inl"
+#include "ace/INet/HTTP_IOStream.inl"
#endif
#include "ace/Truncate.h"
diff --git a/ACE/protocols/ace/INet/HTTP_IOStream.h b/ACE/protocols/ace/INet/HTTP_IOStream.h
index 6fc1edfd951..2157fd1c893 100644
--- a/ACE/protocols/ace/INet/HTTP_IOStream.h
+++ b/ACE/protocols/ace/INet/HTTP_IOStream.h
@@ -17,9 +17,9 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "INet_Export.h"
-#include "BufferedStreamBuffer.h"
-#include "HTTP_StreamPolicyBase.h"
+#include "ace/INet/INet_Export.h"
+#include "ace/INet/BufferedStreamBuffer.h"
+#include "ace/INet/HTTP_StreamPolicyBase.h"
#include <ostream>
#include <istream>
@@ -126,7 +126,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
-#include "HTTP_IOStream.inl"
+#include "ace/INet/HTTP_IOStream.inl"
#endif
#include /**/ "ace/post.h"
diff --git a/ACE/protocols/ace/INet/HTTP_Request.cpp b/ACE/protocols/ace/INet/HTTP_Request.cpp
index d39b23d33c8..dbaad2b471c 100644
--- a/ACE/protocols/ace/INet/HTTP_Request.cpp
+++ b/ACE/protocols/ace/INet/HTTP_Request.cpp
@@ -2,10 +2,10 @@
#include "ace/String_Base.h"
#include "ace/OS_NS_ctype.h"
-#include "HTTP_Request.h"
+#include "ace/INet/HTTP_Request.h"
#if !defined (__ACE_INLINE__)
-#include "HTTP_Request.inl"
+#include "ace/INet/HTTP_Request.inl"
#endif
ACE_RCSID(NET_CLIENT,ACE_HTTP_Request,"$Id$")
diff --git a/ACE/protocols/ace/INet/HTTP_Request.h b/ACE/protocols/ace/INet/HTTP_Request.h
index 49aba4b418f..b549e403c59 100644
--- a/ACE/protocols/ace/INet/HTTP_Request.h
+++ b/ACE/protocols/ace/INet/HTTP_Request.h
@@ -18,9 +18,9 @@
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Array.h"
-#include "INet_Export.h"
-#include "Request.h"
-#include "HTTP_Header.h"
+#include "ace/INet/INet_Export.h"
+#include "ace/INet/Request.h"
+#include "ace/INet/HTTP_Header.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -132,7 +132,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
-#include "HTTP_Request.inl"
+#include "ace/INet/HTTP_Request.inl"
#endif
#include /**/ "ace/post.h"
diff --git a/ACE/protocols/ace/INet/HTTP_Response.cpp b/ACE/protocols/ace/INet/HTTP_Response.cpp
index cf60e672f4f..6fb1f6563af 100644
--- a/ACE/protocols/ace/INet/HTTP_Response.cpp
+++ b/ACE/protocols/ace/INet/HTTP_Response.cpp
@@ -3,10 +3,10 @@
#include "ace/OS_NS_stdlib.h"
#include "ace/OS_NS_ctype.h"
#include "ace/String_Base.h"
-#include "HTTP_Response.h"
+#include "ace/INet/HTTP_Response.h"
#if !defined (__ACE_INLINE__)
-#include "HTTP_Response.inl"
+#include "ace/INet/HTTP_Response.inl"
#endif
ACE_RCSID(NET_CLIENT,ACE_HTTP_Response,"$Id$")
diff --git a/ACE/protocols/ace/INet/HTTP_Response.h b/ACE/protocols/ace/INet/HTTP_Response.h
index 53ba1c6c18d..46c0fa4fa8e 100644
--- a/ACE/protocols/ace/INet/HTTP_Response.h
+++ b/ACE/protocols/ace/INet/HTTP_Response.h
@@ -18,10 +18,10 @@
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Array.h"
-#include "INet_Export.h"
-#include "Response.h"
-#include "HTTP_Header.h"
-#include "HTTP_Status.h"
+#include "ace/INet/INet_Export.h"
+#include "ace/INet/Response.h"
+#include "ace/INet/HTTP_Header.h"
+#include "ace/INet/HTTP_Status.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -94,7 +94,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
-#include "HTTP_Response.inl"
+#include "ace/INet/HTTP_Response.inl"
#endif
#include /**/ "ace/post.h"
diff --git a/ACE/protocols/ace/INet/HTTP_Session.cpp b/ACE/protocols/ace/INet/HTTP_Session.cpp
index 67e1ba61941..33de717daaa 100644
--- a/ACE/protocols/ace/INet/HTTP_Session.cpp
+++ b/ACE/protocols/ace/INet/HTTP_Session.cpp
@@ -3,10 +3,10 @@
#ifndef ACE_HTTP_SESSION_CPP
#define ACE_HTTP_SESSION_CPP
-#include "HTTP_Session.h"
-#include "HTTP_StreamPolicy.h"
-#include "String_IOStream.h"
-#include "IOS_util.h"
+#include "ace/INet/HTTP_Session.h"
+#include "ace/INet/HTTP_StreamPolicy.h"
+#include "ace/INet/String_IOStream.h"
+#include "ace/INet/IOS_util.h"
#include "ace/INET_Addr.h"
#include "ace/Event_Handler.h"
#include "ace/Connector.h"
diff --git a/ACE/protocols/ace/INet/HTTP_Session.h b/ACE/protocols/ace/INet/HTTP_Session.h
index c33a45ae958..cdf394e4588 100644
--- a/ACE/protocols/ace/INet/HTTP_Session.h
+++ b/ACE/protocols/ace/INet/HTTP_Session.h
@@ -14,12 +14,12 @@
#include "ace/SString.h"
#include "ace/Countdown_Time.h"
#include "ace/SOCK_Connector.h"
-#include "INet_Export.h"
-#include "HTTP_Request.h"
-#include "HTTP_Response.h"
-#include "StreamHandler.h"
-#include "Sock_IOStream.h"
-#include "HTTP_IOStream.h"
+#include "ace/INet/INet_Export.h"
+#include "ace/INet/HTTP_Request.h"
+#include "ace/INet/HTTP_Response.h"
+#include "ace/INet/StreamHandler.h"
+#include "ace/INet/Sock_IOStream.h"
+#include "ace/INet/HTTP_IOStream.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -28,7 +28,7 @@ namespace ACE
namespace HTTP
{
/**
- * @class ACE_HTTP_Connection
+ * @class ACE_HTTP_Session
*
* @brief Encapsulates HTTP session.
*
@@ -119,7 +119,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "HTTP_Session.cpp"
+#include "ace/INet/HTTP_Session.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
diff --git a/ACE/protocols/ace/INet/HTTP_Status.cpp b/ACE/protocols/ace/INet/HTTP_Status.cpp
index 540129ccf7b..855b1fe4e5a 100644
--- a/ACE/protocols/ace/INet/HTTP_Status.cpp
+++ b/ACE/protocols/ace/INet/HTTP_Status.cpp
@@ -1,11 +1,11 @@
// $Id$
-#include "HTTP_Status.h"
-#include "HeaderBase.h"
+#include "ace/INet/HTTP_Status.h"
+#include "ace/INet/HeaderBase.h"
#include "ace/OS_NS_stdlib.h"
#if !defined (__ACE_INLINE__)
-#include "HTTP_Status.inl"
+#include "ace/INet/HTTP_Status.inl"
#endif
ACE_RCSID(NET_CLIENT,ACE_HTTP_Status,"$Id$")
diff --git a/ACE/protocols/ace/INet/HTTP_Status.h b/ACE/protocols/ace/INet/HTTP_Status.h
index e71f1cf4bc2..a7435e5925b 100644
--- a/ACE/protocols/ace/INet/HTTP_Status.h
+++ b/ACE/protocols/ace/INet/HTTP_Status.h
@@ -18,7 +18,7 @@
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/SString.h"
-#include "INet_Export.h"
+#include "ace/INet/INet_Export.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -183,7 +183,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
-#include "HTTP_Status.inl"
+#include "ace/INet/HTTP_Status.inl"
#endif
#include /**/ "ace/post.h"
diff --git a/ACE/protocols/ace/INet/HTTP_StreamPolicy.cpp b/ACE/protocols/ace/INet/HTTP_StreamPolicy.cpp
index 2250dc20141..50b962e5d20 100644
--- a/ACE/protocols/ace/INet/HTTP_StreamPolicy.cpp
+++ b/ACE/protocols/ace/INet/HTTP_StreamPolicy.cpp
@@ -3,7 +3,7 @@
#ifndef ACE_HTTP_STREAM_POLICY_CPP
#define ACE_HTTP_STREAM_POLICY_CPP
-#include "HTTP_StreamPolicy.h"
+#include "ace/INet/HTTP_StreamPolicy.h"
#include <cctype>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
diff --git a/ACE/protocols/ace/INet/HTTP_StreamPolicy.h b/ACE/protocols/ace/INet/HTTP_StreamPolicy.h
index a451c9ef7ff..c9c139a003e 100644
--- a/ACE/protocols/ace/INet/HTTP_StreamPolicy.h
+++ b/ACE/protocols/ace/INet/HTTP_StreamPolicy.h
@@ -11,10 +11,10 @@
#include /**/ "ace/pre.h"
-#include "INet_Export.h"
-#include "HTTP_StreamPolicyBase.h"
-#include "HTTP_IOStream.h"
-#include "String_IOStream.h"
+#include "ace/INet/INet_Export.h"
+#include "ace/INet/HTTP_StreamPolicyBase.h"
+#include "ace/INet/HTTP_IOStream.h"
+#include "ace/INet/String_IOStream.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -87,7 +87,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "HTTP_StreamPolicy.cpp"
+#include "ace/INet/HTTP_StreamPolicy.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
diff --git a/ACE/protocols/ace/INet/HTTP_StreamPolicyBase.cpp b/ACE/protocols/ace/INet/HTTP_StreamPolicyBase.cpp
index ac7538a14b1..6b72b17d203 100644
--- a/ACE/protocols/ace/INet/HTTP_StreamPolicyBase.cpp
+++ b/ACE/protocols/ace/INet/HTTP_StreamPolicyBase.cpp
@@ -3,7 +3,7 @@
#ifndef ACE_HTTP_STREAM_POLICY_BASE_CPP
#define ACE_HTTP_STREAM_POLICY_BASE_CPP
-#include "HTTP_StreamPolicyBase.h"
+#include "ace/INet/HTTP_StreamPolicyBase.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
diff --git a/ACE/protocols/ace/INet/HTTP_StreamPolicyBase.h b/ACE/protocols/ace/INet/HTTP_StreamPolicyBase.h
index 637bb6632c8..814377b7050 100644
--- a/ACE/protocols/ace/INet/HTTP_StreamPolicyBase.h
+++ b/ACE/protocols/ace/INet/HTTP_StreamPolicyBase.h
@@ -11,8 +11,8 @@
#include /**/ "ace/pre.h"
-#include "INet_Export.h"
-#include "BufferedStreamBuffer.h"
+#include "ace/INet/INet_Export.h"
+#include "ace/INet/BufferedStreamBuffer.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -55,7 +55,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "HTTP_StreamPolicyBase.cpp"
+#include "ace/INet/HTTP_StreamPolicyBase.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
diff --git a/ACE/protocols/ace/INet/HTTP_URL.cpp b/ACE/protocols/ace/INet/HTTP_URL.cpp
index f4d5255b711..6a7803d8408 100644
--- a/ACE/protocols/ace/INet/HTTP_URL.cpp
+++ b/ACE/protocols/ace/INet/HTTP_URL.cpp
@@ -1,13 +1,13 @@
// $Id$
-#include "HTTP_URL.h"
+#include "ace/INet/HTTP_URL.h"
#if !defined (__ACE_INLINE__)
-#include "HTTP_URL.inl"
+#include "ace/INet/HTTP_URL.inl"
#endif
-#include "String_IOStream.h"
-#include "HTTP_ClientRequestHandler.h"
+#include "ace/INet/String_IOStream.h"
+#include "ace/INet/HTTP_ClientRequestHandler.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -18,20 +18,20 @@ namespace ACE
const ACE_CString URL::PROTOCOL ("http");
URL::URL ()
- : URL_INetBase (HTTP_PORT),
+ : URL_INetAuthBase (HTTP_PORT),
proxy_port_ (HTTP_PROXY_PORT)
{
}
URL::URL (const ACE_CString& url_string)
- : URL_INetBase (HTTP_PORT),
+ : URL_INetAuthBase (HTTP_PORT),
proxy_port_ (HTTP_PROXY_PORT)
{
this->parse (url_string);
}
URL::URL (const URL& url)
- : URL_INetBase (0)
+ : URL_INetAuthBase (0)
{
*this = url;
}
@@ -42,160 +42,49 @@ namespace ACE
URL& URL::operator =(const URL& url)
{
- URL_INetBase::set_port (url.get_port ());
- this->set_host (url.get_host ());
this->set_user_info (url.get_user_info ());
+ this->set_host (url.get_host ());
+ this->set_port (url.get_port ());
this->set_path (url.get_path ());
this->set_query (url.get_query ());
+ this->set_fragment (url.get_fragment ());
this->set_proxy (url.get_proxy_host (), url.get_proxy_port ());
return *this;
}
- bool URL::parse (const ACE_CString& url_string)
- {
- static const int eof =
- std::char_traits<ACE::IOS::CString_OStream::char_type>::eof ();
-
- ACE_CString uri = url_string;
- if (this->strip_protocol (uri))
- {
- ACE::IOS::CString_OStream sos;
- ACE::IOS::CString_IStream sis (uri);
-
- int ch;
- for (ch = sis.get ();
-#if defined (ACE_HAS_IPV6)
- ch != '[' && ch != '/' && ch != ':' && ch != '@' && ch != '?' && ch != eof ;
-#else
- ch != '/' && ch != ':' && ch != '@' && ch != '?' && ch != eof ;
-#endif
- ch = sis.get ())
- sos.put (ch);
-
- if (ch == '@')
- {
- this->set_user_info (sos.str ());
- sos.clear ();
-
- for (ch = sis.get ();
-#if defined (ACE_HAS_IPV6)
- ch != '[' && ch != '/' && ch != ':' && ch != '?' && ch != eof ;
-#else
- ch != '/' && ch != ':' && ch != '?' && ch != eof ;
-#endif
- ch = sis.get ())
- sos.put (ch);
- }
-
-#if defined (ACE_HAS_IPV6)
- if (ch == '[')
- {
- sos.clear ();
- for (ch = sis.get (); ch != ']' && ch != eof ;ch = sis.get ())
- sos.put (ch);
- if (ch != eof)
- ch = sis.get (); // skip ']'
- if (ch != '/' && ch != ':' && ch != '?' && ch != eof)
- {
- this->set_host (empty_); // invalid URL, clear host field
- ch = eof; // stop parsing
- }
- else
- {
- this->set_host (sos.str ());
- }
- }
- else
- {
-#endif
- this->set_host (sos.str ());
-#if defined (ACE_HAS_IPV6)
- }
-#endif
- sos.clear ();
-
- if (ch == ':')
- {
- u_short port = 0;
- sis >> port; // should stop at '/' or '?' or eof
- this->set_port (port);
- ch = sis.get ();
- }
-
- if (ch == '/')
- {
- sos.put (ch);
- for (ch = sis.get (); ch != '?' && ch != eof ;ch = sis.get ())
- sos.put (ch);
- this->set_path (sos.str ());
- sos.clear ();
- }
- else
- {
- // default path when not specified in URL
- this->set_path ('/');
- }
-
- if (ch == '?')
- {
- sos << sis.rdbuf ();
- this->set_query (sos.str ());
- }
- else if (ch != eof)
- {
- // something went wrong at port extraction
- this->set_port (0);
- }
-
- // check for host + port + path minimum correctness
- if (!this->get_host ().empty () &&
- this->get_port () != 0 &&
- !this->get_path ().empty () &&
- this->get_path ()[0] == '/')
- {
- return true;
- }
- }
- return false;
- }
-
- ACE_CString URL::get_authority () const
- {
- ACE::IOS::CString_OStream sos;
- sos << this->get_protocol ().c_str () << "://";
- if (!this->get_user_info ().empty ())
- sos << this->get_user_info ().c_str () << "@";
- sos << this->get_host().c_str ();
- if (this->get_port () != HTTP_PORT)
- sos << ':' << this->get_port ();
- return sos.str ();
- }
-
ACE_CString URL::get_request_uri () const
{
ACE::IOS::CString_OStream sos;
if (!this->proxy_host_.empty ())
{
- sos << this->get_protocol ().c_str () << "://"
+ sos << this->get_scheme ().c_str () << "://"
<< ACE::INet::URL_INetBase::get_host ().c_str ();
if (ACE::INet::URL_INetBase::get_port () != HTTP_PORT)
{
sos << ':' << ACE::INet::URL_INetBase::get_port ();
}
}
- sos << this->get_path ().c_str ();
+ // if path is empty we're requesting the root
+ sos << (this->get_path ().empty () ?
+ "/" :
+ this->get_path ().c_str ());
if (!this->get_query ().empty ())
sos << '?' << this->get_query ().c_str ();
+ if (!this->get_fragment ().empty ())
+ sos << '#' << this->get_fragment ().c_str ();
return sos.str ();
}
ACE_CString URL::to_string () const
{
ACE::IOS::CString_OStream sos;
- sos << this->get_authority ().c_str ()
+ sos << this->get_scheme () << "://"
+ << this->get_authority ().c_str ()
<< this->get_path ().c_str ();
if (!this->get_query ().empty ())
sos << '?' << this->get_query ().c_str ();
+ if (!this->get_fragment ().empty ())
+ sos << '#' << this->get_fragment ().c_str ();
return sos.str ();
}
diff --git a/ACE/protocols/ace/INet/HTTP_URL.h b/ACE/protocols/ace/INet/HTTP_URL.h
index f31aba1c059..e392c17d727 100644
--- a/ACE/protocols/ace/INet/HTTP_URL.h
+++ b/ACE/protocols/ace/INet/HTTP_URL.h
@@ -17,8 +17,8 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "INet_Export.h"
-#include "URLBase.h"
+#include "ace/INet/INet_Export.h"
+#include "ace/INet/URLBase.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -33,7 +33,7 @@ namespace ACE
*
*/
class ACE_INET_Export URL
- : public ACE::INet::URL_INetBase
+ : public ACE::INet::URL_INetAuthBase
{
public:
URL ();
@@ -43,29 +43,17 @@ namespace ACE
URL& operator =(const URL& url);
- virtual bool parse (const ACE_CString& url_string);
-
-#if defined (ACE_HAS_WCHAR)
- virtual bool parse (const ACE_WString& url_string);
-#endif
-
- virtual const ACE_CString& get_protocol () const;
-
- virtual ACE_CString get_authority () const;
-
- virtual const ACE_CString& get_user_info () const;
-
- virtual const ACE_CString& get_path () const;
+ virtual const ACE_CString& get_scheme () const;
virtual const ACE_CString& get_query () const;
- ACE_CString get_request_uri () const;
+ virtual const ACE_CString& get_fragment () const;
- void set_user_info (const ACE_CString& userinfo);
+ ACE_CString get_request_uri () const;
- void set_path (const ACE_CString& path);
+ virtual void set_query (const ACE_CString& query);
- void set_query (const ACE_CString& query);
+ virtual void set_fragment (const ACE_CString& fargment);
void set_proxy (const ACE_CString& proxy_host, u_short proxy_port = HTTP_PROXY_PORT);
@@ -77,6 +65,8 @@ namespace ACE
virtual ACE_CString to_string () const;
+ virtual u_short default_port () const;
+
static const ACE_CString PROTOCOL;
enum
@@ -89,9 +79,8 @@ namespace ACE
virtual ACE::INet::ClientRequestHandler* create_default_request_handler () const;
private:
- ACE_CString userinfo_;
- ACE_CString path_;
ACE_CString query_;
+ ACE_CString fragment_;
ACE_CString proxy_host_;
u_short proxy_port_;
@@ -116,7 +105,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
-#include "HTTP_URL.inl"
+#include "ace/INet/HTTP_URL.inl"
#endif
#include /**/ "ace/post.h"
diff --git a/ACE/protocols/ace/INet/HTTP_URL.inl b/ACE/protocols/ace/INet/HTTP_URL.inl
index 94b93bd2326..df6a2a0cebc 100644
--- a/ACE/protocols/ace/INet/HTTP_URL.inl
+++ b/ACE/protocols/ace/INet/HTTP_URL.inl
@@ -9,54 +9,34 @@ namespace ACE
namespace HTTP
{
-#if defined (ACE_HAS_WCHAR)
ACE_INLINE
- bool URL::parse (const ACE_WString& url_string)
- {
- return URL_Base::parse (url_string);
- }
-#endif
-
- ACE_INLINE
- const ACE_CString& URL::get_protocol () const
+ const ACE_CString& URL::get_scheme () const
{
return PROTOCOL;
}
ACE_INLINE
- const ACE_CString& URL::get_user_info () const
- {
- return this->userinfo_;
- }
-
- ACE_INLINE
- const ACE_CString& URL::get_path () const
- {
- return this->path_;
- }
-
- ACE_INLINE
const ACE_CString& URL::get_query () const
{
return this->query_;
}
ACE_INLINE
- void URL::set_user_info (const ACE_CString& userinfo)
+ const ACE_CString& URL::get_fragment () const
{
- this->userinfo_ = userinfo;
+ return this->fragment_;
}
ACE_INLINE
- void URL::set_path (const ACE_CString& path)
+ void URL::set_query (const ACE_CString& query)
{
- this->path_ = path;
+ this->query_ = query;
}
ACE_INLINE
- void URL::set_query (const ACE_CString& query)
+ void URL::set_fragment (const ACE_CString& fragment)
{
- this->query_ = query;
+ this->fragment_ = fragment;
}
ACE_INLINE
@@ -84,6 +64,12 @@ namespace ACE
return !this->proxy_host_.empty ();
}
+ ACE_INLINE
+ u_short URL::default_port () const
+ {
+ return HTTP_PORT;
+ }
+
}
}
diff --git a/ACE/protocols/ace/INet/HeaderBase.cpp b/ACE/protocols/ace/INet/HeaderBase.cpp
index a7c280bc8e3..32169a1808b 100644
--- a/ACE/protocols/ace/INet/HeaderBase.cpp
+++ b/ACE/protocols/ace/INet/HeaderBase.cpp
@@ -1,10 +1,10 @@
// $Id$
-#include "HeaderBase.h"
+#include "ace/INet/HeaderBase.h"
#include "ace/OS_NS_stdlib.h"
#if !defined (__ACE_INLINE__)
-#include "HeaderBase.inl"
+#include "ace/INet/HeaderBase.inl"
#endif
ACE_RCSID(NET_CLIENT,ACE_INet_HeaderBase,"$Id$")
diff --git a/ACE/protocols/ace/INet/HeaderBase.h b/ACE/protocols/ace/INet/HeaderBase.h
index 1f49e145b33..bb6f61e16a3 100644
--- a/ACE/protocols/ace/INet/HeaderBase.h
+++ b/ACE/protocols/ace/INet/HeaderBase.h
@@ -21,7 +21,7 @@
#include "ace/Containers_T.h"
#include "ace/Array.h"
#include "ace/OS_NS_ctype.h"
-#include "INet_Export.h"
+#include "ace/INet/INet_Export.h"
#include <iostream>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -140,7 +140,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
-#include "HeaderBase.inl"
+#include "ace/INet/HeaderBase.inl"
#endif
#include /**/ "ace/post.h"
diff --git a/ACE/protocols/ace/INet/IOS_util.cpp b/ACE/protocols/ace/INet/IOS_util.cpp
index 7945ec55928..0eb2ebc18ca 100644
--- a/ACE/protocols/ace/INet/IOS_util.cpp
+++ b/ACE/protocols/ace/INet/IOS_util.cpp
@@ -1,6 +1,6 @@
// $Id$
-#include "IOS_util.h"
+#include "ace/INet/IOS_util.h"
ACE_RCSID(NET_CLIENT,ACE_IOS_util,"$Id$")
diff --git a/ACE/protocols/ace/INet/IOS_util.h b/ACE/protocols/ace/INet/IOS_util.h
index 7d8408144ec..9d91ba93237 100644
--- a/ACE/protocols/ace/INet/IOS_util.h
+++ b/ACE/protocols/ace/INet/IOS_util.h
@@ -11,7 +11,7 @@
#include /**/ "ace/pre.h"
-#include "INet_Export.h"
+#include "ace/INet/INet_Export.h"
#include <iostream>
// ace_ios_init
diff --git a/ACE/protocols/ace/INet/Request.cpp b/ACE/protocols/ace/INet/Request.cpp
index ac56a018b0f..722b55ffd79 100644
--- a/ACE/protocols/ace/INet/Request.cpp
+++ b/ACE/protocols/ace/INet/Request.cpp
@@ -1,6 +1,6 @@
// $Id$
-#include "Request.h"
+#include "ace/INet/Request.h"
ACE_RCSID(NET_CLIENT,ACE_INet_Request,"$Id$")
diff --git a/ACE/protocols/ace/INet/Request.h b/ACE/protocols/ace/INet/Request.h
index a4a239b2e8b..8a4fe662bb7 100644
--- a/ACE/protocols/ace/INet/Request.h
+++ b/ACE/protocols/ace/INet/Request.h
@@ -11,8 +11,7 @@
#include /**/ "ace/pre.h"
-#include "INet_Export.h"
-#include "HeaderBase.h"
+#include "ace/INet/INet_Export.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -28,7 +27,6 @@ namespace ACE
*
*/
class ACE_INET_Export Request
- : public virtual HeaderBase
{
public:
Request ();
diff --git a/ACE/protocols/ace/INet/RequestHandler.cpp b/ACE/protocols/ace/INet/RequestHandler.cpp
index f8bbc22323b..3105082f58f 100644
--- a/ACE/protocols/ace/INet/RequestHandler.cpp
+++ b/ACE/protocols/ace/INet/RequestHandler.cpp
@@ -1,6 +1,6 @@
// $Id$
-#include "RequestHandler.h"
+#include "ace/INet/RequestHandler.h"
ACE_RCSID(NET_CLIENT,ACE_INet_RequestHandler,"$Id$")
diff --git a/ACE/protocols/ace/INet/RequestHandler.h b/ACE/protocols/ace/INet/RequestHandler.h
index 15609f5f944..360d1e6f9de 100644
--- a/ACE/protocols/ace/INet/RequestHandler.h
+++ b/ACE/protocols/ace/INet/RequestHandler.h
@@ -11,9 +11,9 @@
#include /**/ "ace/pre.h"
-#include "INet_Export.h"
-#include "Request.h"
-#include "Response.h"
+#include "ace/INet/INet_Export.h"
+#include "ace/INet/Request.h"
+#include "ace/INet/Response.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
diff --git a/ACE/protocols/ace/INet/Response.cpp b/ACE/protocols/ace/INet/Response.cpp
index a1d32c95783..86adb4bc74f 100644
--- a/ACE/protocols/ace/INet/Response.cpp
+++ b/ACE/protocols/ace/INet/Response.cpp
@@ -1,6 +1,6 @@
// $Id$
-#include "Response.h"
+#include "ace/INet/Response.h"
ACE_RCSID(NET_CLIENT,ACE_INet_Response,"$Id$")
diff --git a/ACE/protocols/ace/INet/Response.h b/ACE/protocols/ace/INet/Response.h
index 790301b2012..52e21dc36bb 100644
--- a/ACE/protocols/ace/INet/Response.h
+++ b/ACE/protocols/ace/INet/Response.h
@@ -11,8 +11,7 @@
#include /**/ "ace/pre.h"
-#include "INet_Export.h"
-#include "HeaderBase.h"
+#include "ace/INet/INet_Export.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -28,7 +27,6 @@ namespace ACE
*
*/
class ACE_INET_Export Response
- : public virtual HeaderBase
{
public:
Response ();
diff --git a/ACE/protocols/ace/INet/Sock_IOStream.cpp b/ACE/protocols/ace/INet/Sock_IOStream.cpp
index 92010f58c29..eb50ed4aa81 100644
--- a/ACE/protocols/ace/INet/Sock_IOStream.cpp
+++ b/ACE/protocols/ace/INet/Sock_IOStream.cpp
@@ -3,8 +3,8 @@
#ifndef ACE_IOS_SOCK_IOSTREAM_CPP
#define ACE_IOS_SOCK_IOSTREAM_CPP
-#include "Sock_IOStream.h"
-#include "IOS_util.h"
+#include "ace/INet/Sock_IOStream.h"
+#include "ace/INet/IOS_util.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
diff --git a/ACE/protocols/ace/INet/Sock_IOStream.h b/ACE/protocols/ace/INet/Sock_IOStream.h
index bc5c2f1d4cc..dd1465e0f31 100644
--- a/ACE/protocols/ace/INet/Sock_IOStream.h
+++ b/ACE/protocols/ace/INet/Sock_IOStream.h
@@ -17,8 +17,8 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "BidirStreamBuffer.h"
-#include "StreamHandler.h"
+#include "ace/INet/BidirStreamBuffer.h"
+#include "ace/INet/StreamHandler.h"
#include <istream>
#include <ostream>
@@ -147,7 +147,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "Sock_IOStream.cpp"
+#include "ace/INet/Sock_IOStream.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
diff --git a/ACE/protocols/ace/INet/StreamHandler.cpp b/ACE/protocols/ace/INet/StreamHandler.cpp
index 1da477240cf..d56d0f33857 100644
--- a/ACE/protocols/ace/INet/StreamHandler.cpp
+++ b/ACE/protocols/ace/INet/StreamHandler.cpp
@@ -3,7 +3,7 @@
#ifndef ACE_IOS_STREAM_HANDLER_CPP
#define ACE_IOS_STREAM_HANDLER_CPP
-#include "StreamHandler.h"
+#include "ace/INet/StreamHandler.h"
#include "ace/OS_NS_Thread.h"
#include "ace/OS_NS_errno.h"
#include "ace/Countdown_Time.h"
@@ -107,7 +107,7 @@ namespace ACE
ACE_TEXT ("(%P|%t) %p; ACE_IOS_StreamHandler - receive failed\n")));
}
this->connected_ = false;
- return this->reactive() ? -1 : 0;
+ return this->using_reactor () ? -1 : 0;
}
return 0;
}
@@ -150,7 +150,7 @@ namespace ACE
ACE_TEXT ("(%P|%t) %p; ACE_IOS_StreamHandler - "),
ACE_TEXT ("send failed\n")));
this->connected_ = false;
- return this->reactive() ? -1 : 0;
+ return this->using_reactor () ? -1 : 0;
}
}
return (this->msg_queue ()->is_empty ()) ? -1 : 0;
@@ -169,7 +169,7 @@ namespace ACE
size_t char_length = length * char_size;
ACE_Time_Value max_wait_time = this->sync_opt_.timeout ();
int result = 0;
- if (this->reactive ())
+ if (this->using_reactor ())
{
ACE_thread_t tid;
this->reactor ()->owner (&tid);
@@ -387,12 +387,6 @@ namespace ACE
}
template <ACE_PEER_STREAM_1, ACE_SYNCH_DECL>
- bool StreamHandler<ACE_PEER_STREAM, ACE_SYNCH_USE>::reactive () const
- {
- return this->sync_opt_[ACE_Synch_Options::USE_REACTOR];
- }
-
- template <ACE_PEER_STREAM_1, ACE_SYNCH_DECL>
bool StreamHandler<ACE_PEER_STREAM, ACE_SYNCH_USE>::use_timeout () const
{
return this->sync_opt_[ACE_Synch_Options::USE_TIMEOUT];
@@ -428,7 +422,7 @@ namespace ACE
// check if we're allowed to control the reactor if reactive
bool reactor_thread = false;
- if (this->reactive ())
+ if (this->using_reactor ())
{
ACE_thread_t tid;
this->reactor ()->owner (&tid);
@@ -436,7 +430,7 @@ namespace ACE
ACE_OS::thr_equal (ACE_Thread::self (), tid) ? true : false;
}
- if (this->reactive () && reactor_thread)
+ if (this->using_reactor () && reactor_thread)
{
if (this->reactor ()->register_handler(this,
ACE_Event_Handler::WRITE_MASK) != 0)
@@ -524,15 +518,15 @@ namespace ACE
}
template <ACE_PEER_STREAM_1, ACE_SYNCH_DECL>
- bool StreamHandler<ACE_PEER_STREAM, ACE_SYNCH_USE>::is_connected ()
+ bool StreamHandler<ACE_PEER_STREAM, ACE_SYNCH_USE>::is_connected () const
{
return this->connected_;
}
template <ACE_PEER_STREAM_1, ACE_SYNCH_DECL>
- bool StreamHandler<ACE_PEER_STREAM, ACE_SYNCH_USE>::using_reactor ()
+ bool StreamHandler<ACE_PEER_STREAM, ACE_SYNCH_USE>::using_reactor () const
{
- return this->reactive ();
+ return this->sync_opt_[ACE_Synch_Options::USE_REACTOR];
}
}
diff --git a/ACE/protocols/ace/INet/StreamHandler.h b/ACE/protocols/ace/INet/StreamHandler.h
index cb13c1eb17f..0d6a7d8bc1f 100644
--- a/ACE/protocols/ace/INet/StreamHandler.h
+++ b/ACE/protocols/ace/INet/StreamHandler.h
@@ -30,12 +30,17 @@ namespace ACE
*
* @brief Encapsulates streamed connection.
*
+ * This class provides the connection point for the
+ * ACE Acceptor and Connector based patterns and the
+ * ACE Reactor framework to C++ standard streams
+ * based classes.
*/
template <ACE_PEER_STREAM_1, ACE_SYNCH_DECL>
class StreamHandler
: public ACE_Svc_Handler<ACE_PEER_STREAM, ACE_SYNCH_USE>
{
public:
+ // useful traits
typedef StreamHandler<ACE_PEER_STREAM, ACE_SYNCH_USE> this_type;
typedef ACE_Svc_Handler<ACE_PEER_STREAM, ACE_SYNCH_USE> base_type;
typedef ACE_Message_Queue<ACE_SYNCH_USE> mq_type;
@@ -46,6 +51,7 @@ namespace ACE
mq_type *mq = 0,
ACE_Reactor *reactor = ACE_Reactor::instance ());
+ /// Destructor
virtual ~StreamHandler ();
/// Activate the connection
@@ -54,17 +60,25 @@ namespace ACE
/// Close the connection
virtual int close (u_long flags = 0);
+ /// Called to handle incoming data when using StreamHandler in
+ /// reactive mode
virtual int handle_input (ACE_HANDLE);
+ /// Called to handle outgoing data when using StreamHandler in
+ /// reactive mode
virtual int handle_output (ACE_HANDLE);
+ /// Called by streambuffer to read/receive new data from peer
int read_from_stream (void * buf, size_t length, u_short char_size);
+ /// Called by streambuffer to send new data to peer
int write_to_stream (const void * buf, size_t length, u_short char_size);
- bool is_connected ();
+ /// Returns true as long as the connection to peer is active
+ bool is_connected () const;
- bool using_reactor ();
+ /// Returns true if StreamHandler has been configured for reactive mode
+ bool using_reactor () const;
private:
enum
@@ -72,19 +86,26 @@ namespace ACE
MAX_INPUT_SIZE = 4096
};
+ /// Attempts to receive data from peer and queue it.
+ /// Called either from handle_input in reactive mode or
+ /// directly from read_from_stream when non-reactive.
int handle_output_i (ACE_Time_Value* timeout = 0);
+ /// Attempts to send queued data to peer.
+ /// Called either from handle_output in reactive mode
+ /// or directly from write_to_stream when non-reactive.
int handle_input_i (ACE_Time_Value* timeout = 0);
+ /// processes queued input
int process_input (char* buf,
size_t& char_length,
u_short char_size,
ACE_Time_Value* timeout);
- bool reactive () const;
-
+ /// Returns true if a timeout is to be used on IO operations.
bool use_timeout () const;
+ /// Returns true is the queued data contains at least char_size bytes.
bool char_in_queue (u_short char_size);
bool connected_;
@@ -100,7 +121,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "StreamHandler.cpp"
+#include "ace/INet/StreamHandler.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
diff --git a/ACE/protocols/ace/INet/StreamInterceptor.cpp b/ACE/protocols/ace/INet/StreamInterceptor.cpp
index 37bd27f92bb..7f5a5066e1b 100644
--- a/ACE/protocols/ace/INet/StreamInterceptor.cpp
+++ b/ACE/protocols/ace/INet/StreamInterceptor.cpp
@@ -3,7 +3,7 @@
#ifndef ACE_IOS_STREAM_INTERCEPTOR_CPP
#define ACE_IOS_STREAM_INTERCEPTOR_CPP
-#include "StreamInterceptor.h"
+#include "ace/INet/StreamInterceptor.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
diff --git a/ACE/protocols/ace/INet/StreamInterceptor.h b/ACE/protocols/ace/INet/StreamInterceptor.h
index 45e95e33ae9..c1d67575614 100644
--- a/ACE/protocols/ace/INet/StreamInterceptor.h
+++ b/ACE/protocols/ace/INet/StreamInterceptor.h
@@ -17,7 +17,7 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "INet_Export.h"
+#include "ace/INet/INet_Export.h"
#include <iosfwd>
#include <ios>
@@ -61,7 +61,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "StreamInterceptor.cpp"
+#include "ace/INet/StreamInterceptor.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
diff --git a/ACE/protocols/ace/INet/String_IOStream.cpp b/ACE/protocols/ace/INet/String_IOStream.cpp
index f04001d1aab..8904fa8a8b4 100644
--- a/ACE/protocols/ace/INet/String_IOStream.cpp
+++ b/ACE/protocols/ace/INet/String_IOStream.cpp
@@ -3,8 +3,8 @@
#ifndef ACE_IOS_STRING_IOSTREAM_CPP
#define ACE_IOS_STRING_IOSTREAM_CPP
-#include "String_IOStream.h"
-#include "IOS_util.h"
+#include "ace/INet/String_IOStream.h"
+#include "ace/INet/IOS_util.h"
#include "ace/Truncate.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -36,6 +36,41 @@ namespace ACE
}
template <class ACE_CHAR_T, class TR>
+ typename String_StreamBufferBase<ACE_CHAR_T, TR>::pos_type
+ String_StreamBufferBase<ACE_CHAR_T, TR>::seekoff (
+ off_type off,
+ seekdir way,
+ openmode which)
+ {
+
+ if (which != this->get_mode () || which == std::ios::out)
+ return pos_type (-1);
+
+ size_type spos = 0;
+ if (way == std::ios::cur)
+ spos = this->rd_ptr_;
+ else if (way == std::ios::end)
+ spos = this->string_ref_->length ();
+ spos += off;
+ if (spos < this->string_ref_->length ())
+ this->rd_ptr_ = spos;
+ else
+ this->rd_ptr_ = this->string_ref_->length ();
+
+ this->setg (this->eback (), this->eback (), this->eback ());
+ return pos_type (this->rd_ptr_);
+ }
+
+ template <class ACE_CHAR_T, class TR>
+ typename String_StreamBufferBase<ACE_CHAR_T, TR>::pos_type
+ String_StreamBufferBase<ACE_CHAR_T, TR>::seekpos (
+ pos_type pos,
+ openmode which)
+ {
+ return this->seekoff (pos_type (pos), std::ios::beg, which);
+ }
+
+ template <class ACE_CHAR_T, class TR>
const typename String_StreamBufferBase<ACE_CHAR_T, TR>::string_type&
String_StreamBufferBase<ACE_CHAR_T, TR>::str () const
{
@@ -175,6 +210,15 @@ namespace ACE
String_IStreamBase<ACE_CHAR_T, TR>::~String_IStreamBase()
{
}
+
+ template <class ACE_CHAR_T, class TR>
+ String_IStreamBase<ACE_CHAR_T, TR>&
+ String_IStreamBase<ACE_CHAR_T, TR>::rewind ()
+ {
+ this->rdbuf ()->pubseekpos (0, std::ios::in);
+ this->clear ();
+ return *this;
+ }
}
}
diff --git a/ACE/protocols/ace/INet/String_IOStream.h b/ACE/protocols/ace/INet/String_IOStream.h
index bffd331f550..88a5ad02c9d 100644
--- a/ACE/protocols/ace/INet/String_IOStream.h
+++ b/ACE/protocols/ace/INet/String_IOStream.h
@@ -11,9 +11,9 @@
#include /**/ "ace/pre.h"
-#include "INet_Export.h"
-#include "BufferedStreamBuffer.h"
-#include "ace/String_Base.h"
+#include "ace/INet/INet_Export.h"
+#include "ace/INet/BufferedStreamBuffer.h"
+#include "ace/SString.h"
#include <istream>
#include <ostream>
@@ -39,6 +39,9 @@ namespace ACE
typedef typename super::openmode openmode;
typedef ACE_String_Base<ACE_CHAR_T> string_type;
typedef typename string_type::size_type size_type;
+ typedef typename super::pos_type pos_type;
+ typedef typename super::off_type off_type;
+ typedef typename super::seekdir seekdir;
String_StreamBufferBase (openmode mode);
String_StreamBufferBase (string_type& string, openmode mode);
@@ -55,6 +58,13 @@ namespace ACE
virtual int write_to_stream (const char_type* buffer, std::streamsize length);
+ virtual pos_type seekoff (off_type off,
+ seekdir way,
+ openmode which);
+
+ virtual pos_type seekpos (pos_type pos,
+ openmode which);
+
private:
enum
{
@@ -134,10 +144,13 @@ namespace ACE
public:
typedef String_IOSBase<ACE_CHAR_T, TR> ios_base;
typedef typename ios_base::string_type string_type;
+ typedef typename ios_base::buffer_type::pos_type pos_type;
explicit String_IStreamBase();
explicit String_IStreamBase(string_type& string);
~String_IStreamBase();
+
+ String_IStreamBase& rewind ();
};
typedef String_StreamBufferBase<char> CString_StreamBuffer;
@@ -151,7 +164,7 @@ namespace ACE
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "String_IOStream.cpp"
+#include "ace/INet/String_IOStream.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
diff --git a/ACE/protocols/ace/INet/URLBase.cpp b/ACE/protocols/ace/INet/URLBase.cpp
index 7439d27555c..8da055c44d5 100644
--- a/ACE/protocols/ace/INet/URLBase.cpp
+++ b/ACE/protocols/ace/INet/URLBase.cpp
@@ -1,13 +1,15 @@
// $Id$
-#include "URLBase.h"
-#include "IOS_util.h"
+#include "ace/INet/URLBase.h"
+#include "ace/INet/IOS_util.h"
#if !defined (__ACE_INLINE__)
-#include "URLBase.inl"
+#include "ace/INet/URLBase.inl"
#endif
-#include "ClientRequestHandler.h"
+#include "ace/INet/String_IOStream.h"
+
+#include "ace/INet/ClientRequestHandler.h"
#include <istream>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -70,6 +72,78 @@ namespace ACE
URL_Base::~URL_Base () {}
+ bool URL_Base::parse (const ACE_CString& url_string)
+ {
+ static const int eof =
+ std::char_traits<ACE::IOS::CString_OStream::char_type>::eof ();
+
+ ACE_CString uri = url_string;
+ if (this->strip_scheme (uri))
+ {
+ ACE::IOS::CString_OStream sos;
+ ACE::IOS::CString_IStream sis (uri);
+
+ int ch;
+
+ // parse authority part (if any)
+ if ((ch = this->parse_authority (sis)) == '/' ||
+ !this->has_authority ()) // relative paths allowed if no authority
+ {
+ // parse path part
+ sos.put (ch);
+ for (ch = sis.get (); ch != '?' && ch != '#' && ch != eof ;ch = sis.get ())
+ sos.put (ch);
+ this->set_path (sos.str ());
+ sos.clear ();
+ }
+ else
+ {
+ // empty path
+ this->set_path (empty_);
+ }
+
+ if (ch == '?')
+ {
+ // parse query part
+ for (ch = sis.get (); ch != '#' && ch != eof ;ch = sis.get ())
+ sos.put (ch);
+ this->set_query (sos.str ());
+ sos.clear ();
+ }
+
+ if (ch == '#')
+ {
+ // get fragment
+ sos << sis.rdbuf ();
+ this->set_fragment (sos.str ());
+ }
+ else if (ch != eof)
+ {
+ // should not happen
+ return false;
+ }
+
+ // check for (minimum) correctness
+ return this->validate ();
+ }
+ return false;
+ }
+
+ int URL_Base::parse_authority(std::istream& is)
+ {
+ return is.get ();
+ }
+
+ bool URL_Base::has_authority ()
+ {
+ return false;
+ }
+
+ bool URL_Base::validate ()
+ {
+ return true;
+ }
+
URLStream URL_Base::open () const
{
ClientRequestHandler* rh = this->create_default_request_handler ();
@@ -120,7 +194,7 @@ namespace ACE
}
#endif
- bool URL_Base::strip_protocol (ACE_CString& url_string)
+ bool URL_Base::strip_scheme (ACE_CString& url_string)
{
// since this will be called at a point where the
// actual URL class is already known (and with that
@@ -173,6 +247,149 @@ namespace ACE
URL_INetBase::~URL_INetBase () {}
+ int URL_INetBase::parse_authority (std::istream& is)
+ {
+ ACE::IOS::CString_OStream sos;
+ return this->parse_authority_i (is, sos, 0);
+ }
+
+ int URL_INetBase::parse_authority_i (std::istream& is,
+ std::ostream& os,
+ int lastch)
+ {
+ static const int eof =
+ std::char_traits<ACE::IOS::CString_OStream::char_type>::eof ();
+
+ ACE::IOS::CString_OStream& sos =
+ dynamic_cast<ACE::IOS::CString_OStream&> (os);
+
+ int ch = lastch;
+ if (ch == 0)
+ {
+ // parse host part
+ for (ch = is.get ();
+#if defined (ACE_HAS_IPV6)
+ ch != '[' && ch != '/' && ch != ':' && ch != '@' && ch != '?' && ch != '#' && ch != eof ;
+#else
+ ch != '/' && ch != ':' && ch != '@' && ch != '?' && ch != '#' && ch != eof ;
+#endif
+ ch = is.get ())
+ sos.put (ch);
+ }
+
+#if defined (ACE_HAS_IPV6)
+ if (ch == '[')
+ {
+ sos.clear ();
+ for (ch = is.get (); ch != ']' && ch != eof ;ch = is.get ())
+ sos.put (ch);
+ if (ch != eof)
+ ch = is.get (); // skip ']'
+ if (ch != '/' && ch != ':' && ch != '?' && ch != '#' && ch != eof)
+ {
+ this->set_host (empty_); // invalid URL, clear host field
+ ch = eof; // stop parsing
+ }
+ else
+ {
+ this->set_host (sos.str ());
+ }
+ }
+ else
+ {
+#endif
+ this->set_host (sos.str ());
+#if defined (ACE_HAS_IPV6)
+ }
+#endif
+ sos.clear ();
+
+ if (ch == ':')
+ {
+ u_short port = 0;
+ is >> port; // should stop at '/' or '?' or '#' or eof
+ ch = is.get ();
+ if (ch == '/' || ch == '?' || ch == '#' || ch == eof)
+ this->set_port (port);
+ else
+ this->set_port (0);
+ }
+ else
+ {
+ this->set_port (this->default_port ());
+ }
+
+ return ch;
+ }
+
+ bool URL_INetBase::has_authority ()
+ {
+ return true;
+ }
+
+ bool URL_INetBase::validate ()
+ {
+ return !this->host_.empty () && this->port_>0;
+ }
+
+ ACE_CString URL_INetBase::get_authority () const
+ {
+ ACE::IOS::CString_OStream sos;
+ sos << this->get_host().c_str ();
+ if (this->get_port () != this->default_port ())
+ sos << ':' << this->get_port ();
+ return sos.str ();
+ }
+
+ URL_INetAuthBase::URL_INetAuthBase (u_short port)
+ : URL_INetBase (port)
+ {
+ }
+
+ URL_INetAuthBase::~URL_INetAuthBase () {}
+
+ ACE_CString URL_INetAuthBase::get_authority () const
+ {
+ ACE::IOS::CString_OStream sos;
+ if (!this->get_user_info ().empty ())
+ sos << this->get_user_info ().c_str () << "@";
+ sos << this->get_host().c_str ();
+ if (this->get_port () != this->default_port ())
+ sos << ':' << this->get_port ();
+ return sos.str ();
+ }
+
+ int URL_INetAuthBase::parse_authority (std::istream& is)
+ {
+ static const int eof =
+ std::char_traits<ACE::IOS::CString_OStream::char_type>::eof ();
+
+ ACE::IOS::CString_OStream sos;
+
+ int ch;
+ // parse userinfo (if any)
+ for (ch = is.get ();
+#if defined (ACE_HAS_IPV6)
+ ch != '[' && ch != '/' && ch != ':' && ch != '@' && ch != '?' && ch != '#' && ch != eof ;
+#else
+ ch != '/' && ch != ':' && ch != '@' && ch != '?' && ch != '#' && ch != eof ;
+#endif
+ ch = is.get ())
+ sos.put (ch);
+
+ if (ch == '@')
+ {
+ this->set_user_info (sos.str ());
+ sos.clear ();
+ ch = URL_INetBase::parse_authority_i (is, sos, 0);
+ }
+ else
+ {
+ ch = URL_INetBase::parse_authority_i (is, sos, ch);
+ }
+
+ return ch;
+ }
}
}
diff --git a/ACE/protocols/ace/INet/URLBase.h b/ACE/protocols/ace/INet/URLBase.h
index 03ae43904ab..bc52b968397 100644
--- a/ACE/protocols/ace/INet/URLBase.h
+++ b/ACE/protocols/ace/INet/URLBase.h
@@ -17,7 +17,7 @@
#include "ace/Null_Mutex.h"
#include "ace/Recursive_Thread_Mutex.h"
#include "ace/Refcounted_Auto_Ptr.h"
-#include "INet_Export.h"
+#include "ace/INet/INet_Export.h"
#include <iosfwd>
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -64,7 +64,7 @@ namespace ACE
/**
* @class ACE_INet_URL_Base
*
- * @brief Base class for URL/URI addresses conforming to RFC2396.
+ * @brief Base class for URL/URI addresses conforming to RFC3986.
*
*/
class ACE_INET_Export URL_Base
@@ -73,17 +73,25 @@ namespace ACE
URL_Base ();
virtual ~URL_Base ();
- virtual bool parse (const ACE_CString& url_string) = 0;
+ virtual bool parse (const ACE_CString& url_string);
- virtual const ACE_CString& get_protocol () const = 0;
+ void set_path (const ACE_CString& path);
- virtual ACE_CString get_authority () const = 0;
+ virtual void set_query (const ACE_CString& query);
- virtual const ACE_CString& get_user_info () const = 0;
+ virtual void set_fragment (const ACE_CString& fragment);
- virtual const ACE_CString& get_path () const = 0;
+ virtual const ACE_CString& get_scheme () const = 0;
- virtual const ACE_CString& get_query () const = 0;
+ const ACE_CString& get_protocol () const;
+
+ virtual ACE_CString get_authority () const;
+
+ const ACE_CString& get_path () const;
+
+ virtual const ACE_CString& get_query () const;
+
+ virtual const ACE_CString& get_fragment () const;
virtual URLStream open () const;
@@ -101,13 +109,22 @@ namespace ACE
static URL_Base* create_from_wstring (const ACE_WString& url_string);
#endif
+ virtual bool validate ();
+
protected:
static const ACE_CString empty_;
- bool strip_protocol (ACE_CString& url_string);
+ bool strip_scheme (ACE_CString& url_string);
+
+ virtual int parse_authority (std::istream& is);
+
+ virtual bool has_authority ();
virtual ClientRequestHandler* create_default_request_handler () const = 0;
+ private:
+ ACE_CString path_;
+
public:
class Factory
{
@@ -137,26 +154,62 @@ namespace ACE
URL_INetBase(u_short port);
virtual ~URL_INetBase ();
- virtual void set_host (const ACE_CString& host);
+ void set_host (const ACE_CString& host);
- virtual void set_port (u_short port);
+ void set_port (u_short port);
const ACE_CString& get_host () const;
u_short get_port () const;
+ virtual u_short default_port () const = 0;
+
+ virtual ACE_CString get_authority () const;
+
+ virtual bool validate ();
+
+ protected:
+ virtual int parse_authority (std::istream& is);
+
+ virtual bool has_authority ();
+
+ int parse_authority_i (std::istream& is,
+ std::ostream& os,
+ int lastch);
+
private:
ACE_CString host_;
u_short port_;
};
+
+ class ACE_INET_Export URL_INetAuthBase
+ : public URL_INetBase
+ {
+ public:
+ URL_INetAuthBase(u_short port);
+ virtual ~URL_INetAuthBase ();
+
+ const ACE_CString& get_user_info () const;
+
+ void set_user_info (const ACE_CString& userinfo);
+
+ virtual ACE_CString get_authority () const;
+
+ protected:
+ virtual int parse_authority (std::istream& is);
+
+ private:
+ ACE_CString userinfo_;
+ };
+
}
}
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
-#include "URLBase.inl"
+#include "ace/INet/URLBase.inl"
#endif
#include /**/ "ace/post.h"
diff --git a/ACE/protocols/ace/INet/URLBase.inl b/ACE/protocols/ace/INet/URLBase.inl
index 9b075befebc..4e654334c51 100644
--- a/ACE/protocols/ace/INet/URLBase.inl
+++ b/ACE/protocols/ace/INet/URLBase.inl
@@ -9,6 +9,52 @@ namespace ACE
namespace INet
{
ACE_INLINE
+ const ACE_CString& URL_Base::get_protocol () const
+ {
+ return this->get_scheme ();
+ }
+
+ ACE_INLINE
+ const ACE_CString& URL_Base::get_path () const
+ {
+ return this->path_;
+ }
+
+ ACE_INLINE
+ void URL_Base::set_path (const ACE_CString& path)
+ {
+ this->path_ = path;
+ }
+
+ ACE_INLINE
+ void URL_Base::set_query (const ACE_CString& /*query*/)
+ {
+ }
+
+ ACE_INLINE
+ void URL_Base::set_fragment (const ACE_CString& /*fragment*/)
+ {
+ }
+
+ ACE_INLINE
+ const ACE_CString& URL_Base::get_query () const
+ {
+ return empty_;
+ }
+
+ ACE_INLINE
+ const ACE_CString& URL_Base::get_fragment () const
+ {
+ return empty_;
+ }
+
+ ACE_INLINE
+ ACE_CString URL_Base::get_authority () const
+ {
+ return empty_;
+ }
+
+ ACE_INLINE
const ACE_CString& URL_INetBase::get_host () const
{
return this->host_;
@@ -32,6 +78,16 @@ namespace ACE
this->port_ = port;
}
+ ACE_INLINE
+ const ACE_CString& URL_INetAuthBase::get_user_info () const
+ {
+ return this->userinfo_;
+ }
+
+ void URL_INetAuthBase::set_user_info (const ACE_CString& userinfo)
+ {
+ this->userinfo_ = userinfo;
+ }
}
}
diff --git a/ACE/protocols/ace/INet/inet.mpc b/ACE/protocols/ace/INet/inet.mpc
index 366318cfd2b..46935f58e4d 100644
--- a/ACE/protocols/ace/INet/inet.mpc
+++ b/ACE/protocols/ace/INet/inet.mpc
@@ -4,6 +4,7 @@
project(INet) : acelib, ace_output, install {
sharedname = ACE_INet
dynamicflags = ACE_INET_BUILD_DLL
+ includes += $(ACE_ROOT)/protocols
avoids += wince
Source_Files {
IOS_util.cpp