Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #174 from vania-pooh/master
Browse files Browse the repository at this point in the history
Logging proxy requests in verbose mode (fixes #173)
  • Loading branch information
vania-pooh authored Feb 20, 2018
2 parents 3677a57 + 9856ac7 commit 9a2235d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/log-files.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ The following statuses are available:
| INVALID_VNC_REQUEST_URL | VNC request URL do not contain enough information to determine upstream host
| INVALID_VIDEO_REQUEST_URL | Video request URL do not contain enough information to determine upstream host
| INVALID_URL | Session ID does not contain information about host where it was created
| PROXYING | Proxying Selenium request (shown in verbose mode only)
| PROXYING_TO_VNC | Starting to proxy VNC traffic
| PROXYING_VIDEO | Starting to proxy video from upstream host
| QUOTA_INFO_REQUESTED | Quota information request arrived
Expand Down
7 changes: 5 additions & 2 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,11 @@ func proxy(r *http.Request) {
r.URL.Host = h.net()
r.URL.Path = proxyPath
fragments := strings.Split(proxyPath, "/")
if r.Method == "DELETE" && len(fragments) == sessPart+1 {
sess := fragments[sessPart]
sess := fragments[sessPart]
if verbose {
log.Printf("[%d] [-] [PROXYING] [-] [%s] [-] [%s] [%s] [-] [%s]\n", id, remote, h.net(), sess, proxyPath)
}
if r.Method == http.MethodDelete && len(fragments) == sessPart+1 {
log.Printf("[%d] [-] [SESSION_DELETED] [-] [%s] [-] [%s] [%s] [-] [-]\n", id, remote, h.net(), sess)
}
return
Expand Down
1 change: 1 addition & 0 deletions proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func init() {
srv = httptest.NewServer(mux())
listen = hostport(srv.URL)
gitRevision = "test-revision"
verbose = true
}

func gridrouter(p string) string {
Expand Down

0 comments on commit 9a2235d

Please sign in to comment.