관리-도구
편집 파일: http_channel.cpython-39.opt-1.pyc
a ��g� � @ sn d dl Zd dlZd dlZd dlZddlmZmZ ddlm Z m Z mZmZm Z mZ e�e�ZG dd� de�ZdS )� N� )�AsyncChannel�ChannelError)� JsonObject�get_dict�get_int� get_object�get_str�typecheckedc @ s� e Zd ZdZeejjee d�dd��Z ee ejjd�dd��Zeejjdd d �dd��Z eejjeed eejjd�dd��Ze d d�dd�Zd S )�HttpChannelzhttp-stream2)�response�binary�returnc s0 ddh� |s� � ddh� � fdd�| �� D �S )NZ ConnectionzTransfer-EncodingzContent-LengthZRangec s i | ]\}}|� vr||�qS � r )�.0�key�value��remover �A/usr/lib/python3.9/site-packages/cockpit/channels/http_channel.py� <dictcomp>) � z+HttpChannel.get_headers.<locals>.<dictcomp>)�updateZ getheaders)r r r r r �get_headers s zHttpChannel.get_headers)�optionsr c C s* t | dd�}t| dd �}t | dd �}t| dd �}|d urL|d urLtddd��|d u rh|d u rhtdd d��|d ur�|d ur�tdd d��|d u�rt|dd �}|d ur�t |dd �}|d ur�tj|d �}q�tjt |d�d�}nt�� }d|v �r|d �sd|_tjj|_ t jj|||d�S t jj ||d�S d S )N�addressZ localhostZtls�unix�port�protocol-errorz#TLS on Unix socket is not supported��messagez&no "port" or "unix" option for channelz-cannot specify both "port" and "unix" options� authority�data)Zcadata�file)ZcafileZvalidateF)r �context)r )r r r r �sslZcreate_default_contextZcheck_hostnameZ VerifyModeZ CERT_NONEZverify_mode�http�clientZHTTPSConnection�HTTPConnection)r Zopt_addressZopt_tls�opt_unixZopt_portr! r"