mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
refine the proxy api server.
This commit is contained in:
parent
fe1886aa08
commit
0000c945ea
1 changed files with 14 additions and 9 deletions
|
@ -36,7 +36,7 @@ reload(sys)
|
||||||
exec("sys.setdefaultencoding('utf-8')")
|
exec("sys.setdefaultencoding('utf-8')")
|
||||||
assert sys.getdefaultencoding().lower() == "utf-8"
|
assert sys.getdefaultencoding().lower() == "utf-8"
|
||||||
|
|
||||||
import os, json, time, datetime, cherrypy, threading
|
import os, json, time, datetime, cherrypy, threading, urllib2
|
||||||
|
|
||||||
# simple log functions.
|
# simple log functions.
|
||||||
def trace(msg):
|
def trace(msg):
|
||||||
|
@ -328,15 +328,20 @@ class RESTProxy(object):
|
||||||
'''
|
'''
|
||||||
def GET(self, *args, **kwargs):
|
def GET(self, *args, **kwargs):
|
||||||
enable_crossdomain()
|
enable_crossdomain()
|
||||||
|
|
||||||
hls = {
|
|
||||||
"args": args,
|
|
||||||
"kwargs": kwargs
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = json.dumps(hls)
|
url = "http://" + "/".join(args);
|
||||||
print ret
|
print "start to proxy url: %s"%url
|
||||||
return ret
|
|
||||||
|
f = None
|
||||||
|
try:
|
||||||
|
f = urllib2.urlopen(url)
|
||||||
|
f.read()
|
||||||
|
except:
|
||||||
|
print "error proxy url: %s"%url
|
||||||
|
finally:
|
||||||
|
if f: f.close()
|
||||||
|
print "completed proxy url: %s"%url
|
||||||
|
return url
|
||||||
|
|
||||||
'''
|
'''
|
||||||
handle the hls requests: hls stream.
|
handle the hls requests: hls stream.
|
||||||
|
|
Loading…
Reference in a new issue