1 #include "HTTPU/parse_http_request.h"
3 Parse_HTTP_Request::Parse_HTTP_Request (const char *request
)
16 Parse_HTTP_Request::~Parse_HTTP_Request ()
19 ACE_OS::free (this->request_
);
26 Parse_HTTP_Request::dump ()
28 ACE_DEBUG ((LM_DEBUG
, "%s %s %s\n",
29 this->method_str (), this->url (), this->version ()));
33 Parse_HTTP_Request::init (const char *request
)
37 this->request_
= ACE_OS::strdup (request
);
38 if (this->request_
== 0)
40 this->error_
= NO_MEMORY
;
45 int n
= ::sscanf (this->request_
, "%s %*s HTTP/%d.%d",
47 &(this->major_version_
),
48 &(this->minor_version_
));
52 char *p
= this->request_
;
54 while (*p
== ' ' || *p
== '\t')
59 while (*p
!= ' ' && *p
!= '\t')
64 while (*p
== ' ' || *p
== '\t')
69 while (*p
&& !ACE_OS::strchr (" \t\r\n", *p
))
76 this->major_version_
= 0;
77 this->minor_version_
= 9;
81 while (*p
== ' ' || *p
== '\t')
86 while (*p
&& !ACE_OS::strchr (" \t\r\n", *p
))
92 if (ACE_OS::strcmp (method
, "GET") == 0)
94 else if (ACE_OS::strcmp (method
, "HEAD") == 0)
95 this->method_
= &HEAD
;
96 else if (ACE_OS::strcmp (method
, "POST") == 0)
97 this->method_
= &POST
;
98 else if (ACE_OS::strcmp (method
, "PUT") == 0)
100 else if (ACE_OS::strcmp (method
, "QUIT") == 0)
101 this->method_
= &QUIT
;
104 this->method_
= &DUNNO
;
105 this->error_
= NOT_IMPLEMENTED
;
109 this->error_
= BAD_REQUEST
;
112 #if !defined (ACE_HAS_INLINED_OSCALLS)
113 # include "HTTPU/parse_http_request.inl"
114 #endif /* ACE_HAS_INLINED_OSCALLS */