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

Download the database over HTTPS #843

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Download the database over HTTPS #843

wants to merge 7 commits into from

Conversation

Shnatsel
Copy link
Member

Part of #750

Not actually wired up to cargo audit yet, just shows what the approach might look like

const ADVISORY_DB_DIRECTORY: &str = "advisory-db";

/// The default URL from which the DB is downloaded
const DEFAULT_DB_URL: &str = "https://github.com/zip-rs/zip/archive/refs/heads/master.zip";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems bogus in multiple ways... just for testing I guess?

FWIW the tarball seems a lot smaller:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh there's a .tar.gz? Nice, I'll use that instead!

I already have the streaming .tar.gz extraction code too, so no need for even the cursor.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything else I should fix here other than switching from .zip to .tar.gz?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far otherwise. Hopefully etags work for those resources.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well they do provide an etag in the response, so the worst case is we don't rely on the 304 and instead check the etag in the response headers and stop there. So no worries there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants