diff options
author | jxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-04-27 23:43:23 +0000 |
---|---|---|
committer | jxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-04-27 23:43:23 +0000 |
commit | 5b110ab6da42ca95e1f0ec25dc5a1c64ddecf82f (patch) | |
tree | 1d817094d928932bab41bd7ac59f75bcf6a3ee76 /apps/JAWS2/HTTP_10_Parse.cpp | |
parent | 83dc2312211cbffe4b19390eb2fdb88721348c68 (diff) | |
download | ATCD-5b110ab6da42ca95e1f0ec25dc5a1c64ddecf82f.tar.gz |
Move PROTOTYPE up into something more prominent.
Diffstat (limited to 'apps/JAWS2/HTTP_10_Parse.cpp')
-rw-r--r-- | apps/JAWS2/HTTP_10_Parse.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/apps/JAWS2/HTTP_10_Parse.cpp b/apps/JAWS2/HTTP_10_Parse.cpp new file mode 100644 index 00000000000..ad104a993e9 --- /dev/null +++ b/apps/JAWS2/HTTP_10_Parse.cpp @@ -0,0 +1,82 @@ +// $Id$ + +#include "ace/streams.h" + +#include "HTTP_10.h" + +#include "JAWS/JAWS.h" +#include "JAWS/IO.h" +#include "JAWS/IO_Handler.h" +#include "JAWS/Policy.h" + +#include "HTTP_10_Request.h" + +ACE_RCSID(PROTOTYPE, HTTP_10_Parse, "$Id$") + +// --------------- PARSE TASK ---------------------- + +JAWS_HTTP_10_Parse_Task::JAWS_HTTP_10_Parse_Task (void) +{ +} + +JAWS_HTTP_10_Parse_Task::~JAWS_HTTP_10_Parse_Task (void) +{ +} + +int +JAWS_HTTP_10_Parse_Task::handle_put (JAWS_Data_Block *data, ACE_Time_Value *) +{ + JAWS_TRACE ("JAWS_HTTP_10_Parse_Task::handle_put"); + + JAWS_IO_Handler *handler = data->io_handler (); + JAWS_Dispatch_Policy *policy = this->policy (); + if (policy == 0) policy = data->policy (); + JAWS_IO *io = policy->io (); + + JAWS_HTTP_10_Request *info; + + if (data->payload ()) + info = ACE_reinterpret_cast (JAWS_HTTP_10_Request *, data->payload ()); + else + { + info = new JAWS_HTTP_10_Request; + if (info == 0) + { + ACE_ERROR ((LM_ERROR, "%p\n", "JAWS_HTTP_10_Parse_Task::handle_put")); + return -1; + } + data->payload (ACE_static_cast (void *, info)); + } + + while (info->receive (*(ACE_Message_Block *)data) == 0) + { + int next_read_size = data->space (); + + if (next_read_size == 0) + { + // Set payload to reflect "request too long" + break; + } + + io->read (handler, data, next_read_size); + switch (handler->status ()) + { + case JAWS_IO_Handler::READ_OK: + // Behaved synchronously, reiterate + continue; + case JAWS_IO_Handler::READ_ERROR: + case JAWS_IO_Handler::READ_ERROR_A: + return -1; + default: + // This needs to be a value that tells the framework that + // the call is asynchronous, but that we should remain in + // the current task state. + return 2; + } + } + + // request completely parsed + info->dump (); + + return 0; +} |