o
    i                     @   s^   d dl mZ d dlmZ d dlmZ G dd dZG dd deejZG dd	 d	eej	Z	dS )
    N)parse)	containerc                       sJ   e Zd ZdZdZd fdd	Zedd Zdi fdd	 fd
dZ  Z	S )HTTPConnectionMixinz
    Mixin for HTTP(S) connections for performing internal adjustments.

    Currently this mixin performs the following adjustments:
    - insert a base path to requested URLs
    - update headers with container info
    /Fc                    s"   t | j|}t j||||dS )N)	skip_hostskip_accept_encoding)r   urljoin
_base_pathsuper
putrequest)selfmethodurlr   r   	__class__ I/home/ubuntu/.local/lib/python3.10/site-packages/ddtrace/internal/http.pyr      s   zHTTPConnectionMixin.putrequestc                 O   s$   | dd }| |i |}||_|S )N	base_path)popr	   )clsargskwargsr   objr   r   r   with_base_path   s   z"HTTPConnectionMixin.with_base_pathN)encode_chunkedc                   s(   |  }t| t j|||||dS )N)bodyheadersr   )copyr   update_headersr
   request)r   r   r   r   r   r   _headersr   r   r   r       s   
zHTTPConnectionMixin.request)FF)
__name__
__module____qualname____doc__r	   r   classmethodr   r   __classcell__r   r   r   r   r      s    
 r   c                   @      e Zd ZdZdS )HTTPConnectionzM
    httplib.HTTPConnection wrapper to add a base path to requested URLs
    Nr!   r"   r#   r$   r   r   r   r   r(   (       r(   c                   @   r'   )HTTPSConnectionzN
    httplib.HTTPSConnection wrapper to add a base path to requested URLs
    Nr)   r   r   r   r   r+   .   r*   r+   )
http.clientclienthttpliburllibr   ddtrace.internal.runtimer   r   r(   r+   r   r   r   r   <module>   s    !