fix: preserve query parameters in --cdp HTTP URLs (#982)
When --cdp is given an HTTP/HTTPS URL (e.g. http://host:5095?mode=Hello), resolve_cdp_url extracts host and port for CDP discovery but discards the query string. The discovered WebSocket URL therefore never includes the user's original query parameters, breaking relay servers that depend on them. Thread the original query string through discover_cdp_url and append it to the final WebSocket URL after host/port rewriting. WebSocket URLs (ws://, wss://) are already passed through unchanged and are unaffected. Fixes #977 Co-authored-by: ctate <366502+ctate@users.noreply.github.com>
This commit is contained in:
@@ -514,7 +514,7 @@ pub async fn auto_connect_cdp() -> Result<String, String> {
|
||||
for dir in &user_data_dirs {
|
||||
if let Some((port, ws_path)) = read_devtools_active_port(dir) {
|
||||
// Try HTTP endpoint first (pre-M144)
|
||||
if let Ok(ws_url) = discover_cdp_url("127.0.0.1", port).await {
|
||||
if let Ok(ws_url) = discover_cdp_url("127.0.0.1", port, None).await {
|
||||
return Ok(ws_url);
|
||||
}
|
||||
// M144+: direct WebSocket — verify the port is actually listening
|
||||
@@ -533,7 +533,7 @@ pub async fn auto_connect_cdp() -> Result<String, String> {
|
||||
|
||||
// Fallback: probe common ports
|
||||
for port in [9222u16, 9229] {
|
||||
if let Ok(ws_url) = discover_cdp_url("127.0.0.1", port).await {
|
||||
if let Ok(ws_url) = discover_cdp_url("127.0.0.1", port, None).await {
|
||||
return Ok(ws_url);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user