diff options
author | jxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-06-02 21:44:02 +0000 |
---|---|---|
committer | jxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-06-02 21:44:02 +0000 |
commit | a20d6fbf69c8f0dc95ad3cd79c43d455aa8405d3 (patch) | |
tree | 2de7917bb3396404c975ad02a8e5685c0b4e0ce8 /apps | |
parent | 3de1f659906a5b112cb30b731a77553b5cd69754 (diff) | |
download | ATCD-a20d6fbf69c8f0dc95ad3cd79c43d455aa8405d3.tar.gz |
HTTP_Handler.cpp: Added a "\r\n" to the confirmation message in
receive_file_complete () method.
HTTP_Request.cpp: In parse_request_line (), created conditional
expressions in the debugging print statement so that a null
string will not cause the server to crash.
HTTP_Response.cpp:
(1) cgi_resposnse () no longer has to wait for the process to
die. The fix to ACE_Process of closing down child handles was
enough to get the connection to die on its own.
(2) Mike (mrm@cisco.com) pointed out that the output for CGI
responses was not create. The fix was to output a small header
before execing the CGI program.
test.cgi: a sample cgi program to use when testing the JAWS
server.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/JAWS/server/HTTP_Handler.cpp | 2 | ||||
-rw-r--r-- | apps/JAWS/server/HTTP_Request.cpp | 3 | ||||
-rw-r--r-- | apps/JAWS/server/HTTP_Response.cpp | 23 | ||||
-rwxr-xr-x | apps/JAWS/server/test.cgi | 9 |
4 files changed, 26 insertions, 11 deletions
diff --git a/apps/JAWS/server/HTTP_Handler.cpp b/apps/JAWS/server/HTTP_Handler.cpp index 1a25e26dd4f..1ae9c8edc0b 100644 --- a/apps/JAWS/server/HTTP_Handler.cpp +++ b/apps/JAWS/server/HTTP_Handler.cpp @@ -92,7 +92,7 @@ HTTP_Handler::receive_file_complete (void) char buffer[BUFSIZ]; int buflen = ACE_OS::sprintf (buffer, - "%s %d %s", + "%s %d %s\r\n", this->request_.version (), HTTP_Status_Code::STATUS_OK, "Successful"); diff --git a/apps/JAWS/server/HTTP_Request.cpp b/apps/JAWS/server/HTTP_Request.cpp index 44b0c36001f..17ba795cc12 100644 --- a/apps/JAWS/server/HTTP_Request.cpp +++ b/apps/JAWS/server/HTTP_Request.cpp @@ -128,7 +128,8 @@ HTTP_Request::parse_request_line (char * const request_line) } ACE_DEBUG ((LM_DEBUG, " (%t) request %s %s %s parsed\n", - this->method (), this->uri (), + (this->method () ? this->method () : "-"), + (this->uri () ? this->uri () : "="), (this->version () ? this->version () : "HTTP/0.9"))); ACE_OS::memmove (buf, ptr, ACE_OS::strlen (ptr)+1); diff --git a/apps/JAWS/server/HTTP_Response.cpp b/apps/JAWS/server/HTTP_Response.cpp index e2f41341b62..19369d1f553 100644 --- a/apps/JAWS/server/HTTP_Response.cpp +++ b/apps/JAWS/server/HTTP_Response.cpp @@ -307,22 +307,26 @@ HTTP_Response::cgi_response (void) this->io_.handle (), this->io_.handle ()); + this->build_headers (); + this->io_.send_confirmation_message (this->HTTP_HEADER, + this->HTTP_HEADER_LENGTH); + // ACE::send (this->io_.handle (), + // this->HTTP_HEADER, this->HTTP_HEADER_LENGTH); + // Exec the cgi program ACE_Process cgi_process; cgi_process.spawn (cgi_options); - cgi_process.wait (); - io_.send_confirmation_message ("", 0); + // cgi_process.wait (); } void HTTP_Response::build_headers (void) { // At this point, we should really determine the type of request - // this is, and build the appropriate header. For instance, this - // is unnecessary for CGI files since the header and contents are - // created and sent by the CGI program. + // this is, and build the appropriate header. // Let's assume this is HTML for now. + // Unless the request is CGI, then do not include content-* headers. if (this->request_.version () == 0 || ACE_OS::strcmp ("HTTP/0.9", this->request_.version ()) == 0) @@ -353,10 +357,11 @@ HTTP_Response::build_headers (void) "Date: %s\r\n", date_ptr); } - HTTP_HEADER_LENGTH += - ACE_OS::sprintf(HTTP_HEADER+HTTP_HEADER_LENGTH, - "Content-type: %s\r\n\r\n", - "text/html"); + if (! this->request_.cgi ()) + HTTP_HEADER_LENGTH += + ACE_OS::sprintf(HTTP_HEADER+HTTP_HEADER_LENGTH, + "Content-type: %s\r\n\r\n", + "text/html"); } HTTP_TRAILER = ""; diff --git a/apps/JAWS/server/test.cgi b/apps/JAWS/server/test.cgi new file mode 100755 index 00000000000..936afcf0d3c --- /dev/null +++ b/apps/JAWS/server/test.cgi @@ -0,0 +1,9 @@ +#!/bin/sh + +echo Content-type: text/plain +echo + +echo args -- $* +env +echo Done! +exit 0 |