Skip to content

Commit

Permalink
add public limit notification.
Browse files Browse the repository at this point in the history
  • Loading branch information
xxnet committed Mar 14, 2015
1 parent f67b970 commit 1224c43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion goagent/3.1.38/local/proxy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ talkx.l.google.com = gws
.gstatic.com = gws
.appspot.com = gws
;.android.com = gws
.youtube.com = gws
;.youtube.com = gws
.ggpht.com = gws
.2mdn.net = gws
.googlesyndication.com = gws
Expand Down
16 changes: 12 additions & 4 deletions goagent/3.1.38/local/proxy_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,15 +487,23 @@ def do_AGENT(self):
else:
continue

# public gae appid deny this site request.
if response.app_status == 403:
logging.warn("public appid deny this host:%s", host)
html = generate_message_html('403 public Appid deny this host proxy', u'共用appid因为资源有限,限制观看视频和文件下载等消耗资源过多的访问,请使用自己的appid')
self.wfile.write(b'HTTP/1.0 403\r\nContent-Type: text/html\r\n\r\n' + html.encode('utf-8'))
response.close()
return

# appid not exists, try remove it from appid
if response.app_status == 404:
logging.warning('APPID %r not exists, remove it.', response.ssl_sock.appid)
appid_manager.report_not_exist(response.ssl_sock.appid)
appid = appid_manager.get_appid()

if not appid:
html = generate_message_html('404 No usable Appid Exists', 'No usable Appid Exists, please add appid')
self.wfile.write(b'HTTP/1.0 502\r\nContent-Type: text/html\r\n\r\n' + html.encode('utf-8'))
html = generate_message_html('404 No usable Appid Exists', u'没有可用appid了,请配置可用的appid')
self.wfile.write(b'HTTP/1.0 404\r\nContent-Type: text/html\r\n\r\n' + html.encode('utf-8'))
response.close()
return
else:
Expand All @@ -508,8 +516,8 @@ def do_AGENT(self):
appid = appid_manager.get_appid()

if not appid:
html = generate_message_html('404 No usable Appid Exists', 'No usable Appid Exists, please add appid')
self.wfile.write(b'HTTP/1.0 502\r\nContent-Type: text/html\r\n\r\n' + html.encode('utf-8'))
html = generate_message_html('503 No usable Appid Exists', u'appid流量不足,请增加appid')
self.wfile.write(b'HTTP/1.0 503\r\nContent-Type: text/html\r\n\r\n' + html.encode('utf-8'))
response.close()
return
else:
Expand Down

0 comments on commit 1224c43

Please sign in to comment.