1
0
Fork 0
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:
winlin 2015-03-06 12:07:12 +08:00
parent 2bcb4f811c
commit 1277968d4a
6 changed files with 59 additions and 66 deletions

View file

@ -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