diff options
author | jxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-25 07:19:47 +0000 |
---|---|---|
committer | jxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-25 07:19:47 +0000 |
commit | f91aea100313eacbed353caf396dbaab2bacf232 (patch) | |
tree | 15fb95fc0e5c162ab1df2934c088a14473d757f7 /apps | |
parent | 08897bbde2542dba139f268d8beb98bf1f498af8 (diff) | |
download | ATCD-f91aea100313eacbed353caf396dbaab2bacf232.tar.gz |
*** empty log message ***
Diffstat (limited to 'apps')
-rw-r--r-- | apps/JAWS/ChangeLog | 28 | ||||
-rw-r--r-- | apps/JAWS/server/HTTP_Helpers.cpp | 16 | ||||
-rw-r--r-- | apps/JAWS/server/HTTP_Helpers.h | 1 | ||||
-rw-r--r-- | apps/JAWS/server/HTTP_Response.cpp | 41 | ||||
-rw-r--r-- | apps/JAWS/server/IO.cpp | 4 | ||||
-rw-r--r-- | apps/JAWS/server/main.cpp | 5 | ||||
-rw-r--r-- | apps/JAWS/server/svc.conf | 7 |
7 files changed, 80 insertions, 22 deletions
diff --git a/apps/JAWS/ChangeLog b/apps/JAWS/ChangeLog index 61f7e756af5..be61ccf9e3e 100644 --- a/apps/JAWS/ChangeLog +++ b/apps/JAWS/ChangeLog @@ -1,3 +1,31 @@ +Fri Jul 25 02:05:20 1997 James C Hu <jxh@lambada.cs.wustl.edu> + + * server/HTTP_Server.cpp: Changes to allow the thread creation + flags to be specified from the command line. Removed some code + that was used to track down memory leaks. + + * server/HTTP_Helpers.{h,cpp}: Added another method + HTTP_date (char *), so that a buffer to which the date will be + written to can be passed into the HTTP_date routine. + + * server/HTTP_Response.cpp: Changed some code so that the baseline + implementation can be created at compile time. + + * server/IO.cpp: Changed some code so that the baseline + implementation can be created at compile time. + + * server/main.cpp: Changed the signal handler to wait for threads + to die. However, this code will remain dormant for now, until + we design a nice way to shut down a thread pool. + + * server/svc.conf: Changes to add some other entries people can + try. + + * server/Makefile: Changes to allow JAWS to be built with static + linking only, to ease the process of using Purify and Quantify. + Dynamic linking will be re-configured in the future when we have + all the memory leaks worked out. + Mon Jul 22 16:55:00 1997 Chris Cleeland <cleeland@cs.wustl.edu> * Changed references to WRAPPER_ROOT to ACE_ROOT in every diff --git a/apps/JAWS/server/HTTP_Helpers.cpp b/apps/JAWS/server/HTTP_Helpers.cpp index 3725a29c25d..fd468436875 100644 --- a/apps/JAWS/server/HTTP_Helpers.cpp +++ b/apps/JAWS/server/HTTP_Helpers.cpp @@ -134,6 +134,22 @@ HTTP_Helper::HTTP_date (void) return HTTP_Helper::date_string_; } +const char * +HTTP_Helper::HTTP_date (char *s) +{ + time_t tloc; + struct tm tms; + char * date_string = s; + + if (ACE_OS::time (&tloc) != (time_t) -1 + && ACE_OS::gmtime_r (&tloc, &tms) != NULL) + ACE_OS::strftime (date_string, 40, "%a, %d %b %Y %T GMT", &tms); + else + date_string = 0; + + return date_string; +} + int HTTP_Helper::HTTP_month (const char *month) { diff --git a/apps/JAWS/server/HTTP_Helpers.h b/apps/JAWS/server/HTTP_Helpers.h index 18df7d49d84..a1ca5dec555 100644 --- a/apps/JAWS/server/HTTP_Helpers.h +++ b/apps/JAWS/server/HTTP_Helpers.h @@ -30,6 +30,7 @@ public: // Create today's date static const char *HTTP_date (void); + static const char *HTTP_date (char *s); static int HTTP_month (const char *month); static const char *HTTP_month (int month); diff --git a/apps/JAWS/server/HTTP_Response.cpp b/apps/JAWS/server/HTTP_Response.cpp index c3d2d1e6bab..b3da5eaa251 100644 --- a/apps/JAWS/server/HTTP_Response.cpp +++ b/apps/JAWS/server/HTTP_Response.cpp @@ -23,9 +23,11 @@ HTTP_Response::HTTP_Response (HTTP_Request &request, JAWS_IO &io) HTTP_Response::~HTTP_Response (void) { - // if (this->HTTP_HEADER != EMPTY_HEADER) - // delete [] this->HTTP_HEADER; +#if defined (ACE_JAWS_BASELINE) + if (this->HTTP_HEADER != EMPTY_HEADER) + delete [] this->HTTP_HEADER; // The [] is important. Without it, there was a huge memory leak! +#endif /* ACE_JAWS_BASELINE */ } void @@ -320,10 +322,28 @@ HTTP_Response::build_headers (void) } else { - // HTTP_HEADER = new char[BUFSIZ * 4]; +#if defined (ACE_JAWS_BASELINE) + HTTP_HEADER = new char[BUFSIZ * 4]; + // We assume that at this point everything is OK + HTTP_HEADER_LENGTH = + ACE_OS::sprintf (HTTP_HEADER, "%s", "HTTP/1.0 200 OK\r\n"); + + char date_ptr [40]; + // 40 bytes is the maximum length needed to store the date + + if (HTTP_Helper::HTTP_date (date_ptr) != 0) + HTTP_HEADER_LENGTH += + ACE_OS::sprintf (HTTP_HEADER+HTTP_HEADER_LENGTH, + "Date: %s\r\n", date_ptr); if (! this->request_.cgi ()) + HTTP_HEADER_LENGTH += + ACE_OS::sprintf (HTTP_HEADER+HTTP_HEADER_LENGTH, + "Content-type: %s\r\n\r\n", + "text/html"); +#else + if (! this->request_.cgi ()) HTTP_HEADER = "HTTP/1.0 200 OK\r\n" "Content-type: text/html\r\n\r\n"; else @@ -331,20 +351,7 @@ HTTP_Response::build_headers (void) HTTP_HEADER_LENGTH = ACE_OS::strlen (HTTP_HEADER); -#if 0 - const char *date_ptr = HTTP_Helper::HTTP_date (); - - if (date_ptr != 0) - HTTP_HEADER_LENGTH += - ACE_OS::sprintf(HTTP_HEADER+HTTP_HEADER_LENGTH, - "Date: %s\r\n", date_ptr); - - if (! this->request_.cgi ()) - HTTP_HEADER_LENGTH += - ACE_OS::sprintf(HTTP_HEADER+HTTP_HEADER_LENGTH, - "Content-type: %s\r\n\r\n", - "text/html"); -#endif +#endif /* ACE_JAWS_BASELINE */ } HTTP_TRAILER = ""; diff --git a/apps/JAWS/server/IO.cpp b/apps/JAWS/server/IO.cpp index b58cdf3d13b..6c3fce10433 100644 --- a/apps/JAWS/server/IO.cpp +++ b/apps/JAWS/server/IO.cpp @@ -105,7 +105,7 @@ JAWS_Synch_IO::transmit_file (const char *filename, if (result == ACE_Filecache_Handle::SUCCESS) { -#if 0 +#if defined (ACE_JAWS_BASELINE) ACE_SOCK_Stream stream; stream.set_handle (this->handle_); @@ -143,7 +143,7 @@ JAWS_Synch_IO::transmit_file (const char *filename, result = -1; else this->handler_->transmit_file_complete (); -#endif +#endif /* ACE_JAWS_BASELINE */ } if (result != ACE_Filecache_Handle::SUCCESS) diff --git a/apps/JAWS/server/main.cpp b/apps/JAWS/server/main.cpp index 505c92026d7..9477cfb6058 100644 --- a/apps/JAWS/server/main.cpp +++ b/apps/JAWS/server/main.cpp @@ -12,8 +12,9 @@ static void handler (int) { // reap any threads which have been orphaned. - while (ACE_OS::thr_join (0, 0, 0) ==0) - ; + // can't do this until we figure out how to shut down a thread pool +// while (ACE_OS::thr_join (0, 0, 0) ==0) +// ; // call exit() so that static destructors get called ACE_OS::exit (0); diff --git a/apps/JAWS/server/svc.conf b/apps/JAWS/server/svc.conf index 5d1e0d0dec6..a180ee1b383 100644 --- a/apps/JAWS/server/svc.conf +++ b/apps/JAWS/server/svc.conf @@ -16,12 +16,17 @@ # -b backlog value for listen () # # +# Thread Pool, 20 unbound threads +# This is the baseline +static HTTP_Server "HTTP_Server -p 5432 -n 20 -i SYNCH -t POOL -b 50 -f THR_NEW_LWP" +# +# # Thread Pool, 40 threads #static HTTP_Server "HTTP_Server -p 5432 -n 40 -i SYNCH -t POOL -b 50 -f THR_NEW_LWP -f THR_BOUND" # # # Thread-per-request, unlimited number of threads -static HTTP_Server "HTTP_Server -p 5432 -i SYNCH -t PER_REQUEST -b 50 -f THR_NEW_LWP" +#static HTTP_Server "HTTP_Server -p 5432 -i SYNCH -t PER_REQUEST -b 50 -f THR_NEW_LWP" # # # Throttling, 40 threads |