a
    ze                     @   sJ  d dl Zd dlZd dlZd dlZd dlZd dlZd dlZd dlZ	d dl
mZ g dZdZdZdZdZdZd	Ze ejj d
d ejj D ZdZdZdZedjZedjZ edZ!edZ"h dZ#d?ddZ$G dd dej%j&Z'dd Z(e'fddZ)G dd dej*Z+G dd  d Z,zd dl-Z-W n e.yD   Y n0 G d!d" d"e,Z/e0d" G d#d$ d$e1Z2G d%d& d&e2Z3G d'd( d(e2Z4G d)d* d*e2Z5G d+d, d,e2Z6G d-d. d.e2Z7G d/d0 d0e2Z8G d1d2 d2e2Z9G d3d4 d4e9Z:G d5d6 d6e9Z;G d7d8 d8e9Z<G d9d: d:e2Z=G d;d< d<e2Z>G d=d> d>e?e=Z@e2ZAdS )@    N)urlsplit)HTTPResponseHTTPConnectionHTTPExceptionNotConnectedUnknownProtocolUnknownTransferEncodingUnimplementedFileModeIncompleteRead
InvalidURLImproperConnectionStateCannotSendRequestCannotSendHeaderResponseNotReadyBadStatusLineLineTooLongRemoteDisconnectederror	responsesP   i  ZUNKNOWNZIdlezRequest-startedzRequest-sentc                 C   s   i | ]}||j qS  )phrase).0vr   r   !/usr/lib/python3.9/http/client.py
<dictcomp>k       r   i   i   d   s   [^:\s][^:\r\n]*s   \n(?![ \t])|\r(?![ \t\n])z[ - ]z[ -]>   ZPATCHZPOSTPUTdatac                 C   sj   z|  dW S  tyd } z@t|j|j|j|jd| | |j|j |f d W Y d }~n
d }~0 0 d S )Nlatin-1z`%s (%.20r) is not valid Latin-1. Use %s.encode('utf-8') if you want to send it encoded in UTF-8.)encodeUnicodeEncodeErrorencodingobjectstartendtitle)r   nameerrr   r   r   _encode   s    r*   c                   @   s   e Zd Zdd ZdS )HTTPMessagec                 C   sj   |  d }t|}g }d}|  D ]@}|d |   |krBd}n|d d  sVd}|r$|| q$|S )N:r      )lowerlenkeysisspaceappend)selfr(   nZlstZhitliner   r   r   getallmatchingheaders   s    
z!HTTPMessage.getallmatchingheadersN)__name__
__module____qualname__r6   r   r   r   r   r+      s   r+   c                 C   sX   g }|  td }t|tkr&td|| t|tkrHtdt |dv rqTq|S )Nr-   header linezgot more than %d headers   
   
r   )readline_MAXLINEr/   r   r2   _MAXHEADERSr   )fpheadersr5   r   r   r   _read_headers   s    
rC   c                 C   s,   t | }d|d}tjj|d|S )Nr   
iso-8859-1)_class)rC   joindecodeemailparserZParserZparsestr)rA   rE   rB   Zhstringr   r   r   parse_headers   s    
rJ   c                       s  e Zd Zd@ddZdd Zdd Zd	d
 Zdd Z fddZ fddZ	dd Z
dd ZdAddZdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& ZdBd(d)ZdCd*d+ZdD fd,d-	Zd.d/ Zd0d1 Zd2d3 ZdEd4d5Zd6d7 Zd8d9 Zd:d; Zd<d= Zd>d? Z   Z!S )Fr   r   Nc                 C   sR   | d| _|| _|| _d  | _| _t| _t| _t| _	t| _
t| _t| _t| _d S )Nrb)makefilerA   
debuglevel_methodrB   msg_UNKNOWNversionstatusreasonchunked
chunk_leftlength
will_close)r3   sockrM   methodurlr   r   r   __init__   s    zHTTPResponse.__init__c                 C   s  t | jtd d}t|tkr*td| jdkrBtdt| |sNt	dz|
d d\}}}W nB ty   z|
d d\}}d}W n ty   d}Y n0 Y n0 |d	s|   t|z$t|}|d
k s|dkrt|W n ty   t|Y n0 |||fS )Nr-   rD   zstatus liner   zreply:z-Remote end closed connection without response    zHTTP/r   i  )strrA   r>   r?   r/   r   rM   printreprr   split
ValueError
startswith_close_connr   int)r3   r5   rQ   rR   rS   r   r   r   _read_status  s2    

zHTTPResponse._read_statusc           	      C   s  | j d urd S |  \}}}|tkr&qHt| j}| jdkrDtd| ~q| | _| _|	 | _
|dv rnd| _n|drd| _nt|t| j | _ | _| jdkr| j  D ]\}}td|d | q| j d	}|r| d
krd| _d | _nd| _|  | _d | _| j d}|r`| js`zt|| _W n tyJ   d | _Y n0 | jdk rfd | _nd | _|tks|tksd|  krdk sn | jdkrd| _| js| js| jd u rd| _d S )Nr   zheaders:)zHTTP/1.0zHTTP/0.9
   zHTTP/1.   header:r,   transfer-encodingrT   TFcontent-lengthr      HEAD)rB   rf   ZCONTINUErC   rA   rM   r_   coderR   striprS   rQ   rc   r   rJ   rO   itemsgetr.   rT   rU   _check_closerW   rV   re   rb   Z
NO_CONTENTZNOT_MODIFIEDrN   )	r3   rQ   rR   rS   Zskipped_headershdrvalZtr_encrV   r   r   r   begin9  sd    









zHTTPResponse.beginc                 C   sv   | j d}| jdkr.|r*d| v r*dS dS | j dr>dS |rRd| v rRdS | j d}|rrd| v rrdS dS )N
connectionrh   closeTFz
keep-alivezproxy-connection)rB   rq   rQ   r.   )r3   connZpconnr   r   r   rr     s    
zHTTPResponse._check_closec                 C   s   | j }d | _ |  d S N)rA   rw   )r3   rA   r   r   r   rd     s    zHTTPResponse._close_connc                    s2   zt    W | jr.|   n| jr,|   0 d S ry   )superrw   rA   rd   r3   	__class__r   r   rw     s    
zHTTPResponse.closec                    s   t    | jr| j  d S ry   )rz   flushrA   r{   r|   r   r   r~     s    
zHTTPResponse.flushc                 C   s   dS )NTr   r{   r   r   r   readable  s    zHTTPResponse.readablec                 C   s
   | j d u S ry   )rA   r{   r   r   r   isclosed  s    zHTTPResponse.isclosedc                 C   s   | j d u rdS | jdkr$|   dS |d urRt|}| |}t|d |  S | jr`|  S | j	d u rv| j 
 }n4z| | j	}W n ty   |    Y n0 d| _	|   |S d S )Nr   rm   r   )rA   rN   rd   	bytearrayreadinto
