1 #include "tao/HTTP_Client.h"
3 #if (TAO_HAS_HTTP_PARSER == 1)
5 #include "tao/HTTP_Handler.h"
6 #include "ace/OS_NS_string.h"
7 #include "ace/Truncate.h"
10 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
12 TAO_HTTP_Client::TAO_HTTP_Client ()
17 TAO_HTTP_Client::~TAO_HTTP_Client ()
23 TAO_HTTP_Client::open (const ACE_TCHAR
*filename
,
24 const ACE_TCHAR
*hostname
,
27 this->filename_
= ACE_OS::strdup (filename
);
28 this->inet_addr_
.set (port
, hostname
);
33 TAO_HTTP_Client::read (ACE_Message_Block
*mb
)
35 // Create a HTTP_Client Reader
36 TAO_HTTP_Reader
HTTP_reader (mb
, this->filename_
);
37 TAO_HTTP_Handler
*brp
= &HTTP_reader
;
39 // Connect to the server
40 if (connector_
.connect (brp
, this->inet_addr_
) == -1)
42 TAOLIB_ERROR_RETURN ((LM_ERROR
, "TAO (%P|%t) - HTTP_Client::read, Connector error\n"), -1);
45 return ACE_Utils::truncate_cast
<int> (HTTP_reader
.byte_count ());
49 TAO_HTTP_Client::close ()
53 ACE_OS::free ((void *) this->filename_
);
54 this->filename_
= nullptr;
59 TAO_END_VERSIONED_NAMESPACE_DECL
61 #endif /* TAO_HAS_HTTP_PARSER == 1 */