Skip to content

devkdas/Download-files-using-AIOQUIC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 

Repository files navigation

Download files using AIOQUIC

AIOQUIC is a powerful Python library that implements the QUIC transport protocol, including HTTP/3. It empowers you to build efficient QUIC clients and servers for various applications, such as high-performance file transfers.

Prerequisites

The instructions and examples provided have been tested with the following environment:

  • Operating System: Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-113-generic x86_64)
  • Python Version: 3.8.10

While AIOQUIC might work with other setups, these are the specific versions used for testing the examples in this guide.

Method 1: Copying files to htdocs

This method involves copying the files you want to download into the htdocs directory of the AIOQUIC server.

On the server machine:

  1. Copy files to htdocs: Place the files you want to serve into the /root/aioquic/examples/htdocs/ directory. For example:
    cp /var/www/html/test.pdf /root/aioquic/examples/htdocs/
  2. Start the HTTP/3 server: Run the following command to start the AIOQUIC HTTP/3 server:
    python examples/http3_server.py --certificate tests/ssl_cert.pem --private-key tests/ssl_key.pem -v

On the client machine:

  1. Download the file: Use the following command to download the file. The downloaded file will be stored in the /tmp/ directory.
    python examples/http3_client.py --ca-certs tests/pycacert.pem https://server_ip:4433/test.pdf -v --outputdir /tmp/
  2. Verify the download: After successful execution, the file will be available in the specified output directory. You can verify its integrity by comparing the sha256sum of the original and downloaded files.

Method 2: Modifying demo.py

This method involves modifying the demo.py file within the AIOQUIC examples to point to the directory containing your files.

On the server machine:

  1. Edit demo.py: Open the /root/aioquic/examples/demo.py file using a text editor.
  2. Modify STATIC_ROOT: Locate line 20 (approximately) where the STATIC_ROOT variable is defined. Change this variable to point to the absolute path of the directory where your files are located. For example, if your files are in /var/www/html/, change:
    STATIC_ROOT = os.environ.get("STATIC_ROOT", os.path.join(ROOT, "htdocs"))
    to:
    STATIC_ROOT = os.environ.get("STATIC_ROOT", "/var/www/html/")
    (Ensure the path /var/www/html/ correctly reflects the location of your files.)
  3. Start the HTTP/3 server: After saving the changes to demo.py, run the HTTP/3 server:
    python examples/http3_server.py --certificate tests/ssl_cert.pem --private-key tests/ssl_key.pem -v

Known Issues

  • Multiple streams in a single connection: Currently, there is a known limitation where creating multiple streams in a single connection may not work as expected with the provided examples. This might require further investigation or library updates to fully support.

About

Download FIles using AIOQUIC library

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published