mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine http client, use initialize to set host and port.
This commit is contained in:
parent
2bcb4f811c
commit
1277968d4a
6 changed files with 59 additions and 66 deletions
|
@ -50,25 +50,36 @@ private:
|
|||
st_netfd_t stfd;
|
||||
SrsStSocket* skt;
|
||||
SrsHttpParser* parser;
|
||||
private:
|
||||
// host name or ip.
|
||||
std::string host;
|
||||
int port;
|
||||
public:
|
||||
SrsHttpClient();
|
||||
virtual ~SrsHttpClient();
|
||||
public:
|
||||
/**
|
||||
* initialize the client, connect to host and port.
|
||||
*/
|
||||
virtual int initialize(std::string h, int p);
|
||||
public:
|
||||
/**
|
||||
* to post data to the uri.
|
||||
* @param the path to request on.
|
||||
* @param req the data post to uri. empty string to ignore.
|
||||
* @param ppmsg output the http message to read the response.
|
||||
*/
|
||||
virtual int post(SrsHttpUri* uri, std::string req, SrsHttpMessage** ppmsg);
|
||||
virtual int post(std::string path, std::string req, SrsHttpMessage** ppmsg);
|
||||
/**
|
||||
* to get data from the uri.
|
||||
* @param the path to request on.
|
||||
* @param req the data post to uri. empty string to ignore.
|
||||
* @param ppmsg output the http message to read the response.
|
||||
*/
|
||||
virtual int get(SrsHttpUri* uri, std::string req, SrsHttpMessage** ppmsg);
|
||||
virtual int get(std::string path, std::string req, SrsHttpMessage** ppmsg);
|
||||
private:
|
||||
virtual void disconnect();
|
||||
virtual int connect(SrsHttpUri* uri);
|
||||
virtual int connect();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue