GAE的urlfetch不适用于端口10312?

时间:2011-09-21 20:34:48

标签: google-app-engine urlfetch

我收到以下警告:

WARNING  2011-09-21 20:25:32,259 urlfetch_stub.py] urlfetch received https://z_c
l.zzzz.me:10312/zzzz/Data/0 ; port 10312 is not allowed in production!

无论如何在生产中使用该端口?

1 个答案:

答案 0 :(得分:2)

更新您的SDK版本!
自2010年3月(SDK 1.3.2)以来,GAE允许更广泛的端口: 80-90 440-450 1024-65535

他们转自:

PORTS_ALLOWED_IN_PRODUCTION = (
    None, '80', '443', '4443', '8080', '8081', '8082', '8083', '8084', '8085',
    '8086', '8087', '8088', '8089', '8188', '8444', '8990')
if port not in PORTS_ALLOWED_IN_PRODUCTION:
        logging.warning(
          'urlfetch received %s ; port %s is not allowed in production!' %
          (url, port))

为:

def _IsAllowedPort(port):
  if port is None:
    return True
  try:
    port = int(port)
  except ValueError, e:
    return False
  if ((port >= 80 and port <= 90) or
      (port >= 440 and port <= 450) or
      port >= 1024):
    return True
  return False

if not _IsAllowedPort(port):
        logging.warning(
          'urlfetch received %s ; port %s is not allowed in production!' %
          (url, port))