OXIESEC PANEL
- Current Dir:
/
/
opt
/
gsutil
/
gslib
/
__pycache__
Server IP: 2a02:4780:11:1594:0:ef5:22d7:a
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/11/2025 08:19:48 AM
rwxr-xr-x
📄
__init__.cpython-39.pyc
2.94 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
__main__.cpython-39.pyc
20.78 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
boto_resumable_upload.cpython-39.pyc
14.86 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
boto_translation.cpython-39.pyc
47.41 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
bucket_listing_ref.cpython-39.pyc
4.23 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
cloud_api.cpython-39.pyc
41.26 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
cloud_api_delegator.cpython-39.pyc
21.69 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
command.cpython-39.pyc
63.61 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
command_argument.cpython-39.pyc
4.25 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
command_runner.cpython-39.pyc
15.75 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
context_config.cpython-39.pyc
6.98 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
cred_types.cpython-39.pyc
851 bytes
02/11/2025 08:19:49 AM
rw-r--r--
📄
cs_api_map.cpython-39.pyc
3.25 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
daisy_chain_wrapper.cpython-39.pyc
8.35 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
devshell_auth_plugin.cpython-39.pyc
1.24 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
discard_messages_queue.cpython-39.pyc
989 bytes
02/11/2025 08:19:49 AM
rw-r--r--
📄
exception.cpython-39.pyc
5.84 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
file_part.cpython-39.pyc
4.04 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
gcs_json_api.cpython-39.pyc
53.37 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
gcs_json_credentials.cpython-39.pyc
13.84 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
gcs_json_media.cpython-39.pyc
19.41 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
help_provider.cpython-39.pyc
2.36 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
iamcredentials_api.cpython-39.pyc
7.62 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
impersonation_credentials.cpython-39.pyc
1.79 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
kms_api.cpython-39.pyc
9.34 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
lazy_wrapper.cpython-39.pyc
2.27 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
metrics.cpython-39.pyc
26.95 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
metrics_tuple.cpython-39.pyc
491 bytes
02/11/2025 08:19:48 AM
rw-r--r--
📄
name_expansion.cpython-39.pyc
20.03 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
no_op_credentials.cpython-39.pyc
936 bytes
02/11/2025 08:19:49 AM
rw-r--r--
📄
parallel_tracker_file.cpython-39.pyc
8.89 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
plurality_checkable_iterator.cpython-39.pyc
3.2 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
progress_callback.cpython-39.pyc
4.35 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
project_id.cpython-39.pyc
841 bytes
02/11/2025 08:19:48 AM
rw-r--r--
📄
pubsub_api.cpython-39.pyc
7.69 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
resumable_streaming_upload.cpython-39.pyc
5.23 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
seek_ahead_thread.cpython-39.pyc
4.09 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
sig_handling.cpython-39.pyc
4.62 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
storage_url.cpython-39.pyc
16.48 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
tab_complete.cpython-39.pyc
10.35 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
thread_message.cpython-39.pyc
12.17 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
tracker_file.cpython-39.pyc
17.01 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
tz_utc.cpython-39.pyc
2.05 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
ui_controller.cpython-39.pyc
30.35 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
wildcard_iterator.cpython-39.pyc
23.94 KB
02/11/2025 08:19:48 AM
rw-r--r--
Editing: boto_resumable_upload.cpython-39.pyc
Close
a +(Wg�b � @ s d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlZddlZddl Z ddl Z ddlZddlm Z ddlmZ dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ejr�e Z!G dd� de"�Z#dS )ap Boto translation layer for resumable uploads. See https://cloud.google.com/storage/docs/resumable-uploads-xml for details. Resumable uploads will retry interrupted uploads, resuming at the byte count completed by the last upload attempt. If too many retries happen with no progress (per configurable num_retries param), the upload will be aborted in the current process. Unlike the boto implementation of resumable upload handler, this class does not directly interact with tracker files. Originally Google wrote and contributed this code to the boto project, then copied that code back into gsutil on the release of gsutil 4.0 which supports both boto and non-boto codepaths for resumable uploads. Any bug fixes made to this file should also be integrated to resumable_upload_handler.py in boto, where applicable. TODO: gsutil-beta: Add a similar comment to the boto code. � )�absolute_import)�print_function)�division)�unicode_literalsN)�urllib)�http_client)�config)� UserAgent)�AWSAuthConnection)�ResumableTransferDisposition)�ResumableUploadException)�InvalidUrlError)�GetMaxRetryDelay)� GetNumRetries)�XML_PROGRESS_CALLBACKS)�UTF8c @ s� e Zd ZdZdZejeej ej fZdZddd�Z dd� Zdd d�Zdd � Zdd� Zddd�Zdd� Zdd� Zdd� Zd dd�Zddefdd�ZdS )!�BotoResumableUploadz3Upload helper class for resumable uploads via boto.i )r ���Nc C s8 |r| � |� nd| _|| _d| _d| _|| _|| _dS )ae Constructor. Instantiate once for each uploaded file. Args: tracker_callback: Callback function that takes a string argument. Used by caller to track this upload across upload interruption. logger: logging.logger instance to use for debug messages. resume_url: If present, attempt to resume the upload at this URL. num_retries: Number of times to retry the upload making no progress. This count resets every time we make progress, so the upload can span many more than this number of retries. Nr )� _SetUploadUrl� upload_url�num_retries�service_has_bytes�upload_start_point�tracker_callback�logger)�selfr r � resume_urlr � r �*/opt/gsutil/gslib/boto_resumable_upload.py�__init__U s zBotoResumableUpload.__init__c C sd t j�|�}|j�� dvs |js,td| ��|| _t� ddd�pD|j| _ d|j|jf | _ d| _dS )z�Saves URL and resets upload state. Called when we start a new resumable upload or get a new tracker URL for the upload. Args: url: URL string for the upload. Raises InvalidUrlError if URL is syntactically invalid. )�http�httpszInvalid upload URL (%s)�Credentials�gs_hostNz%s?%sr )r �parse�urlparse�scheme�lower�netlocr r r �get�upload_url_host�path�query�upload_url_pathr )r �url�parse_resultr r r r r s ��z!BotoResumableUpload._SetUploadUrl�*c C s d||f S )Nzbytes %s/%sr )r � range_specZlength_specr r r �_BuildContentRangeHeader� s z,BotoResumableUpload._BuildContentRangeHeaderc C s. | � d|�dd�}tj|d| j| j|| jd�S )a� Queries service to find out state of given upload. Note that this method really just makes special case use of the fact that the upload service always returns the current start/end state whenever a PUT doesn't complete. Args: conn: HTTPConnection to use for the query. file_length: Total length of the file. Returns: HTTP response from sending request. Raises: ResumableUploadException if problem querying service. r0 �0)� Content-Range�Content-Length�PUT�r+ � auth_path�headers�host)r2 r �make_requestr- r* )r �conn�file_length�put_headersr r r �_QueryServiceState� s ��z&BotoResumableUpload._QueryServiceStatec C s� | � ||�}|jdkr"d|d fS |jdkr>td|j tj��d}|�d�}|r�t�d|�}|r�t|� d��}t|� d ��}d }n| j S |s�tdt|�� � tj��|j dkr�| j� d||� ||fS ) a� Queries service to find out what bytes it currently has. Args: conn: HTTPConnection to use for the query. file_length: Total length of the file. Returns: (service_start, service_end), where the values are inclusive. For example, (0, 2) would mean that the service has bytes 0, 1, *and* 2. Raises: ResumableUploadException if problem querying service. �� r � i4 z2Got non-308 response (%s) from service state queryF�rangezbytes=(\d+)-(\d+)� Tz7Couldn't parse upload service state query response (%s)zService has: Range: %d - %d.)r? �statusr r � START_OVER� getheader�re�search�long�group�SERVICE_HAS_NOTHING�str� getheaders�debugr ) r r<