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

merge from 2.0release

This commit is contained in:
winlin 2015-08-11 15:49:48 +08:00
commit f28c9b7eb5
5 changed files with 72 additions and 11 deletions

View file

@ -111,7 +111,13 @@ int SrsGoApiV1::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
<< SRS_JFIELD_STR("authors", "the primary authors and contributors") << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("requests", "the request itself, for http debug") << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("vhosts", "dumps vhost to json") << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("streams", "dumps streams to json")
<< SRS_JFIELD_STR("streams", "dumps streams to json") << SRS_JFIELD_CONT
<< SRS_JFIELD_ORG("test", SRS_JOBJECT_START)
<< SRS_JFIELD_STR("requests", "show the request info") << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("errors", "always return an error 100") << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("redirects", "always redirect to /api/v1/test/errors") << SRS_JFIELD_CONT
<< SRS_JFIELD_STR(".vhost.", "http vhost for error.srs.com/api/v1/test/errors")
<< SRS_JOBJECT_END
<< SRS_JOBJECT_END
<< SRS_JOBJECT_END;
@ -443,9 +449,9 @@ int SrsGoApiVhosts::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
std::stringstream ss;
ss << SRS_JOBJECT_START
<< SRS_JFIELD_ERROR(ret) << SRS_JFIELD_CONT
<< SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT
<< SRS_JFIELD_ORG("vhosts", data.str())
<< SRS_JFIELD_ERROR(ret) << SRS_JFIELD_CONT
<< SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT
<< SRS_JFIELD_ORG("vhosts", data.str())
<< SRS_JOBJECT_END;
return srs_http_response_json(w, ss.str());
@ -521,6 +527,27 @@ int SrsGoApiStreams::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
}
}
SrsGoApiError::SrsGoApiError()
{
}
SrsGoApiError::~SrsGoApiError()
{
}
int SrsGoApiError::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
{
std::stringstream ss;
ss << SRS_JOBJECT_START
<< SRS_JFIELD_ERROR(100) << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("msg", "SRS demo error.") << SRS_JFIELD_CONT
<< SRS_JFIELD_STR("path", r->path())
<< SRS_JOBJECT_END;
return srs_http_response_json(w, ss.str());
}
SrsHttpApi::SrsHttpApi(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m)
: SrsConnection(cm, fd)