1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00

Fix #744 http callback set a wrong default port (#777)

* Add port verify

Code is more robust

* Verify port

Verify port

* Change hard code to defined.

Change hard code to defined.
This commit is contained in:
Chengdong Zhang 2017-02-25 11:28:59 +08:00 committed by winlin
parent d786d61685
commit a3df4e3bfb

View file

@ -3037,7 +3037,7 @@ int SrsHttpUri::initialize(string _url)
{ {
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
port = 0; //port = 0;
schema = host = path = query = ""; schema = host = path = query = "";
url = _url; url = _url;
@ -3063,6 +3063,9 @@ int SrsHttpUri::initialize(string _url)
if(!field.empty()){ if(!field.empty()){
port = atoi(field.c_str()); port = atoi(field.c_str());
} }
if(port<=0){
port = SRS_DEFAULT_HTTP_PORT;
}
path = get_uri_field(url, &hp_u, UF_PATH); path = get_uri_field(url, &hp_u, UF_PATH);
srs_info("parse url %s success", purl); srs_info("parse url %s success", purl);