From b285029e15209924aafac9221b3b081b6e49d939 Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 23 Apr 2019 08:17:59 +0800 Subject: [PATCH] Refine SrsHttpUri.get_uri_field, without depends on http parser. --- trunk/src/protocol/srs_http_stack.cpp | 5 ++++- trunk/src/protocol/srs_http_stack.hpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/trunk/src/protocol/srs_http_stack.cpp b/trunk/src/protocol/srs_http_stack.cpp index c23911266..b869a8f6c 100644 --- a/trunk/src/protocol/srs_http_stack.cpp +++ b/trunk/src/protocol/srs_http_stack.cpp @@ -3094,8 +3094,11 @@ string SrsHttpUri::get_query() return query; } -string SrsHttpUri::get_uri_field(string uri, http_parser_url* hp_u, http_parser_url_fields field) +string SrsHttpUri::get_uri_field(string uri, void* php_u, int ifield) { + http_parser_url* hp_u = (http_parser_url*)php_u; + http_parser_url_fields field = (http_parser_url_fields)ifield; + if((hp_u->field_set & (1 << field)) == 0){ return ""; } diff --git a/trunk/src/protocol/srs_http_stack.hpp b/trunk/src/protocol/srs_http_stack.hpp index e68fe7b4e..dfa587df6 100644 --- a/trunk/src/protocol/srs_http_stack.hpp +++ b/trunk/src/protocol/srs_http_stack.hpp @@ -835,7 +835,7 @@ public: private: // Get the parsed url field. // @return return empty string if not set. - virtual std::string get_uri_field(std::string uri, http_parser_url* hp_u, http_parser_url_fields field); + virtual std::string get_uri_field(std::string uri, void* hp_u, int field); }; #endif