1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Refine SrsHttpUri.

This commit is contained in:
winlin 2019-04-23 08:26:15 +08:00
parent b285029e15
commit 6e9bba4220
2 changed files with 120 additions and 142 deletions

View file

@ -508,10 +508,40 @@ public:
virtual bool is_jsonp() = 0;
};
// Used to resolve the http uri.
class SrsHttpUri
{
private:
std::string url;
std::string schema;
std::string host;
int port;
std::string path;
std::string query;
public:
SrsHttpUri();
virtual ~SrsHttpUri();
public:
// Initialize the http uri.
virtual srs_error_t initialize(std::string _url);
public:
virtual std::string get_url();
virtual std::string get_schema();
virtual std::string get_host();
virtual int get_port();
virtual std::string get_path();
virtual std::string get_query();
private:
// Get the parsed url field.
// @return return empty string if not set.
virtual std::string get_uri_field(std::string uri, void* hp_u, int field);
};
#endif
// The http-parser is license under MIT at https://github.com/nodejs/http-parser/blob/master/LICENSE-MIT
// Version: 2.1 from https://github.com/nodejs/http-parser/releases/tag/v2.1
// File: https://github.com/nodejs/http-parser/blob/80819384450b5511a3d1c424dd92a5843c891364/http_parser.h
//Copyright Joyent, Inc. and other Node contributors. All rights reserved.
//
@ -809,34 +839,5 @@ extern "C" {
#endif
#endif
// Used to resolve the http uri.
class SrsHttpUri
{
private:
std::string url;
std::string schema;
std::string host;
int port;
std::string path;
std::string query;
public:
SrsHttpUri();
virtual ~SrsHttpUri();
public:
// Initialize the http uri.
virtual srs_error_t initialize(std::string _url);
public:
virtual std::string get_url();
virtual std::string get_schema();
virtual std::string get_host();
virtual int get_port();
virtual std::string get_path();
virtual std::string get_query();
private:
// Get the parsed url field.
// @return return empty string if not set.
virtual std::string get_uri_field(std::string uri, void* hp_u, int field);
};
#endif