bazelbuild/bazel-central-registry

[Bug]: `curl` module provides non-functional `http_only` flag

Closed this issue · 1 comments

What happened?

I want to use the curl module with https. But default this module disables https support, but it provides a http_only flag:

+bool_flag(
+ name = "http_only",
+ build_setting_default = True,
+)
+
+config_setting(
+ name = "http_only_setting",
+ flag_values = {":http_only": "true"},
+)

However, the flag has no effect. Whatever its setting https support is disabled.

Version

Development (host) and target OS/architectures:

For now Linux on x86. Eventually I need this to work on Windows, macOS, and many Linux variants.

Output of bazel --version:

bazel 7.2.1

Version of relevant rules from the WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

C++

How to reproduce

This program should work, but returns an error:

#include <iostream>
#include <curl/curl.h>

int main() {
  auto* curl = curl_easy_init();
  if (curl == nullptr) {
    std::cerr << "Error in curl_easy_init()\n";
    return 1;
  }

  curl_easy_setopt(curl, CURLOPT_URL, "https://pki.google.com/roots.pem");
    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);

  auto res = curl_easy_perform(curl);
  if (res != CURLE_OK) {
    std::cerr << "Error in curl_easy_perform()\n";
  }
  curl_easy_cleanup(curl);
}

You also need a BUILD file:

package(default_visibility = ["//visibility:public"])

licenses(["notice"])  # Apache 2.0

cc_binary(
    name = "hello",
    srcs = ["hello.cc"],
    deps = ["@curl//:curl"]
)

And a MODULE.bazel file

module(name = "bzlmod-test")

bazel_dep(name = "curl", version = "8.7.1")

Any other information?

It seems to me that this module should have a dependency on boringssl to get https support. The BCR patch should also add USE_OPENSSL and HAVE_BORINGSSL and probably may another macros to local_defines.

The current issue should be fixed by either:

#2233
#1943
or #1917

the http_only flag is about disabling things like ftp, not about http vs https