Skip to content

feat: support HTTPs PROXY URL#11708

Draft
itzwam wants to merge 1 commit intofluent:masterfrom
itzwam:feat/httpsProxy
Draft

feat: support HTTPs PROXY URL#11708
itzwam wants to merge 1 commit intofluent:masterfrom
itzwam:feat/httpsProxy

Conversation

@itzwam
Copy link
Copy Markdown

@itzwam itzwam commented Apr 14, 2026

Summary by CodeRabbit

Bug Fixes

  • Extended proxy URL support to accept both HTTP and HTTPS protocols. Users can now configure secure proxy connections using HTTPS endpoints, enabling encrypted data transmission for improved security.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

📝 Walkthrough

Walkthrough

The flb_utils_proxy_url_split function's protocol validation was extended to accept both http and https schemes. The function's documentation and error handling were updated to reflect this expanded support, while maintaining the existing control-flow structure and rejecting unsupported protocols.

Changes

Cohort / File(s) Summary
Proxy URL Protocol Support
src/flb_utils.c
Extended protocol validation to accept both http and https schemes; updated documentation comment from "only HTTP is supported" to "only HTTP(s) is supported"; adjusted error messages accordingly.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 A proxy that hops both ways secure,
HTTP and HTTPS, a dual tour!
The protocol validation now sees clear,
Two schemes embraced, safe and dear. 🔒

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: support HTTPs PROXY URL' accurately reflects the main change: adding HTTPS support to the proxy URL functionality alongside HTTP.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 97b4b82acd

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/flb_utils.c
if (strcmp(protocol, "http") != 0) {
flb_error("only HTTP proxy is supported.");
/* Only HTTP(s) proxy is supported for now. */
if (strcmp(protocol, "http") != 0 && strcmp(protocol, "https") != 0) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject https proxy scheme until transport handles it

flb_utils_proxy_url_split now accepts https URLs, but the parsed protocol is not used downstream: flb_upstream_create frees proxy_protocol and still builds a normal TCP upstream (src/flb_upstream.c, proxy setup block), then flb_io_net_connect sends CONNECT over that plain socket before any TLS handshake (src/flb_io.c and flb_http_client_proxy_connect). For real HTTPS proxies (TLS to proxy), this path fails because the proxy expects TLS first, so this commit advertises support that does not actually work for the new accepted input.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/flb_utils.c (1)

1873-1873: Use next-line opening brace for if in C files.

This changed if uses same-line {; the repo rule asks for next-line opening braces.

As per coding guidelines, **/*.{c,cpp}: Always use braces for if/else/while/do blocks, with opening braces on the next line.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/flb_utils.c` at line 1873, The if statement checking the protocol (if
(strcmp(protocol, "http") != 0 && strcmp(protocol, "https") != 0)) uses a
same-line opening brace; change it to use the repo's next-line brace style by
moving the opening '{' to the line after the if condition (preserve the
condition and surrounding whitespace and keep the existing body unchanged) so
the block follows the required next-line opening-brace convention.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/flb_utils.c`:
- Around line 1872-1874: The proxy URL parsing currently accepts "https" but
still defaults an absent port to "80"; update the proxy-port fallback logic so
that when the parsed protocol variable equals "https" (strcmp(protocol, "https")
== 0) the default port is set to "443" and when it equals "http" it remains
"80"; locate the code paths that assign the literal "80" (the port fallback
branches where port is set when missing) and change them to choose "443" for
protocol == "https" and "80" otherwise, and ensure any log messages (e.g.,
flb_error usage around unsupported protocols) and comments reflect HTTPS default
port 443.

---

Nitpick comments:
In `@src/flb_utils.c`:
- Line 1873: The if statement checking the protocol (if (strcmp(protocol,
"http") != 0 && strcmp(protocol, "https") != 0)) uses a same-line opening brace;
change it to use the repo's next-line brace style by moving the opening '{' to
the line after the if condition (preserve the condition and surrounding
whitespace and keep the existing body unchanged) so the block follows the
required next-line opening-brace convention.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9021c247-e72b-44ad-9033-97acc1955d9d

📥 Commits

Reviewing files that changed from the base of the PR and between 63ed88e and 97b4b82.

📒 Files selected for processing (1)
  • src/flb_utils.c

Comment thread src/flb_utils.c
Comment on lines +1872 to +1874
/* Only HTTP(s) proxy is supported for now. */
if (strcmp(protocol, "http") != 0 && strcmp(protocol, "https") != 0) {
flb_error("only HTTP(s) proxy is supported.");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

HTTPS support is incomplete when proxy port is omitted.

After allowing https:// at Lines 1872-1874, the no-port paths still default to "80" (Lines 1952 and 1991).
https://proxy.example.com should default to 443, otherwise this path will fail or connect incorrectly.

🔧 Proposed fix
@@
-        else if (*(end + 1) == '\0') {
-            port = flb_strdup("80");
+        else if (*(end + 1) == '\0') {
+            if (strcmp(protocol, "https") == 0) {
+                port = flb_strdup("443");
+            }
+            else {
+                port = flb_strdup("80");
+            }
             if (!port) {
                 flb_errno();
                 goto error;
             }
         }
@@
-            port = flb_strdup("80");
+            if (strcmp(protocol, "https") == 0) {
+                port = flb_strdup("443");
+            }
+            else {
+                port = flb_strdup("80");
+            }
             if (!port) {
                 flb_errno();
                 goto error;
             }
         }

Also applies to: 1951-1953, 1991-1993

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/flb_utils.c` around lines 1872 - 1874, The proxy URL parsing currently
accepts "https" but still defaults an absent port to "80"; update the proxy-port
fallback logic so that when the parsed protocol variable equals "https"
(strcmp(protocol, "https") == 0) the default port is set to "443" and when it
equals "http" it remains "80"; locate the code paths that assign the literal
"80" (the port fallback branches where port is set when missing) and change them
to choose "443" for protocol == "https" and "80" otherwise, and ensure any log
messages (e.g., flb_error usage around unsupported protocols) and comments
reflect HTTPS default port 443.

@itzwam itzwam marked this pull request as draft April 14, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant