Cleanup ACE_HAS_PTHREAD_SIGMASK_PROTOTYPE, all platforms support it so far as I can...
[ACE_TAO.git] / ACE / apps / JAWS2 / HTTPU / http_request.cpp
blobf24689aa8766d75bea7ab4e83aa75eff1e331cf2
1 #include "HTTPU/http_request.h"
2 #include "HTTPU/parse_http_request.h"
4 void
5 HTTP_Request::parse_line ()
7 this->status_ = STATUS_OK;
9 this->request_.init (this->line ());
10 if (this->request_.error () != Parse_HTTP_Request::HTTPU_OK)
12 this->status_ = STATUS_INTERNAL_SERVER_ERROR;
13 return;
15 if (this->request_.major_version () == 0)
17 this->no_headers_ = 1;
18 return;
21 this->url_.init (this->request_.url ());
22 if (this->url_.error () != 0)
23 this->status_ = STATUS_INTERNAL_SERVER_ERROR;
26 int
27 HTTP_Request::espouse_line ()
29 int count;
31 if (this->request_.major_version () == 0)
33 count = ACE_OS::sprintf (this->mb_->wr_ptr (), "%s /%s\r\n\r\n",
34 this->request_.method_str (),
35 this->url_.url_path ());
37 if (count < 0)
38 return -1;
40 this->mb_->wr_ptr (count);
42 return 1;
45 count = ACE_OS::sprintf (this->mb_->wr_ptr (), "%s /%s %s\r\n",
46 this->request_.method_str (),
47 this->url_.url_path (),
48 this->request_.version ());
50 if (count < 0)
51 return -1;
53 this->mb_->wr_ptr (count);
55 if (this->url_.host () != 0)
57 JAWS_Header_Data *hd = this->headers ()->find ("Host");
58 if (hd == 0)
60 count = ACE_OS::sprintf (this->mb_->wr_ptr (), "Host: %s\r\n",
61 this->url_.host ());
63 if (count < 0)
64 return -1;
66 this->mb_->wr_ptr (count);
70 return 0;
73 void
74 HTTP_Request::dump ()
76 ACE_DEBUG ((LM_DEBUG, "===== BEGIN entera_HTTP_Request::dump =====\n"));
77 HTTP_Base::dump ();
78 this->request_.dump ();
79 ACE_DEBUG ((LM_DEBUG, "===== END entera_HTTP_Request::dump =====\n"));
82 #if !defined (ACE_HAS_INLINED_OSCALLS)
83 # include "HTTPU/http_request.inl"
84 # endif /* ACE_HAS_INLINED_OSCALLS */