docstr: Rewrite the ``remote_ip`` and ``protocol`` fields.
code: def _apply_xheaders(self, headers):
      """Rewrite the ``remote_ip`` and ``protocol`` fields."""
      # Squid uses X-Forwarded-For, others use X-Real-Ip
      ip = headers.get("X-Forwarded-For", self.remote_ip)
      # Skip trusted downstream hosts in X-Forwarded-For list
      for ip in (cand.strip() for cand in reversed(ip.split(","))):
          if ip not in self.trusted_downstream:
              break
      ip = headers.get("X-Real-Ip", ip)
      if netutil.is_valid_ip(ip):
          self.remote_ip = ip
      # AWS uses X-Forwarded-Proto
      proto_header = headers.get(
          "X-Scheme", headers.get("X-Forwarded-Proto", self.protocol)
      )
      if proto_header in ("http", "https"):
          self.protocol = proto_header
  
imports: from __future__ import absolute_import, division, print_function
  import socket
  from tornado.escape import native_str
  from tornado.http1connection import HTTP1ServerConnection, HTTP1ConnectionParameters
  from tornado import gen
  from tornado import httputil
  from tornado import iostream
  from tornado import netutil
  from tornado.tcpserver import TCPServer
  from tornado.util import Configurable
label_desc: Use image node_id 3 for calling the _HTTPRequestContext obj's underlying member method code with example usage: obj._apply_xheaders(headers) without return types