Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: add new backend HttpProxy #974

Merged
merged 1 commit into from
Feb 6, 2023
Merged

Commits on Feb 5, 2023

  1. storage: add new backend HttpProxy

    This patch adds a new storage backend `HttpProxy` which can access blobs through a http proxy server.
    
    The http proxy server can be local (using unix socket) or remote (using `https://` or using `http://`).
    
    `HttpProxy` uses two API endpoints to access the blobs:
    - `HEAD /path/to/blobs` to get the blob size
    - `GET /path/to/blobs` to read the blob
    
    The http proxy server should respect [the `Range` header](https://www.rfc-editor.org/rfc/rfc9110.html#name-range) to compute the offset and length of the blob.
    
    The example config files for this new backend may be:
    
    ```jsonc
    // for remote usage
    {
      "backend": {
        "type": "http-proxy",
        "config": {
          "addr": "http://127.0.0.1:9977",
          "path": "/namespace/<repo>/blobs"
        }
      }
    }
    ```
    
    or
    
    ```jsonc
    // for local unix socket
    {
      "backend": {
        "type": "http-proxy",
        "config": {
          "addr": "/path/to/unix/socket/file"
        }
      }
    }
    ```
    
    There is also a test in `http_proxy.rs` to make sure `HttpProxy` works well, which setups a simple http server and generates a `HttpProxy` backend to get contents from the server.
    
    Signed-off-by: Nan Li <loheagn@icloud.com>
    loheagn committed Feb 5, 2023
    Configuration menu
    Copy the full SHA
    7aac412 View commit details
    Browse the repository at this point in the history