4 //=============================================================================
8 * HTTP_Handler is a base class for HTTP_Reader and
9 * HTTP_Writer which are created in response to calls to
10 * read/write, as appropriate
12 //=============================================================================
15 #ifndef TAO_HTTP_HANDLER_H
16 #define TAO_HTTP_HANDLER_H
18 #include /**/ "tao/TAO_Export.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "tao/orbconf.h"
26 #if (TAO_HAS_HTTP_PARSER == 1)
28 #include "ace/SOCK_Stream.h"
29 #include "ace/Svc_Handler.h"
30 #include "ace/Message_Block.h"
31 #include "tao/Versioned_Namespace.h"
33 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
36 * @class TAO_HTTP_Handler
37 * class to retrieve data via HTTP
39 class TAO_Export TAO_HTTP_Handler
: public ACE_Svc_Handler
<ACE_SOCK_STREAM
, ACE_NULL_SYNCH
>
42 /// Null constructor, insures that it works properly with Connector
45 /// Always use this constructor to make HTTP_Handlers
46 TAO_HTTP_Handler (ACE_Message_Block
*mb
,
49 /// returns the number of bytes read/written in the last operation.
50 size_t byte_count () const;
52 /// Activate this instance of the <HTTP_Handler>
53 virtual int open (void * = 0);
55 /// Close down the Blob
56 virtual int close (u_long flags
= 0);
61 virtual int send_request ();
62 virtual int receive_reply ();
64 ACE_Message_Block
*mb_
;
69 /// The handler assumes that the first 2048 bytes of a server response
70 /// contains the header
71 MAX_HEADER_SIZE
= 2048,
73 /// set the MAX_TRANSMISSION_UNIT (MTU) = BUFSIZ as defined by OS
78 class TAO_HTTP_Reader
: public TAO_HTTP_Handler
81 TAO_HTTP_Reader (ACE_Message_Block
*mb
,
83 const char *request_prefix
= "GET",
84 const char *request_suffix
= "HTTP/1.0\r\nAccept: HTTP/1.0\r\n\r\n");
87 //NOTE: these functions return -1 on error
90 const char *request_prefix_
;
91 const char *request_suffix_
;
94 TAO_END_VERSIONED_NAMESPACE_DECL
96 #endif /* TAO_HAS_HTTP_PARSER == 1 */
98 #endif /* TAO_HTTP_HANDLER_H */