memoryviewtobytesrT   _readall_chunkedrV   read
_safe_readr
   )r3   amtbr4   sr   r   r   r     s*    



zHTTPResponse.readc                 C   s   | j d u rdS | jdkr$|   dS | jr4| |S | jd ur^t|| jkr^t|d| j }| j |}|s||r||   n&| jd ur|  j|8  _| js|   |S )Nr   rm   )	rA   rN   rd   rT   _readinto_chunkedrV   r/   r   r   )r3   r   r4   r   r   r   r     s$    





zHTTPResponse.readintoc                 C   sp   | j td }t|tkr$td|d}|dkrB|d | }zt|dW S  tyj   |    Y n0 d S )Nr-   z
chunk size   ;r      )	rA   r>   r?   r/   r   findre   rb   rd   )r3   r5   ir   r   r   _read_next_chunk_size  s    
z"HTTPResponse._read_next_chunk_sizec                 C   s:   | j td }t|tkr$td|s*q6|dv r q6q d S )Nr-   ztrailer liner;   )rA   r>   r?   r/   r   r3   r5   r   r   r   _read_and_discard_trailer  s    z&HTTPResponse._read_and_discard_trailerc                 C   sj   | j }|sf|d ur| d z|  }W n tyB   tdY n0 |dkr`|   |   d }|| _ |S )Nr\   r   r   )rU   r   r   rb   r
   r   rd   )r3   rU   r   r   r   _get_chunk_left$  s    
