mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
refine http.
This commit is contained in:
parent
964e4be9d4
commit
2bcb4f811c
1 changed files with 26 additions and 0 deletions
|
@ -483,20 +483,43 @@ public:
|
||||||
public:
|
public:
|
||||||
virtual u_int8_t method();
|
virtual u_int8_t method();
|
||||||
virtual u_int16_t status_code();
|
virtual u_int16_t status_code();
|
||||||
|
/**
|
||||||
|
* method helpers.
|
||||||
|
*/
|
||||||
virtual std::string method_str();
|
virtual std::string method_str();
|
||||||
virtual bool is_http_get();
|
virtual bool is_http_get();
|
||||||
virtual bool is_http_put();
|
virtual bool is_http_put();
|
||||||
virtual bool is_http_post();
|
virtual bool is_http_post();
|
||||||
virtual bool is_http_delete();
|
virtual bool is_http_delete();
|
||||||
virtual bool is_http_options();
|
virtual bool is_http_options();
|
||||||
|
/**
|
||||||
|
* whether body is chunked encoding, for reader only.
|
||||||
|
*/
|
||||||
virtual bool is_chunked();
|
virtual bool is_chunked();
|
||||||
|
/**
|
||||||
|
* the uri contains the host and path.
|
||||||
|
*/
|
||||||
virtual std::string uri();
|
virtual std::string uri();
|
||||||
|
/**
|
||||||
|
* the url maybe the path.
|
||||||
|
*/
|
||||||
virtual std::string url();
|
virtual std::string url();
|
||||||
virtual std::string host();
|
virtual std::string host();
|
||||||
virtual std::string path();
|
virtual std::string path();
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* read body to string.
|
||||||
|
* @remark for small http body.
|
||||||
|
*/
|
||||||
virtual int body_read_all(std::string& body);
|
virtual int body_read_all(std::string& body);
|
||||||
|
/**
|
||||||
|
* get the body reader, to read one by one.
|
||||||
|
* @remark when body is very large, or chunked, use this.
|
||||||
|
*/
|
||||||
virtual ISrsHttpResponseReader* body_reader();
|
virtual ISrsHttpResponseReader* body_reader();
|
||||||
|
/**
|
||||||
|
* the content length, -1 for chunked or not set.
|
||||||
|
*/
|
||||||
virtual int64_t content_length();
|
virtual int64_t content_length();
|
||||||
/**
|
/**
|
||||||
* get the param in query string,
|
* get the param in query string,
|
||||||
|
@ -504,6 +527,9 @@ public:
|
||||||
* then query_get("start") is "100", and query_get("end") is "200"
|
* then query_get("start") is "100", and query_get("end") is "200"
|
||||||
*/
|
*/
|
||||||
virtual std::string query_get(std::string key);
|
virtual std::string query_get(std::string key);
|
||||||
|
/**
|
||||||
|
* get the headers.
|
||||||
|
*/
|
||||||
virtual int request_header_count();
|
virtual int request_header_count();
|
||||||
virtual std::string request_header_key_at(int index);
|
virtual std::string request_header_key_at(int index);
|
||||||
virtual std::string request_header_value_at(int index);
|
virtual std::string request_header_value_at(int index);
|
||||||
|
|
Loading…
Reference in a new issue