service.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:GAMADV-XTD 作者: taers232c 项目源码 文件源码
def ProcessUrl(service, url, for_proxy=False):
  """Processes a passed URL.  If the URL does not begin with https?, then
  the default value for server is used

  This method is deprecated, use atom.url.parse_url instead.
  """
  if not isinstance(url, atom.url.Url):
    url = atom.url.parse_url(url)

  server = url.host
  ssl = False
  port = 80

  if not server:
    if hasattr(service, 'server'):
      server = service.server
    else:
      server = service
    if not url.protocol and hasattr(service, 'ssl'):
      ssl = service.ssl
    if hasattr(service, 'port'):
      port = service.port
  else:
    if url.protocol == 'https':
      ssl = True
    elif url.protocol == 'http':
      ssl = False
    if url.port:
      port = int(url.port)
    elif port == 80 and ssl:
      port = 443

  return (server, port, ssl, url.get_request_uri())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号