zHTTPResponse._get_chunk_leftc                 C   s`   g }z6|   }|d u rq0|| | d| _qd|W S  tyZ   td|Y n0 d S Nr   r   )r   r2   r   rU   rF   r
   )r3   valuerU   r   r   r   r   <  s    zHTTPResponse._readall_chunkedc                 C   s   d}t |}zv|  }|d u r$|W S t||krN| |}|| | _|| W S |d | }| |}||d  }||7 }d| _qW n& ty   tt|d| Y n0 d S Nr   )r   r   r/   _safe_readintorU   r
   bytes)r3   r   total_bytesmvbrU   r4   temp_mvbr   r   r   r   J  s"    



zHTTPResponse._readinto_chunkedc                 C   sT   g }|dkrJ| j t|t}|s2td|||| |t|8 }qd|S r   )rA   r   min	MAXAMOUNTr
   rF   r2   r/   )r3   r   r   chunkr   r   r   r   b  s    
zHTTPResponse._safe_readc                 C   s   d}t |}|t|k r~tt|k r>|dt }| j|}n| j|}|shtt|d| t|||d  }||7 }q|S r   )r   r/   r   rA   r   r
   r   )r3   r   r   r   r   r4   r   r   r   r   y  s    
zHTTPResponse._safe_readintoc                 C   s   | j d u s| jdkrdS | jr(| |S | jd urJ|dk sD|| jkrJ| j}| j |}|sh|rh|   n| jd ur|  jt|8  _|S Nrm   r   r   )rA   rN   rT   _read1_chunkedrV   read1rd   r/   )r3   r4   resultr   r   r   r     s    


zHTTPResponse.read1c                 C   s4   | j d u s| jdkrdS | jr(| |S | j |S )Nrm   r   )rA   rN   rT   _peek_chunkedpeek)r3   r4   r   r   r   r     s
    
zHTTPResponse.peekc                    s   | j d u s| jdkrdS | jr*t |S | jd urL|dk sF|| jkrL| j}| j |}|sj|rj|   n| jd ur|  jt|8  _|S r   )rA   rN   rT   rz   r>   rV   rd   r/   )r3   limitr   r|   r   r   r>     s    

zHTTPResponse.readlinec                 C   sd   |   }|d u s|dkrdS d|  kr0|ks6n |}| j|}|  jt|8  _|s`td|S r   )r   rA   r   rU   r/   r
   )r3   r4   rU   r   r   r   r   r     s    zHTTPResponse._read1_chunkedc                 C   sB   z|   }W n ty    Y dS 0 |d u r.dS | j|d | S )Nr   )r   r
   rA   r   )r3   r4   rU   r   r   r   r     s    zHTTPResponse._peek_chunkedc                 C   s
   | j  S ry   )rA   filenor{   r   r   r   r     s    zHTTPResponse.filenoc                 C   sF   | j d u rt | j |p|}t|ts4t|ds8|S d|S d S )N__iter__z, )rB   r   Zget_all
isinstancer^   hasattrrF   )r3   r(   defaultrB   r   r   r   	getheader  s    
zHTTPResponse.getheaderc                 C   s   | j d u rt t| j  S ry   )rB   r   listrp   r{   r   r   r   
getheaders  s    
zHTTPResponse.getheadersc                 C   s   | S ry   r   r{   r   r   r   r     s    zHTTPResponse.__iter__c                 C   s   | j S ry   )rB   r{   r   r   r   info  s    zHTTPResponse.infoc                 C   s   | j S ry   )rZ   r{   r   r   r   geturl  s    
zHTTPResponse.geturlc                 C   s   | j S ry   )rR   r{   r   r   r   getcode  s    zHTTPResponse.getcode)r   NN)N)r   )r   )r   )N)"r7   r8   r9   r[   rf   ru   rr   rd   rw   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r>   r   r   r   r   r   r   r   r   r   __classcell__r   r   r|   r   r      s<   	
!H

 "

	
r   c                   @   s
  e Zd ZdZdZeZeZdZ	dZ
