mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
support JSONP DELTE/POST/PUT
This commit is contained in:
parent
baa70d4ddd
commit
e43d4e46b4
4 changed files with 50 additions and 12 deletions
|
@ -106,29 +106,25 @@ int srs_api_response_json_code(ISrsHttpResponseWriter* w, int code)
|
|||
|
||||
int srs_api_response(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, std::string json)
|
||||
{
|
||||
string callback = r->query_get("callback");
|
||||
bool jsonp = !callback.empty();
|
||||
|
||||
// no jsonp, directly response.
|
||||
if (!jsonp) {
|
||||
if (!r->is_jsonp()) {
|
||||
return srs_api_response_json(w, json);
|
||||
}
|
||||
|
||||
// jsonp, get function name from query("callback")
|
||||
string callback = r->query_get("callback");
|
||||
return srs_api_response_jsonp(w, callback, json);
|
||||
}
|
||||
|
||||
int srs_api_response_code(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, int code)
|
||||
{
|
||||
string callback = r->query_get("callback");
|
||||
bool jsonp = !callback.empty();
|
||||
|
||||
// no jsonp, directly response.
|
||||
if (!jsonp) {
|
||||
if (!r->is_jsonp()) {
|
||||
return srs_api_response_json_code(w, code);
|
||||
}
|
||||
|
||||
// jsonp, get function name from query("callback")
|
||||
string callback = r->query_get("callback");
|
||||
return srs_api_response_jsonp_code(w, callback, code);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue