Support get schema for HTTP message

pull/2121/head
winlin 4 years ago
parent af8bf67606
commit 0ccbd7c40a

@ -325,6 +325,8 @@ SrsHttpMessage::SrsHttpMessage(ISrsReader* reader, SrsFastStream* buffer) : ISrs
// From HTTP/1.1, default to keep alive.
_keep_alive = true;
type_ = 0;
schema_ = "http";
}
SrsHttpMessage::~SrsHttpMessage()
@ -416,7 +418,8 @@ srs_error_t SrsHttpMessage::set_url(string url, bool allow_jsonp)
void SrsHttpMessage::set_https(bool v)
{
_uri->set_schema(v? "https" : "http");
schema_ = v? "https" : "http";
_uri->set_schema(schema_);
}
ISrsConnection* SrsHttpMessage::connection()
@ -429,6 +432,11 @@ void SrsHttpMessage::set_connection(ISrsConnection* conn)
owner_conn = conn;
}
string SrsHttpMessage::schema()
{
return schema_;
}
uint8_t SrsHttpMessage::method()
{
if (jsonp && !jsonp_method.empty()) {

@ -120,6 +120,7 @@ private:
// Whether the body is chunked.
bool chunked;
private:
std::string schema_;
// The parsed url.
std::string _url;
// The extension of file, for example, .flv
@ -152,6 +153,8 @@ public:
virtual ISrsConnection* connection();
virtual void set_connection(ISrsConnection* conn);
public:
// The schema, http or https.
virtual std::string schema();
virtual uint8_t method();
virtual uint16_t status_code();
// The method helpers.

Loading…
Cancel
Save