diff options
author | Steve Huston <shuston@riverace.com> | 2004-09-24 14:42:42 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2004-09-24 14:42:42 +0000 |
commit | 7fe0eb3d9a8e826bdf4d57b10e59b6f845cd1b75 (patch) | |
tree | dcaf9b814a8f0fad648f1d922e1983f14ddf5512 /apps | |
parent | 3e65be1411056e21fd120998fc4d656eda124cbf (diff) | |
download | ATCD-7fe0eb3d9a8e826bdf4d57b10e59b6f845cd1b75.tar.gz |
ChangeLogTag:Fri Sep 24 10:40:11 2004 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/JAWS/clients/Blobby/Blob.cpp | 2 | ||||
-rw-r--r-- | apps/JAWS/clients/Blobby/Blob.h | 4 | ||||
-rw-r--r-- | apps/JAWS/clients/Blobby/Blob_Handler.cpp | 9 | ||||
-rw-r--r-- | apps/JAWS/clients/Blobby/Options.h | 2 | ||||
-rw-r--r-- | apps/JAWS/clients/Blobby/blobby.cpp | 42 | ||||
-rw-r--r-- | apps/JAWS/clients/Caching/http_client.cpp | 10 | ||||
-rw-r--r-- | apps/JAWS/clients/Caching/http_handler.cpp | 4 | ||||
-rw-r--r-- | apps/JAWS/server/HTTP_Response.cpp | 2 | ||||
-rw-r--r-- | apps/JAWS/server/HTTP_Server.cpp | 66 | ||||
-rw-r--r-- | apps/JAWS/server/HTTP_Server.h | 4 |
10 files changed, 89 insertions, 56 deletions
diff --git a/apps/JAWS/clients/Blobby/Blob.cpp b/apps/JAWS/clients/Blobby/Blob.cpp index 7c6d41d4554..b29004ae960 100644 --- a/apps/JAWS/clients/Blobby/Blob.cpp +++ b/apps/JAWS/clients/Blobby/Blob.cpp @@ -18,7 +18,7 @@ ACE_Blob::~ACE_Blob (void) // initialize address and filename. No network i/o in open int -ACE_Blob::open (ACE_TCHAR *filename, const ACE_TCHAR *hostname , u_short port) +ACE_Blob::open (const ACE_TCHAR *filename, const ACE_TCHAR *hostname , u_short port) { filename_ = ACE_OS::strdup (filename); inet_addr_.set (port, hostname); diff --git a/apps/JAWS/clients/Blobby/Blob.h b/apps/JAWS/clients/Blobby/Blob.h index afd880bf46c..9ba35fb0176 100644 --- a/apps/JAWS/clients/Blobby/Blob.h +++ b/apps/JAWS/clients/Blobby/Blob.h @@ -49,8 +49,8 @@ public: ACE_Blob (void); ~ACE_Blob (void); - int open (ACE_TCHAR *filename, - const ACE_TCHAR *hostname = ACE_DEFAULT_SERVER_HOST , + int open (const ACE_TCHAR *filename, + const ACE_TCHAR *hostname = ACE_DEFAULT_SERVER_HOST, u_short port = 80); // initializes the class with the given filename, hostname and port. // it should be called with the filename, before any read/write calls diff --git a/apps/JAWS/clients/Blobby/Blob_Handler.cpp b/apps/JAWS/clients/Blobby/Blob_Handler.cpp index 093b5fd42f8..c2e74f38548 100644 --- a/apps/JAWS/clients/Blobby/Blob_Handler.cpp +++ b/apps/JAWS/clients/Blobby/Blob_Handler.cpp @@ -277,11 +277,12 @@ ACE_Blob_Writer::send_request (void) char *mesg; ACE_NEW_RETURN (mesg, char [mesglen], -1); - // Create the header, store the actual length in mesglen - mesglen = ACE_OS::sprintf (mesg, "%s /%s %s " - ACE_SIZE_T_FORMAT_SPECIFIER"\n\n", + // Create the header, store the actual length in mesglen. + // NOTE! %lu is really what's wanted. ACE_SIZE_T_FORMAT_SPECIFIER is + // defined in terms of ACE_LIB_TEXT which is NOT what we want here. + mesglen = ACE_OS::sprintf (mesg, "%s /%s %s %lu\n\n", request_prefix_, filename_, request_suffix_, - length_); + (unsigned long)length_); // Send the header followed by the data diff --git a/apps/JAWS/clients/Blobby/Options.h b/apps/JAWS/clients/Blobby/Options.h index 47c0c852036..8396cf5535b 100644 --- a/apps/JAWS/clients/Blobby/Options.h +++ b/apps/JAWS/clients/Blobby/Options.h @@ -39,7 +39,7 @@ public: void parse_args (int argc, ACE_TCHAR *argv[]); // parses commandline arguments - char *hostname_; + ACE_TCHAR *hostname_; // Hostname to connect to u_short port_; diff --git a/apps/JAWS/clients/Blobby/blobby.cpp b/apps/JAWS/clients/Blobby/blobby.cpp index 56da1046ff8..e614b049c20 100644 --- a/apps/JAWS/clients/Blobby/blobby.cpp +++ b/apps/JAWS/clients/Blobby/blobby.cpp @@ -39,7 +39,8 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Explain what is going to happen if (options->debug_) ACE_DEBUG ((LM_DEBUG, - "hostname = %s, port = %d, filename = %s, length = %d, offset = %d, operation = %c\n", + ACE_TEXT ("hostname = %C, port = %d, filename = %s, ") + ACE_TEXT ("length = %d, offset = %d, operation = %c\n"), options->hostname_, options->port_, options->filename_, @@ -56,16 +57,27 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_Message_Block mb (0, options->length_); // Open the blob - if (blob.open (options->filename_, options->hostname_, options->port_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open error"), -1); + if (blob.open (options->filename_, + options->hostname_, + options->port_) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("open error")), + -1); // Read from it if (blob.read (&mb, options->length_, options->offset_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "read error"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("read error")), + -1); // Write to STDOUT if (ACE_OS::write (ACE_STDOUT, mb.rd_ptr(), mb.length()) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "write error"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("write error")), + -1); } else { @@ -75,15 +87,24 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Open the file to be sent ACE_HANDLE h = ACE_OS::open (options->filename_, O_RDONLY); if (h == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "file open error"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("file open error")), + -1); // Open the blob if (blob.open (options->filename_, options->hostname_, options->port_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "connection open error"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("connection open error")), + -1); // Read from the file if (ACE_OS::read (h, mb.wr_ptr (), total) != total) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "file read error"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("file read error")), + -1); // Close the file ACE_OS::close (h); @@ -93,7 +114,10 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) // Write to the blob if (blob.write (&mb, options->length_, options->offset_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "network write error"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + ACE_TEXT ("network write error")), + -1); } blob.close (); diff --git a/apps/JAWS/clients/Caching/http_client.cpp b/apps/JAWS/clients/Caching/http_client.cpp index 558e0ca15ee..66fb2e09887 100644 --- a/apps/JAWS/clients/Caching/http_client.cpp +++ b/apps/JAWS/clients/Caching/http_client.cpp @@ -58,8 +58,8 @@ main (int, char *[]) while (isspace (*s)); // Shell command. - if (ACE_OS::system (s) == -1) - ACE_ERROR ((LM_ERROR, " ! Error executing: %s\n", s)); + if (ACE_OS::system (ACE_TEXT_CHAR_TO_TCHAR (s)) == -1) + ACE_ERROR ((LM_ERROR, ACE_TEXT (" ! Error executing: %C\n"), s)); } else if (ACE_OS::strncmp (s, "http://", 7) == 0) { @@ -68,12 +68,12 @@ main (int, char *[]) connector.connect (s); } else - ACE_ERROR ((LM_ERROR, " ? I don't understand: %s\n", s)); + ACE_ERROR ((LM_ERROR, ACE_TEXT (" ? I don't understand: %C\n"), s)); - ACE_ERROR ((LM_ERROR, "* ")); + ACE_ERROR ((LM_ERROR, ACE_TEXT ("* "))); } - ACE_DEBUG ((LM_DEBUG, "\nBye!\n")); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\nBye!\n"))); return 0; } diff --git a/apps/JAWS/clients/Caching/http_handler.cpp b/apps/JAWS/clients/Caching/http_handler.cpp index d9f626c4d7f..b205451ec9a 100644 --- a/apps/JAWS/clients/Caching/http_handler.cpp +++ b/apps/JAWS/clients/Caching/http_handler.cpp @@ -137,7 +137,7 @@ HTTP_Handler::svc (void) && (::sscanf (contentlength, "\nContent-%*[lL]ength: %d ", &this->response_size_) == 1)) { - ACE_Filecache_Handle afh (this->filename_, + ACE_Filecache_Handle afh (ACE_TEXT_CHAR_TO_TCHAR (this->filename_), this->response_size_); this->peer ().recv_n (afh.address (), this->response_size_); @@ -189,7 +189,7 @@ HTTP_Connector::connect (const char * url) HTTP_Handler *hhptr = &hh; // First check the cache. - if (ACE_Filecache::instance ()->find (hh.filename ()) == 0) + if (ACE_Filecache::instance ()->find (ACE_TEXT_CHAR_TO_TCHAR (hh.filename ())) == 0) { ACE_DEBUG ((LM_DEBUG, " ``%s'' is already cached.\n", hh.filename ())); diff --git a/apps/JAWS/server/HTTP_Response.cpp b/apps/JAWS/server/HTTP_Response.cpp index e187ba10934..5f5b036989e 100644 --- a/apps/JAWS/server/HTTP_Response.cpp +++ b/apps/JAWS/server/HTTP_Response.cpp @@ -203,7 +203,7 @@ HTTP_Response::normal_response (void) char *auth = HTTP_Helper::HTTP_decode_base64 (ACE_OS::strcpy (buf, hvv)); - if (mmapfile.map ("jaws.auth") != -1 + if (mmapfile.map (ACE_TEXT ("jaws.auth")) != -1 && auth != 0 && ACE_OS::strstr((const char *) mmapfile.addr (), auth) != 0) this->io_.receive_file (this->request_.path (), diff --git a/apps/JAWS/server/HTTP_Server.cpp b/apps/JAWS/server/HTTP_Server.cpp index 99aa97e71ff..a43575db5e3 100644 --- a/apps/JAWS/server/HTTP_Server.cpp +++ b/apps/JAWS/server/HTTP_Server.cpp @@ -34,13 +34,12 @@ public: }; void -HTTP_Server::parse_args (int argc, - char *argv[]) +HTTP_Server::parse_args (int argc, ACE_TCHAR *argv[]) { int c; int thr_strategy = 0; int io_strategy = 0; - const char *prog = argc > 0 ? argv[0] : "HTTP_Server"; + const ACE_TCHAR *prog = argc > 0 ? argv[0] : ACE_TEXT ("HTTP_Server"); // Set some defaults this->port_ = 0; @@ -48,7 +47,7 @@ HTTP_Server::parse_args (int argc, this->backlog_ = 0; this->throttle_ = 0; - ACE_Get_Opt get_opt (argc, argv, "p:n:t:i:b:"); + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("p:n:t:i:b:")); while ((c = get_opt ()) != -1) switch (c) @@ -63,36 +62,36 @@ HTTP_Server::parse_args (int argc, // POOL -> thread pool // PER_REQUEST -> thread per request // THROTTLE -> thread per request with throttling - if (ACE_OS::strcmp (get_opt.opt_arg (), "POOL") == 0) + if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("POOL")) == 0) thr_strategy = JAWS::JAWS_POOL; - else if (ACE_OS::strcmp (get_opt.opt_arg (), "PER_REQUEST") == 0) + else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("PER_REQUEST")) == 0) { thr_strategy = JAWS::JAWS_PER_REQUEST; this->throttle_ = 0; } - else if (ACE_OS::strcmp (get_opt.opt_arg (), "THROTTLE") == 0) + else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("THROTTLE")) == 0) { thr_strategy = JAWS::JAWS_PER_REQUEST; this->throttle_ = 1; } break; case 'f': - if (ACE_OS::strcmp (get_opt.opt_arg (), "THR_BOUND") == 0) + if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("THR_BOUND")) == 0) { // What happened here? } - else if (ACE_OS::strcmp (get_opt.opt_arg (), "THR_DAEMON") == 0) + else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("THR_DAEMON")) == 0) { } - else if (ACE_OS::strcmp (get_opt.opt_arg (), "THR_DETACHED") == 0) + else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("THR_DETACHED")) == 0) { } case 'i': // SYNCH -> synchronous I/O // ASYNCH -> asynchronous I/O - if (ACE_OS::strcmp (get_opt.opt_arg (), "SYNCH") == 0) + if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("SYNCH")) == 0) io_strategy = JAWS::JAWS_SYNCH; - else if (ACE_OS::strcmp (get_opt.opt_arg (), "ASYNCH") == 0) + else if (ACE_OS::strcmp (get_opt.opt_arg (), ACE_TEXT ("ASYNCH")) == 0) io_strategy = JAWS::JAWS_ASYNCH; break; case 'b': @@ -115,12 +114,13 @@ HTTP_Server::parse_args (int argc, ACE_UNUSED_ARG (prog); ACE_DEBUG ((LM_DEBUG, - "in HTTP_Server::init, %s port = %d, number of threads = %d\n", + ACE_TEXT ("in HTTP_Server::init, %s port = %d, ") + ACE_TEXT ("number of threads = %d\n"), prog, this->port_, this->threads_)); } int -HTTP_Server::init (int argc, char *argv[]) +HTTP_Server::init (int argc, ACE_TCHAR *argv[]) // Document this function { // Ignore signals generated when a connection is broken unexpectedly. @@ -161,7 +161,8 @@ HTTP_Server::synch_thread_pool (void) // Main thread opens the acceptor if (this->acceptor_.open (ACE_INET_Addr (this->port_), 1, PF_INET, this->backlog_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "HTTP_Acceptor::open"), -1); + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("HTTP_Acceptor::open")), -1); // Create a pool of threads to handle incoming connections. Synch_Thread_Pool_Task t (this->acceptor_, this->tm_, this->threads_); @@ -177,7 +178,8 @@ Synch_Thread_Pool_Task::Synch_Thread_Pool_Task (HTTP_Acceptor &acceptor, acceptor_ (acceptor) { if (this->activate (THR_DETACHED | THR_NEW_LWP, threads) == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "Synch_Thread_Pool_Task::open")); + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("Synch_Thread_Pool_Task::open"))); } int @@ -192,7 +194,8 @@ Synch_Thread_Pool_Task::svc (void) // Lock in this accept. When it returns, we have a connection. if (this->acceptor_.accept (stream) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "HTTP_Acceptor::accept"), -1); + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT("%p\n"), + ACE_TEXT ("HTTP_Acceptor::accept")), -1); ACE_Message_Block *mb; ACE_NEW_RETURN (mb, @@ -207,7 +210,7 @@ Synch_Thread_Pool_Task::svc (void) mb->release (); ACE_DEBUG ((LM_DEBUG, - " (%t) in Synch_Thread_Pool_Task::svc, recycling\n")); + ACE_TEXT (" (%t) in Synch_Thread_Pool_Task::svc, recycling\n"))); } ACE_NOTREACHED(return 0); @@ -222,7 +225,8 @@ HTTP_Server::thread_per_request (void) // Main thread opens the acceptor if (this->acceptor_.open (ACE_INET_Addr (this->port_), 1, PF_INET, this->backlog_) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "HTTP_Acceptor::open"), -1); + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("HTTP_Acceptor::open")), -1); ACE_SOCK_Stream stream; @@ -233,7 +237,8 @@ HTTP_Server::thread_per_request (void) for (;;) { if (this->acceptor_.accept (stream) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "HTTP_Acceptor::accept"), -1); + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("HTTP_Acceptor::accept")), -1); Thread_Per_Request_Task *t; // Pass grp_id as a constructor param instead of into open. @@ -244,8 +249,8 @@ HTTP_Server::thread_per_request (void) if (t->open () != 0) - ACE_ERROR_RETURN ((LM_ERROR, - "%p\n", "Thread_Per_Request_Task::open"), + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("Thread_Per_Request_Task::open")), -1); // Throttling is not allowing too many threads to run away. @@ -286,7 +291,8 @@ Thread_Per_Request_Task::open (void *) 1, 0, -1, this->grp_id_, 0); if (status == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "Thread_Per_Request_Task::open"), + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("Thread_Per_Request_Task::open")), -1); return 0; } @@ -308,7 +314,7 @@ int Thread_Per_Request_Task::close (u_long) { ACE_DEBUG ((LM_DEBUG, - " (%t) Thread_Per_Request_Task::svc, dying\n")); + ACE_TEXT (" (%t) Thread_Per_Request_Task::svc, dying\n"))); delete this; return 0; } @@ -342,8 +348,8 @@ HTTP_Server::asynch_thread_pool (void) // asynchronous I/O request to the OS. if (acceptor.open (ACE_INET_Addr (this->port_), HTTP_Handler::MAX_REQUEST_SIZE + 1) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", - "ACE_Asynch_Acceptor::open"), -1); + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Asynch_Acceptor::open")), -1); // Create the thread pool. // Register threads with the proactor and thread manager. @@ -367,7 +373,8 @@ Asynch_Thread_Pool_Task::Asynch_Thread_Pool_Task (ACE_Proactor &proactor, proactor_ (proactor) { if (this->activate () == -1) - ACE_ERROR ((LM_ERROR, "%p\n", "Asynch_Thread_Pool_Task::open")); + ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("Asynch_Thread_Pool_Task::open"))); } int @@ -375,7 +382,8 @@ Asynch_Thread_Pool_Task::svc (void) { for (;;) if (this->proactor_.handle_events () == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "ACE_Proactor::handle_events"), + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_Proactor::handle_events")), -1); return 0; @@ -387,7 +395,7 @@ Asynch_Thread_Pool_Task::svc (void) ACE_SVC_FACTORY_DEFINE (HTTP_Server) // Define the object that describes the service. -ACE_STATIC_SVC_DEFINE (HTTP_Server, "HTTP_Server", ACE_SVC_OBJ_T, +ACE_STATIC_SVC_DEFINE (HTTP_Server, ACE_TEXT ("HTTP_Server"), ACE_SVC_OBJ_T, &ACE_SVC_NAME (HTTP_Server), ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, 0) diff --git a/apps/JAWS/server/HTTP_Server.h b/apps/JAWS/server/HTTP_Server.h index a81f34d244e..8d39e193642 100644 --- a/apps/JAWS/server/HTTP_Server.h +++ b/apps/JAWS/server/HTTP_Server.h @@ -54,7 +54,7 @@ class ACE_Svc_Export HTTP_Server : public ACE_Service_Object // = DESCRIPTION { public: - virtual int init (int argc, char *argv[]); + virtual int init (int argc, ACE_TCHAR *argv[]); // Initialization virtual int fini (void); @@ -72,7 +72,7 @@ protected: private: // James, comment these data members. - void parse_args (int argc, char **argv); + void parse_args (int argc, ACE_TCHAR **argv); int port_; int threads_; int strategy_; |