Skip to content

Commit 1c6e284

Browse files
refactor: minor improvement
1 parent 6f1939d commit 1c6e284

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main, yevhenii/proxy-v2 ]
5+
branches: [ main ]
66
pull_request:
77
branches: [ main ]
88

proxy/proxy.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ func (p *Server) forwardRequest(conn net.Conn, req *http.Request, https bool) {
309309
// Copy response back to client
310310
err = resp.Write(conn)
311311
if err != nil {
312-
p.logger.Error("Failed to forward HTTPS request", "error", err)
312+
p.logger.Error("Failed to forward HTTP request", "error", err)
313313
return
314314
}
315315

@@ -354,8 +354,14 @@ For more help: https://github.com/coder/boundary
354354
resp.Body = io.NopCloser(strings.NewReader(body))
355355
resp.ContentLength = int64(len(body))
356356

357-
// Write to connection
358-
resp.Write(conn)
357+
// Copy response back to client
358+
err := resp.Write(conn)
359+
if err != nil {
360+
p.logger.Error("Failed to write blocker response", "error", err)
361+
return
362+
}
363+
364+
p.logger.Debug("Successfully wrote to connection")
359365
}
360366

361367
// connectionWrapper lets us "unread" the peeked byte

0 commit comments

Comments
 (0)