| Server IP : 162.144.4.212 / Your IP : 216.73.216.108 Web Server : Apache System : Linux gator2125.hostgator.com 5.14.0-162.23.1.9991722448259.nf.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 31 18:11:45 UTC 2024 x86_64 User : cozeellc ( 2980) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/libexec/oracle-cloud-agent/plugins/osms/falcon/ |
Upload File : |
a
[��fS � @ s. d Z ddlZdd� ZG dd� dej�ZeZdS )z Utilities for the Request class.� Nc s � fdd�}t |�S )a Create a read-only header property.
Args:
wsgi_name (str): Case-sensitive name of the header as it would
appear in the WSGI environ ``dict`` (i.e., 'HTTP_*')
Returns:
A property instance than can be assigned to a class variable.
c s* z| j � pd W S ty$ Y d S 0 d S �N)�env�KeyError��self�� wsgi_name� �z/sparta/input/_build_configuration/image_build+validate/lib/bmcenv/lib64/python3.9/site-packages/falcon/request_helpers.py�fget s zheader_property.<locals>.fget)�property)r r r r r
�header_property s r
c @ sr e Zd ZdZdd� Zdd� Zdd� ZeZdd � Zd
d� Z dd
� Z
dd� Zddd�Zddd�Z
ddd�Zdd� ZdS )�
BoundedStreama� Wrap *wsgi.input* streams to make them more robust.
``socket._fileobject`` and ``io.BufferedReader`` are sometimes used
to implement *wsgi.input*. However, app developers are often burned
by the fact that the `read()` method for these objects block
indefinitely if either no size is passed, or a size greater than
the request's content length is passed to the method.
This class normalizes *wsgi.input* behavior between WSGI servers
by implementing non-blocking behavior for the cases mentioned
above.
Args:
stream: Instance of ``socket._fileobject`` from
``environ['wsgi.input']``
stream_len: Expected content length of the stream.
c C s || _ || _| j| _d S r )�stream�
stream_len�_bytes_remaining)r r r r r r
�__init__= s zBoundedStream.__init__c C s | S r r r r r r
�__iter__C s zBoundedStream.__iter__c C s
t | j�S r )�nextr r r r r
�__next__F s zBoundedStream.__next__c C s6 |du s|dks|| j kr | j }| j |8 _ ||�S )ay Helper function for proxing reads to the underlying stream.
Args:
size (int): Maximum number of bytes to read. Will be
coerced, if None or -1, to the number of remaining bytes
in the stream. Will likewise be coerced if greater than
the number of remaining bytes, to avoid making a
blocking call to the wrapped stream.
target (callable): Once `size` has been fixed up, this function
will be called to actually do the work.
Returns:
bytes: Data read from the stream, as returned by `target`.
N���)r )r �size�targetr r r
�_readK s zBoundedStream._readc C s dS )zAlways returns ``True``.Tr r r r r
�readablee s zBoundedStream.readablec C s dS �zAlways returns ``False``.Fr r r r r
�seekablei s zBoundedStream.seekablec C s dS r r r r r r
� writeablem s zBoundedStream.writeableNc C s | � || jj�S )z�Read from the stream.
Args:
size (int): Maximum number of bytes/characters to read.
Defaults to reading until EOF.
Returns:
bytes: Data read from the stream.
)r r �read)r r r r r
r q s zBoundedStream.readc C s | � || jj�S )z�Read a line from the stream.
Args:
limit (int): Maximum number of bytes/characters to read.
Defaults to reading until EOF.
Returns:
bytes: Data read from the stream.
)r r �readline)r �limitr r r
r s zBoundedStream.readlinec C s | � || jj�S )z�Read lines from the stream.
Args:
hint (int): Maximum number of bytes/characters to read.
Defaults to reading until EOF.
Returns:
bytes: Data read from the stream.
)r r � readlines)r �hintr r r
r! � s zBoundedStream.readlinesc C s t d��dS )z0Always raises IOError; writing is not supported.zStream is not writeableN)�IOError)r �datar r r
�write� s zBoundedStream.write)N)N)N)�__name__�
__module__�__qualname__�__doc__r r r r r r r r r r r! r% r r r r
r ) s
r )r) �ior
�IOBaser �Bodyr r r r
�<module> s y