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

support http methods, support js crossdomain request

This commit is contained in:
winlin 2014-04-01 14:28:19 +08:00
parent 51c1615173
commit 6ca9b774c1
5 changed files with 145 additions and 46 deletions

View file

@ -36,19 +36,41 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <http_parser.h>
class SrsSocket;
class SrsBuffer;
enum SrsHttpParseState {
SrsHttpParseStateInit = 0,
SrsHttpParseStateStart,
SrsHttpParseStateComplete
};
class SrsHttpRequest
{
public:
std::string url;
http_parser header;
SrsBuffer* body;
SrsHttpParseState state;
SrsHttpRequest();
virtual ~SrsHttpRequest();
virtual void reset();
virtual bool is_complete();
};
class SrsHttpConn : public SrsConnection
{
private:
http_parser* http_header;
SrsHttpRequest* req;
public:
SrsHttpConn(SrsServer* srs_server, st_netfd_t client_stfd);
virtual ~SrsHttpConn();
protected:
virtual int do_cycle();
private:
virtual int process_request(SrsSocket* skt, http_parser* parser, http_parser_settings* settings);
virtual int complete_header(SrsSocket* skt, http_parser* header, char* body, int nb_body);
virtual int parse_request(SrsSocket* skt, http_parser* parser, http_parser_settings* settings);
virtual int process_request(SrsSocket* skt);
private:
static int on_message_begin(http_parser* parser);
static int on_headers_complete(http_parser* parser);