Skip to content

Commit

Permalink
Merge pull request #2746 from mjameswh/http-connect-proxy-early-serve…
Browse files Browse the repository at this point in the history
…r-packet

HTTP CONNECT: handle early server packets
  • Loading branch information
murgatroid99 committed Jun 18, 2024
2 parents a4c2106 + 3e89fdc commit d90ca24
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/grpc-js/src/http_proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ export function getProxiedConnection(
' through proxy ' +
proxyAddressString
);
// The HTTP client may have already read a few bytes of the proxied
// connection. If that's the case, put them back into the socket.
// See https://github.com/grpc/grpc-node/issues/2744.
if (head.length > 0) {
socket.unshift(head);
}
if ('secureContext' in connectionOptions) {
/* The proxy is connecting to a TLS server, so upgrade this socket
* connection to a TLS connection.
Expand Down

0 comments on commit d90ca24

Please sign in to comment.