+ return _responseLength;
+}
+
+void Request::setFailure(int code, const std::string& reason)
+{
+ _responseStatus = code;
+ _responseReason = reason;
+ failed();
+}
+
+void Request::failed()
+{
+ // no-op in base class
+}
+
+Request::HTTPVersion Request::decodeVersion(const string& v)
+{
+ if (v == "HTTP/1.1") return HTTP_1_1;
+ if (v == "HTTP/1.0") return HTTP_1_0;
+ if (strutils::starts_with(v, "HTTP/0.")) return HTTP_0_x;
+ return HTTP_VERSION_UNKNOWN;
+}
+
+bool Request::closeAfterComplete() const
+{
+// for non HTTP/1.1 connections, assume server closes
+ return _willClose || (_responseVersion != HTTP_1_1);