Skip to content

Bug/root path not correct#17

Merged
svnoak merged 2 commits intomainfrom
bug/root-path-not-correct
Jul 14, 2025
Merged

Bug/root path not correct#17
svnoak merged 2 commits intomainfrom
bug/root-path-not-correct

Conversation

@svnoak
Copy link
Owner

@svnoak svnoak commented Jul 14, 2025

This PR solves #15 where forwarding to root with trailing slash would not work.

These changes remove some duplicate code, and move the logic of the path splitting into the forward path method instead.

It also refines the way users add paths a bit for better usability.

@svnoak svnoak requested a review from Copilot July 14, 2025 20:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR consolidates the two previous forwarding routes into a single catch-all handler, centralizes path-splitting logic, and refines the client’s CLI prompts and status output.

  • Replace separate / :client_id and / :client_id/*path routes with one /*path route in main.rs
  • Merge forward_handler_no_path and forward_handler_with_path into a single forward_handler with path parsing
  • Enhance client UX by extracting a status printer, updating allowed-paths prompts, and cleaning up imports/formatting

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
server/src/main.rs Swapped two specific routes for a single wildcard route
server/src/forwarding.rs Combined two handlers into forward_handler, added path extraction and validation
client/src/websocket_handler.rs Consolidated import formatting
client/src/main.rs Added print_tunnel_status, moved HTTP client setup earlier
client/src/http_handler.rs Tidied up header insertion formatting and base64 encoding call
client/src/config.rs Overhauled allowed-paths input flow and improved error messages
Comments suppressed due to low confidence (2)

server/src/forwarding.rs:122

  • The new segment-splitting logic in forward_handler should have unit tests covering cases like empty path, missing client_id, and multi-segment paths to verify correct behavior.
    let mut segments = path.splitn(2, '/');

server/src/forwarding.rs:134

  • The call to handle_forwarding_request returns a future but isn’t awaited, which will cause a compilation error. Append .await to invoke the handler and return its response.
    handle_forwarding_request(

@svnoak svnoak merged commit c16e27c into main Jul 14, 2025
2 checks passed
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