Skip to content

Remove Curl dependency#766

Merged
YanVugenfirer merged 1 commit into
HCK-CI:masterfrom
kostyanf14:no-curl
Oct 15, 2025
Merged

Remove Curl dependency#766
YanVugenfirer merged 1 commit into
HCK-CI:masterfrom
kostyanf14:no-curl

Conversation

@kostyanf14
Copy link
Copy Markdown
Contributor

Use build-in HTTPClient instead

Use build-in HTTPClient instead

Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @kostyanf14, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on enhancing the project's maintainability and reducing its external footprint by eliminating the curb gem dependency. All HTTP download operations have been migrated to use Ruby's native HTTPClient, which simplifies the dependency graph, removes the need for system-level libcurl installations in CI/CD, and leverages standard library capabilities for network interactions.

Highlights

  • Dependency Removal: The curb gem and its underlying libcurl dependency have been completely removed from the project.
  • HTTP Client Migration: The download functionality in lib/auxiliary/downloader.rb has been refactored to use Ruby's built-in HTTPClient instead of Curl::Easy.
  • Build Process Streamlining: The GitHub Actions workflow no longer includes a step to install libcurl-devel, simplifying the CI/CD environment.
  • Code Modernization: The download method now performs a HEAD request to retrieve file size and status, and streams the download in chunks, providing more robust error handling and progress reporting.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully removes the curb dependency and its native extension libcurl, replacing it with the pure Ruby httpclient gem. This is a great improvement for simplifying the setup. The implementation in downloader.rb is functional, but I've suggested a more efficient and robust approach that uses a single GET request instead of separate HEAD and GET requests to download files.

Comment on lines +48 to 58
head = client.head(url, follow_redirect: true)
raise(AutoHCKError, "Download failed with code #{head.status}") unless head.status == 200

total_size = head.headers['Content-Length'].to_i

File.open(path, 'wb') do |file|
client.get(url, follow_redirect: true) do |chunk|
file.write(chunk)
log_progress(total_size, file.size)
end
end
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The current implementation makes two separate HTTP requests: a HEAD to get the file size, followed by a GET to download the content. This is inefficient and may not be robust, as some servers might not support HEAD requests for all URLs.

A more efficient approach is to use a single GET request. You can obtain the response headers (including Content-Length) from the response object and then stream the body from the same response. This avoids the extra network round-trip.

      response = client.get(url, follow_redirect: true)
      raise(AutoHCKError, "Download failed with code #{response.status}") unless response.status == 200

      total_size = response.headers['Content-Length'].to_i

      File.open(path, 'wb') do |file|
        # Read in 16KB chunks.
        while (chunk = response.content.read(16 * 1024))
          file.write(chunk)
          log_progress(total_size, file.size)
        end
      end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is incorrect, get will download the file as well.

@YanVugenfirer YanVugenfirer merged commit 5e1fae5 into HCK-CI:master Oct 15, 2025
6 checks passed
@kostyanf14 kostyanf14 deleted the no-curl branch October 15, 2025 08:15
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