void Request::responseHeader(const string& key, const string& value)
{
if (key == "connection") {
- _willClose = (value.find("close") >= 0);
+ _willClose = (value.find("close") != string::npos);
}
_responseHeaders[key] = value;
return u.substr(hostEnd, query - hostEnd);
}
+
+string Request::query() const
+{
+ string u(url());
+ int query = u.find('?');
+ if (query < 0) {
+ return ""; //no query string found
+ }
+
+ return u.substr(query); //includes question mark
+}
+
+
+
string Request::host() const
{
string hp(hostAndPort());
// for non HTTP/1.1 connections, assume server closes
return _willClose || (_responseVersion != HTTP_1_1);
}
+
+int Request::requestBodyLength() const
+{
+ return -1;
+}
+
+std::string Request::requestBodyType() const
+{
+ return "text/plain";
+}
+
+void Request::getBodyData(char*, int& count) const
+{
+ count = 0;
+ return;
+}
} // of namespace HTTP