parameters: (cls, headers)
return_statement: return sorted([(k, v) for k, v in headers.items()
                     if k.lower() not in undesirable_keys])
docstring: Removes headers that are known to cause problems during replay.
  
      These headers are removed for the following reasons:
      - accept: Causes problems with www.bing.com. During record, CSS is fetched
                with *. During replay, it's text/css.
      - accept-charset, accept-language, referer: vary between clients.
      - cache-control:  sometimes sent from Chrome with 'max-age=0' as value.
      - connection, method, scheme, url, version: Cause problems with spdy.
      - cookie: Extremely sensitive to request/response order.
      - keep-alive: Doesn't affect the content of the request, only some
        transient state of the transport layer.
      - user-agent: Changes with every Chrome version.
      - proxy-connection: Sent for proxy requests.
      - x-chrome-variations, x-client-data: Unique to each Chrome binary. Used by
        Google to collect statistics about Chrome's enabled features.
  
      Another variant to consider is dropping only the value from the header.
      However, this is particularly bad for the cookie header, because the
      presence of the cookie depends on the responses we've seen when the request
      is made.
  
      Args:
        headers: {header_key: header_value, ...}
  
      Returns:
        [(header_key, header_value), ...]  # (with undesirable headers removed)
docstring_summary: Removes headers that are known to cause problems during replay.
docstring_tokens: Removes headers that are known to cause problems during replay .
function: def _TrimHeaders(cls, headers):
      """Removes headers that are known to cause problems during replay.
  
      These headers are removed for the following reasons:
      - accept: Causes problems with www.bing.com. During record, CSS is fetched
                with *. During replay, it's text/css.
      - accept-charset, accept-language, referer: vary between clients.
      - cache-control:  sometimes sent from Chrome with 'max-age=0' as value.
      - connection, method, scheme, url, version: Cause problems with spdy.
      - cookie: Extremely sensitive to request/response order.
      - keep-alive: Doesn't affect the content of the request, only some
        transient state of the transport layer.
      - user-agent: Changes with every Chrome version.
      - proxy-connection: Sent for proxy requests.
      - x-chrome-variations, x-client-data: Unique to each Chrome binary. Used by
        Google to collect statistics about Chrome's enabled features.
  
      Another variant to consider is dropping only the value from the header.
      However, this is particularly bad for the cookie header, because the
      presence of the cookie depends on the responses we've seen when the request
      is made.
  
      Args:
        headers: {header_key: header_value, ...}
  
      Returns:
        [(header_key, header_value), ...]  # (with undesirable headers removed)
      """
      # TODO(tonyg): Strip sdch from the request headers because we can't
      # guarantee that the dictionary will be recorded, so replay may not work.
      if 'accept-encoding' in headers:
        accept_encoding = headers['accept-encoding']
        accept_encoding = accept_encoding.replace('sdch', '')
        # Strip lzma so Opera's requests matches archives recorded using Chrome.
        accept_encoding = accept_encoding.replace('lzma', '')
        stripped_encodings = [e.strip() for e in accept_encoding.split(',')]
        accept_encoding = ','.join(filter(bool, stripped_encodings))
        headers['accept-encoding'] = accept_encoding
      undesirable_keys = [
          'accept', 'accept-charset', 'accept-language', 'cache-control',
          'connection', 'cookie', 'keep-alive', 'method',
          'referer', 'scheme', 'url', 'version', 'user-agent', 'proxy-connection',
          'x-chrome-variations', 'x-client-data']
      return sorted([(k, v) for k, v in headers.items()
                     if k.lower() not in undesirable_keys])
function_tokens: def _TrimHeaders ( cls , headers ) : # TODO(tonyg): Strip sdch from the request headers because we can't # guarantee that the dictionary will be recorded, so replay may not work. if 'accept-encoding' in headers : accept_encoding = headers [ 'accept-encoding' ] accept_encoding = accept_encoding . replace ( 'sdch' , '' ) # Strip lzma so Opera's requests matches archives recorded using Chrome. accept_encoding = accept_encoding . replace ( 'lzma' , '' ) stripped_encodings = [ e . strip ( ) for e in accept_encoding . split ( ',' ) ] accept_encoding = ',' . join ( filter ( bool , stripped_encodings ) ) headers [ 'accept-encoding' ] = accept_encoding undesirable_keys = [ 'accept' , 'accept-charset' , 'accept-language' , 'cache-control' , 'connection' , 'cookie' , 'keep-alive' , 'method' , 'referer' , 'scheme' , 'url' , 'version' , 'user-agent' , 'proxy-connection' , 'x-chrome-variations' , 'x-client-data' ] return sorted ( [ ( k , v ) for k , v in headers . items ( ) if k . lower ( ) not in undesirable_keys ] )