1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
// $Id: http_request.cpp 80826 2008-03-04 14:51:23Z wotte $
#include "HTTPU/http_request.h"
#include "HTTPU/parse_http_request.h"
void
HTTP_Request::parse_line (void)
{
this->status_ = STATUS_OK;
this->request_.init (this->line ());
if (this->request_.error () != Parse_HTTP_Request::HTTPU_OK)
{
this->status_ = STATUS_INTERNAL_SERVER_ERROR;
return;
}
if (this->request_.major_version () == 0)
{
this->no_headers_ = 1;
return;
}
this->url_.init (this->request_.url ());
if (this->url_.error () != 0)
this->status_ = STATUS_INTERNAL_SERVER_ERROR;
}
int
HTTP_Request::espouse_line (void)
{
int count;
if (this->request_.major_version () == 0)
{
count = ACE_OS::sprintf (this->mb_->wr_ptr (), "%s /%s\r\n\r\n",
this->request_.method_str (),
this->url_.url_path ());
if (count < 0)
return -1;
this->mb_->wr_ptr (count);
return 1;
}
count = ACE_OS::sprintf (this->mb_->wr_ptr (), "%s /%s %s\r\n",
this->request_.method_str (),
this->url_.url_path (),
this->request_.version ());
if (count < 0)
return -1;
this->mb_->wr_ptr (count);
if (this->url_.host () != 0)
{
JAWS_Header_Data *hd = this->headers ()->find ("Host");
if (hd == 0)
{
count = ACE_OS::sprintf (this->mb_->wr_ptr (), "Host: %s\r\n",
this->url_.host ());
if (count < 0)
return -1;
this->mb_->wr_ptr (count);
}
}
return 0;
}
void
HTTP_Request::dump (void)
{
ACE_DEBUG ((LM_DEBUG, "===== BEGIN entera_HTTP_Request::dump =====\n"));
HTTP_Base::dump ();
this->request_.dump ();
ACE_DEBUG ((LM_DEBUG, "===== END entera_HTTP_Request::dump =====\n"));
}
#if !defined (ACE_HAS_INLINED_OSCALLS)
# include "HTTPU/http_request.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
|