
    kj                          d dl Z  G d d      Zy)    Nc                       e Zd ZdZd Zd Zy)
DisableH2Ca  
    We currently only support HTTP/2 over a TLS connection.

    Some clients try to upgrade a connection from HTTP/1.1 to h2c. We need to
    remove those headers to avoid protocol errors if one endpoints suddenly
    starts sending HTTP/2 frames.

    Some clients might use HTTP/2 Prior Knowledge to directly initiate a session
    by sending the connection preface. We just kill those flows.
    c                 p   |j                   j                  j                  dd      dk(  rt        j                  d       |j                   j                  d= d|j                   j                  v r|j                   j                  d= d|j                   j                  v r|j                   j                  d= |j                   j
                  dk(  xr4 |j                   j                  dk(  xr |j                   j                  d	k(  }|r2|j                  r|j                          t        j                  d
       y y )Nupgrade h2czPHTTP/2 cleartext connections (h2c upgrade requests) are currently not supported.
connectionzhttp2-settingsPRI*zHTTP/2.0zOInitiating HTTP/2 connections with prior knowledge are currently not supported.)
requestheadersgetloggingwarningmethodpathhttp_versionkillablekill)selffis_connection_prefaces      e/home/ubuntu/.cache/pipx/cdb5059130eadca/lib/python3.12/site-packages/mitmproxy/addons/disable_h2c.pyprocess_flowzDisableH2C.process_flow   s    99  B/58OOb 		!!),qyy000II%%l3199#4#44II%%&67 II% 5		#%5		&&*4 	
 !zzOOa !    c                 &    | j                  |       y )N)r   )r   r   s     r   r   zDisableH2C.request)   s    !r   N)__name__
__module____qualname____doc__r   r    r   r   r   r      s    	2r   r   )r   r   r!   r   r   <module>r"      s    & &r   