HTTP_Client.cpp

Go to the documentation of this file.
00001 // $Id: HTTP_Client.cpp 79829 2007-10-23 12:39:52Z johnnyw $
00002 
00003 #include "tao/HTTP_Client.h"
00004 
00005 #if (TAO_HAS_HTTP_PARSER == 1)
00006 
00007 #include "tao/HTTP_Handler.h"
00008 #include "ace/OS_NS_string.h"
00009 
00010 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00011 
00012 TAO_HTTP_Client::TAO_HTTP_Client (void)
00013 {
00014 }
00015 
00016 TAO_HTTP_Client::~TAO_HTTP_Client (void)
00017 {
00018   this->close ();
00019 }
00020 
00021 int
00022 TAO_HTTP_Client::open (const ACE_TCHAR *filename,
00023                        const ACE_TCHAR *hostname,
00024                        u_short port)
00025 {
00026   this->filename_ = ACE_OS::strdup (filename);
00027   this->inet_addr_.set (port, hostname);
00028   return 0;
00029 }
00030 
00031 int
00032 TAO_HTTP_Client::read (ACE_Message_Block *mb)
00033 {
00034   // Create a HTTP_Client Reader
00035   TAO_HTTP_Reader HTTP_reader (mb, this->filename_);
00036   TAO_HTTP_Handler *brp = &HTTP_reader;
00037 
00038   // Connect to the server
00039   if (connector_.connect (brp, this->inet_addr_) == -1)
00040     {
00041       ACE_ERROR_RETURN ((LM_ERROR, "TAO (%P|%t) - HTTP_Client::read, Connector error\n"), -1);
00042     }
00043 
00044   return HTTP_reader.byte_count ();
00045 
00046 }
00047 
00048 int
00049 TAO_HTTP_Client::close (void)
00050 {
00051   if (this->filename_)
00052     {
00053       ACE_OS::free ((void *) this->filename_);
00054       this->filename_ = 0;
00055     }
00056   return 0;
00057 }
00058 
00059 TAO_END_VERSIONED_NAMESPACE_DECL
00060 
00061 #endif /* TAO_HAS_HTTP_PARSER == 1 */

Generated on Tue Feb 2 17:37:52 2010 for TAO by  doxygen 1.4.7