def proxy(request, host, port, path):
  """
  Proxies an HTTP request by fetching the data
  and re-writing links.
  """
  port = int(port)

  if not check_host_port(host, port):
    raise MessageException(
      ("%s:%d is not whitelisted for reverse proxying, nor a daemon that Cluster Health " +
       "is aware of.  Contact your administrator.") % (host, port))
  if not check_blacklist(host, port, path):
    raise MessageException(
      "Access to %s:%s%s is blocked. Contact your administrator." % (host, port, path))

  # The tuple here is: (scheme, netloc, path, params, query, fragment).
  # We don't support params or fragment.
  url = urlunparse(("http", "%s:%d" % (host,port), 
                    path, 
                    None, 
                    request.META.get("QUERY_STRING"), 
                    None))
  LOGGER.info(url % "Retrieving %s.")
  if request.method == 'POST':
    post_data = request.POST.urlencode()
  else:
    post_data = None
  data = urlopen(url, data=post_data)
  content_type = data.headers.get("content-type", "text/plain")
  if not re.match(r'^text/html\s*(?:;.*)?$', content_type):
    resp_text = data.read(1024*1024) # read 1MB
  else:
    resp_text = _rewrite_links(data)
  request.path = _reverse(host, port, path)
  return HttpResponse(resp_text, content_type=data.headers.get("content-type"))
dataset/ETHPy150Open cloudera/hue/apps/proxy/src/proxy/views.py/proxy/swapped operands of `%`