edd Zedd Zd	ejd	d
fddZd7ddZdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zd8d d!Zd9d"d#Zd$d% Zd&d' Zd(d) Zd*d+ Zd,d- Z d:dd.d/d0Z!d	i fdd.d1d2Z"d3d4 Z#d5d6 Z$d	S );r   rh   zHTTP/1.1r-   r   c                 C   s   t | tjS ry   )r   io
TextIOBase)streamr   r   r   
_is_textIO%  s    zHTTPConnection._is_textIOc                 C   sd   | d u r|  tv rdS d S t| dr*d S zt| }|jW S  tyL   Y n0 t| tr`t| S d S )Nr   r   )	upper_METHODS_EXPECTING_BODYr   r   nbytes	TypeErrorr   r^   r/   )bodyrY   mvr   r   r   _get_content_length+  s    

z"HTTPConnection._get_content_lengthN    c                 C   sn   || _ || _|| _d | _g | _d | _t| _d | _d | _	d | _
i | _| ||\| _| _| | j tj| _d S ry   )timeoutsource_address	blocksizerX   _buffer_HTTPConnection__response_CS_IDLE_HTTPConnection__staterN   _tunnel_host_tunnel_port_tunnel_headers_get_hostporthostport_validate_hostsocketcreate_connection_create_connection)r3   r   r   r   r   r   r   r   r   r[   K  s    zHTTPConnection.__init__c                 C   s<   | j rtd| ||\| _| _|r.|| _n
| j  d S )Nz.Can't set up tunnel for established connection)rX   RuntimeErrorr   r   r   r   clear)r3   r   r   rB   r   r   r   
set_tunnela  s    zHTTPConnection.set_tunnelc                 C   s   |d u r| d}| d}||krzt||d d  }W nF ty   ||d d  dkrf| j}ntd||d d   Y n0 |d | }n| j}|r|d dkr|d dkr|dd }||fS )	Nr,   ]r-   r]   znonnumeric port: '%s'r   [r   )rfindre   rb   default_portr   )r3   r   r   r   jr   r   r   r   y  s    

zHTTPConnection._get_hostportc                 C   s
   || _ d S ry   )rM   )r3   levelr   r   r   set_debuglevel  s    zHTTPConnection.set_debuglevelc           
      C   s
  d| j d| jf }|g}| j D ]$\}}|| d| dd q&|d | d| ~| j| j	| j
d}| \}}}|tjjkr|   td	| d
|  |jtd }	t|	tkrtd|	sq|	dv rq| jdkrtd|	  qd S )Ns   CONNECT %s:%d HTTP/1.0
asciiz: 
r    r<   r   rY   zTunnel connection failed:  r-   r:   r;   r   ri   )r   r!   r   r   rp   r2   sendrF   response_classrX   rN   rf   http
HTTPStatusZOKrw   OSErrorro   rA   r>   r?   r/   r   rM   r_   rG   )
r3   connectrB   headerr   responserQ   rn   messager5   r   r   r   _tunnel  s.    

zHTTPConnection._tunnelc              
   C   sz   |  | j| jf| j| j| _z| jtjtj	d W n2 t
yf } z|jtjkrR W Y d }~n
d }~0 0 | jrv|   d S )Nr-   )r   r   r   r   r   rX   
setsockoptr   IPPROTO_TCPTCP_NODELAYr   errnoZENOPROTOOPTr   r   r3   er   r   r   r     s    zHTTPConnection.connectc                 C   sZ   t | _z4| j}|r d | _|  W | j}|rVd | _|  n| j}|rTd | _|  0 d S ry   )r   r   rX   rw   r   )r3   rX   r   r   r   r   rw     s    

zHTTPConnection.closec                 C   s  | j d u r | jr|   nt | jdkr8tdt| t|dr| jdkrTtd | |}|rt| jdkrttd |	| j
}|sq|r|d}| j | qtd S z| j | W nH ty   t|tjjr|D ]}| j | qntdt| Y n0 d S )Nr   zsend:r   sendIng a read()ableencoding file using iso-8859-1rD   z9data should be a bytes-like object or an iterable, got %r)rX   	auto_openr   r   rM   r_   r`   r   r   r   r   r!   sendallr   r   collectionsabcIterabletype)r3   r   r!   	datablockdr   r   r   r     s8    






zHTTPConnection.sendc                 C   s   | j | d S ry   )r   r2   )r3   r   r   r   r   _output  s    zHTTPConnection._outputc                 c   s^   | j dkrtd | |}|r2| j dkr2td || j}|sDqZ|rR|d}|V  q2d S )Nr   r   r   rD   )rM   r_   r   r   r   r!   )r3   r   r!   r   r   r   r   _read_readable  s    


zHTTPConnection._read_readableFc                 C   s  | j d d| j }| j d d = | | |d urt|drN| |}nVzt| W nB ty   zt|}W n" ty   tdt	| Y n0 Y n0 |f}|D ]R}|s| j
dkrtd q|r| jdkrt|dd	d
| d }| | q|r| jdkr| d d S )N)r   r   r<   r   zAmessage_body should be a bytes-like object or an iterable, got %rr   zZero length chunk ignoredrh   Xr   r   s   0

)r   extendrF   r   r   r   r   r   iterr   rM   r_   	_http_vsnr/   r!   )r3   message_bodyencode_chunkedrO   chunksr   r   r   r   _send_output  s:    



