Skip to content

Add build flag for disable http transport#7245

Open
mrdimidium wants to merge 1 commit into
libgit2:mainfrom
mrdimidium:main
Open

Add build flag for disable http transport#7245
mrdimidium wants to merge 1 commit into
libgit2:mainfrom
mrdimidium:main

Conversation

@mrdimidium
Copy link
Copy Markdown

Thank you for your library; it's really convenient.

This PR proposes a new build flag that allows you to completely exclude HTTP from the build and get libgit2 without networking.

My application works with already cloned bare repositories, reads only, and doesn't require networking. Although libgit2 includes an HTTP parser, it's a large external C library. I'd like to avoid both the extra size (it's about 25KB in a stripped .so) and the attack surface.

This flag is enabled by default and doesn't change the current behavior. For consistency, I added a field to the feature struct. This affects the public API, but I expect it won't break backwards compatibility with either the API or the ABI.

@ethomson
Copy link
Copy Markdown
Member

ethomson commented May 4, 2026

Yeah, this makes sense. I'd like to think through some of our options a little bit - do we really need USE_HTTP and USE_HTTPS? I wonder how useful http without https is. We have an opportunity to simplify this before v2.0 ships.

Anyway, thanks for the fix and we'll make sure that you can slim down your build 🔜

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.

2 participants