Skip to content

Conversation

dwisiswant0
Copy link
Member

@dwisiswant0 dwisiswant0 commented Apr 2, 2025

with httpx

Proposed changes

Fixes #6109

Proof

image

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Summary by CodeRabbit

  • New Features
    • Improved proxy configuration handling to dynamically apply either HTTP or SOCKS proxy settings based on user inputs.

with httpx

Signed-off-by: Dwi Siswanto <[email protected]>
@auto-assign auto-assign bot requested a review from dogancanbakir April 2, 2025 10:31
Copy link
Contributor

coderabbitai bot commented Apr 2, 2025

Walkthrough

This change adds conditional logic in the HTTP input initialization. When setting up httpxOptions, the code now checks if r.options.AliveHttpProxy has a value. If it does, that value is used for httpxOptions.Proxy. If not, and r.options.AliveSocksProxy is provided, the socks proxy value is used instead. No exported or public entities were altered.

Changes

File(s) Change Summary
internal/runner/inputs.go Added conditional checks to assign httpxOptions.Proxy from either r.options.AliveHttpProxy or r.options.AliveSocksProxy based on their availability.

Sequence Diagram(s)

sequenceDiagram
    participant R as Runner
    participant O as Options (r.options)
    participant H as httpxOptions

    R->>O: Check AliveHttpProxy
    alt AliveHttpProxy is not empty
       O-->>H: Assign AliveHttpProxy to httpxOptions.Proxy
    else AliveHttpProxy is empty & AliveSocksProxy is not empty
       O-->>H: Assign AliveSocksProxy to httpxOptions.Proxy
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
[#6109] Ensure the provided SOCKS proxy (-p socks5://) is used when HTTP proxy is absent

Poem

Hopping through lines of code so light,
I check each proxy with all my might.
HTTP or SOCKS, I choose the right track,
Leaping over bugs without looking back.
A joyful bunny nods at the fix in sight!
(_/) 🥕 Hop on, my friends!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7c87285 and 1133c8b.

📒 Files selected for processing (1)
  • internal/runner/inputs.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Tests (macOS-latest)
  • GitHub Check: Tests (windows-latest)
  • GitHub Check: Tests (ubuntu-latest)
🔇 Additional comments (1)
internal/runner/inputs.go (1)

34-38:

❓ Verification inconclusive

Implementation looks good for respecting alive proxy settings.

The conditional logic correctly implements the feature to respect alive proxy settings when probing, with HTTP proxy taking precedence over SOCKS proxy. This aligns well with the PR objective to "respect alive proxy to probe" and addresses issue #6109.

A minor improvement suggestion would be to add validation for the proxy URL format to prevent potential issues with invalid URLs, but this may already be handled by the httpx client.


🏁 Script executed:

#!/bin/bash
# Check if there are tests that verify this functionality as mentioned in the PR checklist
fd -e go -e yaml -e yml -H "test|Test" | xargs grep -l "AliveHttpProxy\|AliveSocksProxy"

Length of output: 90


Review Comment Verified: Ensure Manual Testing of Proxy Settings

The implementation in internal/runner/inputs.go (lines 34–38) correctly prioritizes the HTTP proxy over the SOCKS proxy when both are set. However, the search for tests verifying the AliveHttpProxy and AliveSocksProxy behavior returned no results. Without automated tests confirming this functionality, please manually verify that these proxy options work as expected in practice. Additionally, consider whether proxy URL format validation should be implemented here or if it's already adequately handled by the httpx client.

  • Validation: Confirm that invalid proxy URLs are either caught here or by the downstream httpx client.
  • Testing: Manually verify or add tests to cover the behavior related to the AliveHttpProxy and AliveSocksProxy options.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@dwisiswant0 dwisiswant0 requested a review from ehsandeep April 3, 2025 10:29
@ehsandeep ehsandeep requested review from Mzack9999 and removed request for dogancanbakir April 6, 2025 11:39
Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

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

lgtm - I think we might need to add actions/setup-python@v5 to the functional tests GitHub action

@dwisiswant0
Copy link
Member Author

#6154

@dogancanbakir dogancanbakir requested a review from Mzack9999 April 8, 2025 09:08
Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

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

lgtm - The OSX functional test issue still persist but seems unrelated to the changes. Tracked it at #6157

@Mzack9999 Mzack9999 merged commit 0884549 into dev Apr 8, 2025
19 of 20 checks passed
@Mzack9999 Mzack9999 deleted the dwisiswant0/feat/runner/respect-proxy-to-probe-with-httpx branch April 8, 2025 12:24
@geeknik
Copy link
Contributor

geeknik commented May 9, 2025

🎉

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.

[BUG] -p socks5:// is not respected by httpx when using the -l flag
4 participants