zHTTPConnection._send_outputc                 C   s  | j r| j  rd | _ | jtkr(t| _n
t| j| | || _|pHd}| | d||| j	f }| 
| | | jdkr|sd}|drt|\}}}}}|rz|d}W n ty   |d}Y n0 | d| n| jr| j}	| j}
n| j}	| j}
z|	d}W n ty0   |	d}Y n0 |	d	d
krNd| d }|
| jkrh| d| n|d}| dd||
f  |s| dd n d S )N/z%s %s %srh   r]   r   r   ZidnaZHostr,   r      [   ]z%s:%szAccept-Encodingidentity)r   r   r   r   _CS_REQ_STARTEDr   _validate_methodrN   _validate_path_http_vsn_strr   _encode_requestr   rc   r   r!   r"   	putheaderr   r   r   r   r   r   rG   )r3   rY   rZ   	skip_hostskip_accept_encodingrequestnetlocnilZ
netloc_encr   r   Zhost_encr   r   r   
putrequest=  sP    






zHTTPConnection.putrequestc                 C   s
   | dS )Nr   )r!   )r3   r  r   r   r   r
    s    zHTTPConnection._encode_requestc                 C   s,   t |}|r(td|d| dd S )Nz)method can't contain control characters.  (found at least ))$_contains_disallowed_method_pchar_researchrb   group)r3   rY   matchr   r   r   r    s    
zHTTPConnection._validate_methodc                 C   s,   t |}|r(td|d| dd S Nz&URL can't contain control characters. r  r  !_contains_disallowed_url_pchar_rer  r   r  )r3   rZ   r  r   r   r   r    s
    

zHTTPConnection._validate_pathc                 C   s,   t |}|r(td|d| dd S r  r  )r3   r   r  r   r   r   r     s
    

zHTTPConnection._validate_hostc                 G   s   | j tkrt t|dr$|d}t|s:td|f t|}t|D ]\\}}t|drl|d||< nt	|t
rt|d||< t|| rJtd|| f qJd|}|d | }| | d S )Nr!   r   zInvalid header name %rr    zInvalid header value %rs   
	s   : )r   r  r   r   r!   _is_legal_header_namerb   r   	enumerater   re   r^   _is_illegal_header_valuerF   r   )r3   r   valuesr   Z	one_valuer   r   r   r   r    s"    





zHTTPConnection.putheaderr   c                C   s*   | j tkrt| _ nt | j||d d S )Nr  )r   r  _CS_REQ_SENTr   r  )r3   r   r   r   r   r   
endheaders  s    
zHTTPConnection.endheadersc                C   s   |  ||||| d S ry   )_send_request)r3   rY   rZ   r   rB   r   r   r   r   r    s    zHTTPConnection.requestc                 C   s   t dd |D }i }d|v r&d|d< d|v r6d|d< | j||fi | d|vrd	|vrd
}| ||}|d u r|d ur| jdkrtd|  d}| dd q| dt| nd
}| D ]\}	}
| |	|
 qt|trt	|d}| j
||d d S )Nc                 s   s   | ]}|  V  qd S ry   )r.   )r   kr   r   r   	<genexpr>	  r   z/HTTPConnection._send_request.<locals>.<genexpr>r   r-   r  zaccept-encodingr  rk   rj   Fr   zUnable to determine size of %rTzTransfer-EncodingrT   zContent-Lengthr   r  )	frozensetr  r   rM   r_   r  r^   rp   r   r*   r!  )r3   rY   rZ   r   rB   r   Zheader_namesZskipsZcontent_lengthrs   r   r   r   r   r"    s0    	


zHTTPConnection._send_requestc                 C   s   | j r| j  rd | _ | jtks&| j r0t| j| jdkrR| j| j| j| jd}n| j| j| jd}zLz|	  W n t
y   |    Y n0 t| _|jr|   n|| _ |W S    |   Y n0 d S )Nr   r   )r   r   r   r   r   rM   r   rX   rN   ru   ConnectionErrorrw   r   rW   )r3   r   r   r   r   getresponse5  s.    


zHTTPConnection.getresponse)NN)NF)FF)N)%r7   r8   r9   r   r	  r   r   	HTTP_PORTr   r   rM   staticmethodr   r   r   _GLOBAL_DEFAULT_TIMEOUTr[   r   r   r   r   r   rw   r   r   r   r  r  r
  r  r  r   r  r!  r  r"  r'  r   r   r   r   r     sJ   



 &
6  
	.r   c                       sD   e Zd ZeZdddejdfdddd fddZ fddZ  Z	S )HTTPSConnectionNr   )contextcheck_hostnamer   c                   s   t t| j|||||	d |d us2|d us2|d urHdd l}
|
dtd || _|| _|d u rtt	 }|j
d urtd|_
|jtjk}|d u r|j}|r|std|s|r||| |j
d urd|_
|| _|d ur|| j_d S )N)r   r   zTkey_file, cert_file and check_hostname are deprecated, use a custom context instead.r\   TzMcheck_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED)rz   r+  r[   warningswarnDeprecationWarningkey_file	cert_filesslZ_create_default_https_contextZpost_handshake_authZverify_modeZ	CERT_NONEr-  rb   Zload_cert_chain_context)r3   r   r   r1  r2  r   r   r,  r-  r   r.  Zwill_verifyr|   r   r   r[     s:    

zHTTPSConnection.__init__c                    s6   t    | jr| j}n| j}| jj| j|d| _d S )N)server_hostname)rz   r   r   r   r4  Zwrap_socketrX   )r3   r5  r|   r   r   r     s    

zHTTPSConnection.connect)
r7   r8   r9   
HTTPS_PORTr   r   r*  r[   r   r   r   r   r|   r   r+  y  s   $r+  c                   @   s   e Zd ZdS )r   Nr7   r8   r9   r   r   r   r   r     s   r   c                   @   s   e Zd ZdS )r   Nr7  r   r   r   r   r     s   r   c                   @   s   e Zd ZdS )r   Nr7  r   r   r   r   r     s   r   c                   @   s   e Zd Zdd ZdS )r   c                 C   s   |f| _ || _d S ry   )argsrQ   )r3   rQ   r   r   r   r[     s    zUnknownProtocol.__init__Nr7   r8   r9   r[   r   r   r   r   r     s   r   c                   @   s   e Zd ZdS )r   Nr7  r   r   r   r   r     s   r   c                   @   s   e Zd ZdS )r	   Nr7  r   r   r   r   r	     s   r	   c                   @   s$   e Zd ZdddZdd ZejZdS )r
   Nc                 C   s   |f| _ || _|| _d S ry   )r8  partialexpected)r3   r:  r;  r   r   r   r[     s    zIncompleteRead.__init__c                 C   s2   | j d urd| j  }nd}d| jjt| j|f S )Nz, %i more expectedr]   z%s(%i bytes read%s))r;  r}   r7   r/   r:  r   r   r   r   __repr__  s    

zIncompleteRead.__repr__)N)r7   r8   r9   r[   r<  r$   __str__r   r   r   r   r
     s   
r
   c                   @   s   e Zd ZdS )r   Nr7  r   r   r   r   r     s   r   c                   @   s   e Zd ZdS )r   Nr7  r   r   r   r   r     s   r   c                   @   s   e Zd ZdS )r   Nr7  r   r   r   r   r     s   r   c                   @   s   e Zd ZdS )r   Nr7  r   r   r   r   r     s   r   c                   @   s   e Zd Zdd ZdS )r   c                 C   s   |st |}|f| _|| _d S ry   )r`   r8  r5   r   r   r   r   r[     s    zBadStatusLine.__init__Nr9  r   r   r   r   r     s   r   c                   @   s   e Zd Zdd ZdS )r   c                 C   s   t | dt|f  d S )Nz&got more than %d bytes when reading %s)r   r[   r?   )r3   Z	line_typer   r   r   r[     s    zLineTooLong.__init__Nr9  r   r   r   r   r     s   r   c                   @   s   e Zd Zdd ZdS )r   c                 O   s(   t | d tj| g|R i | d S )Nr]   )r   r[   ConnectionResetError)r3   poskwr   r   r   r[     s    zRemoteDisconnected.__init__Nr9  r   r   r   r   r     s   r   )r   )BZemail.parserrH   Zemail.messager   r   r   rer   collections.abcr   urllib.parser   __all__r(  r6  rP   r   r  r   globalsupdater   __members__r  r   r   r?   r@   compile	fullmatchr  r  r  r  r  r   r*   r   ZMessager+   rC   rJ   BufferedIOBaser   r   r3  ImportErrorr+  r2   	Exceptionr   r   r   r   r   r	   r
   r   r   r   r   r   r   r>  r   r   r   r   r   r   <module>G   sx   


    .    ]8
