return u.substr(schemeEnd + 3, hostEnd - (schemeEnd + 3));
}
+//------------------------------------------------------------------------------
+std::string Request::responseMime() const
+{
+ std::string content_type = _responseHeaders.get("content-type");
+ if( content_type.empty() )
+ return "application/octet-stream";
+
+ return content_type.substr(0, content_type.find(';'));
+}
+
//------------------------------------------------------------------------------
void Request::setResponseLength(unsigned int l)
{
{
_responseStatus = code;
_responseReason = reason;
- setReadyState(FAILED);
+
+ if( !isComplete() )
+ setReadyState(FAILED);
}
//------------------------------------------------------------------------------
//----------------------------------------------------------------------------
void Request::abort(const std::string& reason)
{
- if( isComplete() )
- return;
-
setFailure(-1, reason);
_willClose = true;
}