diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-08 06:26:33 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-04-08 06:26:33 +0000 |
commit | 2909f3ba89282c1684e46949c5cada1fa22d5ed7 (patch) | |
tree | bb8810ce036d83ad2cf4b1faa0ead0292daa311d | |
parent | 1ffacc1523a5db6bd0fb1910bf5b087fab19f814 (diff) | |
download | ATCD-2909f3ba89282c1684e46949c5cada1fa22d5ed7.tar.gz |
*** empty log message ***
-rw-r--r-- | apps/JAWS/server/HTTP_Handler.cpp | 13 | ||||
-rw-r--r-- | apps/JAWS/server/HTTP_Handler.h | 6 | ||||
-rw-r--r-- | apps/JAWS/server/IO.cpp | 28 | ||||
-rw-r--r-- | apps/JAWS/server/IO.h | 12 | ||||
-rw-r--r-- | apps/JAWS/server/svc.conf | 2 |
5 files changed, 43 insertions, 18 deletions
diff --git a/apps/JAWS/server/HTTP_Handler.cpp b/apps/JAWS/server/HTTP_Handler.cpp index 907ff5aec9f..2f3af467d9b 100644 --- a/apps/JAWS/server/HTTP_Handler.cpp +++ b/apps/JAWS/server/HTTP_Handler.cpp @@ -6,6 +6,13 @@ #include "JAWS/server/HTTP_Helpers.h" #include "JAWS/server/IO.h" +/* static */ +//const char *HTTP_Handler::HTTP_HEADER = "Server: JAWS\r\n"; +const char *HTTP_Handler::HTTP_HEADER = ""; +const char *HTTP_Handler::HTTP_TRAILER = ""; +const int HTTP_Handler::HTTP_HEADER_LENGTH = ACE_OS::strlen (HTTP_Handler::HTTP_HEADER); +const int HTTP_Handler::HTTP_TRAILER_LENGTH = ACE_OS::strlen (HTTP_Handler::HTTP_TRAILER); + HTTP_Handler::HTTP_Handler (JAWS_IO &io, HTTP_Handler_Factory &factory) : io_ (io), @@ -79,7 +86,11 @@ HTTP_Handler::parse_request (void) switch (request_.type ()) { case HTTP_Request::GET : - this->io_.transmit_file (request_.filename (), "\r\n\r\n", 2); + this->io_.transmit_file (request_.filename (), + HTTP_HEADER, + HTTP_HEADER_LENGTH, + HTTP_TRAILER, + HTTP_TRAILER_LENGTH); break; case HTTP_Request::PUT : diff --git a/apps/JAWS/server/HTTP_Handler.h b/apps/JAWS/server/HTTP_Handler.h index a6327a5a346..b360b281516 100644 --- a/apps/JAWS/server/HTTP_Handler.h +++ b/apps/JAWS/server/HTTP_Handler.h @@ -134,6 +134,12 @@ private: JAWS_IO &io_; // IO class used by the handler + + static const char *HTTP_HEADER; + static const char *HTTP_TRAILER; + static const int HTTP_HEADER_LENGTH; + static const int HTTP_TRAILER_LENGTH; + // Header and Trailer used in file transfer }; class HTTP_Handler_Factory diff --git a/apps/JAWS/server/IO.cpp b/apps/JAWS/server/IO.cpp index 099cf062076..ef3e9e0230f 100644 --- a/apps/JAWS/server/IO.cpp +++ b/apps/JAWS/server/IO.cpp @@ -97,7 +97,9 @@ JAWS_Synch_IO::receive_file (char *filename, void JAWS_Synch_IO::transmit_file (char *filename, const char *header, - int header_size) + int header_size, + const char *trailer, + int trailer_size) { JAWS_VFS_Node *vf = 0; VFS::instance ()->open (filename, vf); @@ -111,17 +113,12 @@ JAWS_Synch_IO::transmit_file (char *filename, ACE_SOCK_Stream stream; stream.set_handle (this->handle_); - int bytes = stream.send_n (header, header_size); - if (bytes == header_size) - { - int bytes = stream.send_n (vf->addr (), vf->size ()); - if (bytes == vf->size ()) - this->handler_->transmit_file_complete (); - else - result = HTTP_Status_Code::STATUS_INTERNAL_SERVER_ERROR; - } + if ((stream.send_n (header, header_size) == header_size) && + (stream.send_n (vf->addr (), vf->size ()) == vf->size ()) && + (stream.send_n (trailer, trailer_size) == trailer_size)) + this->handler_->transmit_file_complete (); else - result = HTTP_Status_Code::STATUS_INTERNAL_SERVER_ERROR; + result = HTTP_Status_Code::STATUS_INTERNAL_SERVER_ERROR; } if (result != HTTP_Status_Code::STATUS_OK) this->handler_->transmit_file_error (result); @@ -258,7 +255,9 @@ JAWS_Asynch_IO::receive_file (char *filename, void JAWS_Asynch_IO::transmit_file (char *filename, const char *header, - int header_size) + int header_size, + const char *trailer, + int trailer_size) { ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer = 0; JAWS_VFS_Node *vf; @@ -272,8 +271,11 @@ JAWS_Asynch_IO::transmit_file (char *filename, if (result == HTTP_Status_Code::STATUS_OK) { ACE_Message_Block header_mb (header, header_size); + ACE_Message_Block trailer_mb (trailer, trailer_size); header_and_trailer = new ACE_Asynch_Transmit_File::Header_And_Trailer (&header_mb, - header_size); + header_size, + &trailer_mb, + trailer_size); ACE_Asynch_Transmit_File tf; if (tf.open (*this, this->handle_) == -1 || tf.transmit_file (vf->get_handle (), // file handle diff --git a/apps/JAWS/server/IO.h b/apps/JAWS/server/IO.h index 96ceeec3909..b0ee587691f 100644 --- a/apps/JAWS/server/IO.h +++ b/apps/JAWS/server/IO.h @@ -30,7 +30,9 @@ public: virtual void read (ACE_Message_Block& mb, int size) = 0; virtual void transmit_file (char *filename, const char *header, - int header_size) = 0; + int header_size, + const char *trailer, + int trailer_size) = 0; virtual void receive_file (char *filename, void *initial_data, int initial_data_length, @@ -51,7 +53,9 @@ public: void read (ACE_Message_Block& mb, int size); void transmit_file (char *filename, const char *header, - int header_size); + int header_size, + const char *trailer, + int trailer_size); void receive_file (char *filename, void *initial_data, int initial_data_length, @@ -74,7 +78,9 @@ public: void read (ACE_Message_Block& mb, int size); void transmit_file (char *filename, const char *header, - int header_size); + int header_size, + const char *trailer, + int trailer_size); void receive_file (char *filename, void *initial_data, int initial_data_length, diff --git a/apps/JAWS/server/svc.conf b/apps/JAWS/server/svc.conf index 0032fb4d45e..e85488301dd 100644 --- a/apps/JAWS/server/svc.conf +++ b/apps/JAWS/server/svc.conf @@ -5,6 +5,6 @@ # = 1 -> thread per request # = 2 -> asynch thread pool # -static HTTP_Server "HTTP_Server -p 5432 -n 10 -s 0" +static HTTP_Server "HTTP_Server -p 80 -n 10 -s 0" #dynamic HTTP_Server Service_Object * .shobj/HTTP_Server:jaws "HTTP_Server -p 5432 -s HTTP_Service" |