正在显示
2 个修改的文件
包含
10 行增加
和
7 行删除
@@ -28,7 +28,7 @@ ff_log_dir ./objs; | @@ -28,7 +28,7 @@ ff_log_dir ./objs; | ||
28 | srs_log_tank file; | 28 | srs_log_tank file; |
29 | # the log level, for all log tanks. | 29 | # the log level, for all log tanks. |
30 | # can be: verbose, info, trace, warn, error | 30 | # can be: verbose, info, trace, warn, error |
31 | -# defualt: trace | 31 | +# default: trace |
32 | srs_log_level trace; | 32 | srs_log_level trace; |
33 | # when srs_log_tank is file, specifies the log file. | 33 | # when srs_log_tank is file, specifies the log file. |
34 | # default: ./objs/srs.log | 34 | # default: ./objs/srs.log |
@@ -44,6 +44,10 @@ def trace(msg): | @@ -44,6 +44,10 @@ def trace(msg): | ||
44 | print "[%s][trace] %s"%(date, msg) | 44 | print "[%s][trace] %s"%(date, msg) |
45 | 45 | ||
46 | # enable crossdomain access for js-client | 46 | # enable crossdomain access for js-client |
47 | +# define the following method: | ||
48 | +# def OPTIONS(self, *args, **kwargs) | ||
49 | +# enable_crossdomain() | ||
50 | +# invoke this method to enable js to request crossdomain. | ||
47 | def enable_crossdomain(): | 51 | def enable_crossdomain(): |
48 | cherrypy.response.headers["Access-Control-Allow-Origin"] = "*" | 52 | cherrypy.response.headers["Access-Control-Allow-Origin"] = "*" |
49 | cherrypy.response.headers["Access-Control-Allow-Methods"] = "GET, POST, HEAD, PUT, DELETE" | 53 | cherrypy.response.headers["Access-Control-Allow-Methods"] = "GET, POST, HEAD, PUT, DELETE" |
@@ -121,7 +125,7 @@ class RESTClients(object): | @@ -121,7 +125,7 @@ class RESTClients(object): | ||
121 | 125 | ||
122 | return str(code) | 126 | return str(code) |
123 | 127 | ||
124 | - def OPTIONS(self): | 128 | + def OPTIONS(self, *args, **kwargs): |
125 | enable_crossdomain() | 129 | enable_crossdomain() |
126 | 130 | ||
127 | def __on_connect(self, req): | 131 | def __on_connect(self, req): |
@@ -208,7 +212,7 @@ class RESTStreams(object): | @@ -208,7 +212,7 @@ class RESTStreams(object): | ||
208 | 212 | ||
209 | return str(code) | 213 | return str(code) |
210 | 214 | ||
211 | - def OPTIONS(self): | 215 | + def OPTIONS(self, *args, **kwargs): |
212 | enable_crossdomain() | 216 | enable_crossdomain() |
213 | 217 | ||
214 | def __on_publish(self, req): | 218 | def __on_publish(self, req): |
@@ -295,7 +299,7 @@ class RESTSessions(object): | @@ -295,7 +299,7 @@ class RESTSessions(object): | ||
295 | 299 | ||
296 | return str(code) | 300 | return str(code) |
297 | 301 | ||
298 | - def OPTIONS(self): | 302 | + def OPTIONS(self, *args, **kwargs): |
299 | enable_crossdomain() | 303 | enable_crossdomain() |
300 | 304 | ||
301 | def __on_play(self, req): | 305 | def __on_play(self, req): |
@@ -377,7 +381,7 @@ class RESTServers(object): | @@ -377,7 +381,7 @@ class RESTServers(object): | ||
377 | enable_crossdomain() | 381 | enable_crossdomain() |
378 | raise cherrypy.HTTPError(405, "Not allowed.") | 382 | raise cherrypy.HTTPError(405, "Not allowed.") |
379 | 383 | ||
380 | - def OPTIONS(self, id=None): | 384 | + def OPTIONS(self, *args, **kwargs): |
381 | enable_crossdomain() | 385 | enable_crossdomain() |
382 | 386 | ||
383 | global_chat_id = os.getpid(); | 387 | global_chat_id = os.getpid(); |
@@ -502,8 +506,7 @@ class RESTChats(object): | @@ -502,8 +506,7 @@ class RESTChats(object): | ||
502 | 506 | ||
503 | raise cherrypy.HTTPError(405, "Not allowed.") | 507 | raise cherrypy.HTTPError(405, "Not allowed.") |
504 | 508 | ||
505 | - | ||
506 | - def OPTIONS(self, id=None): | 509 | + def OPTIONS(self, *args, **kwargs): |
507 | enable_crossdomain() | 510 | enable_crossdomain() |
508 | 511 | ||
509 | # HTTP RESTful path. | 512 | # HTTP RESTful path. |
-
请 注册 或 登录 后发表评论