Draft
Conversation
| return | ||
| } | ||
| defer ws.Close() | ||
| if websocket.IsWebSocketUpgrade(r) { |
Member
There was a problem hiding this comment.
I would try to avoid using else.
And since I consider the function ws main usage is to proxify a web socket. I would rewrite this way:
if !websocket.IsWebSocketUpgrade(r) {
// If not a WebSocket upgrade request, handle it as an HTTP request
// We may expect requests like /json/list or /json/version
if err := httpProxy(cdpurl, w, r); err != nil {
slog.Error("httpProxy", slog.Any("err", err))
}
return
}
ws, err := upgrader.Upgrade(w, r, nil)
// ...
Member
krichprollsch
left a comment
There was a problem hiding this comment.
The goal of the PR is to connect to chrome w/o having to copy the unique ws url?
|
|
||
| // Create a new request to the target | ||
| targetURL := httpurl + r.URL.Path | ||
| req, err := http.NewRequest(r.Method, targetURL, tee_body) |
Member
There was a problem hiding this comment.
Suggested change
| req, err := http.NewRequest(r.Method, targetURL, tee_body) | |
| req, err :=http.NewRequestWithContext(r.Context(), r.Method, targetURL, tee_body) |
This way if the caller cancel the original request, you will abort the proxy one.
Author
The goal is to see whether we can get Chrome DevTools working using remote-debugging. With this change Lightpanda shows up in chrome, but the inspect button does not work yet, we do see in this proxy that chrome is sending unimplemented cdp commands. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding a http proxy with similar logging for http requests to
/json/list/json/versionetc.