From 17befc441887d8eee3bab260c7c89238b5203ceb Mon Sep 17 00:00:00 2001 From: Bradley Kemp Date: Mon, 24 Jun 2019 14:44:54 +0100 Subject: [PATCH] Add support for gzip compression (#20) * Add support for gzip compression * Changelog entry --- CHANGELOG.md | 7 ++++--- grpc-proxy/proxy.go | 1 + integration_test/test.sh | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39573fd..ef16571 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,13 @@ ## v0.1.3 (unreleased) * Added proxy loop detection so that misconfiguration (e.g. missing/incorrent `--destination` flag) do not cause infinite loops and connection exhaustion. +* `grpc-proxy` now supports requests with gzip compression (however requests are still proxied uncompressed). ## [v0.1.2](https://github.com/bradleyjkemp/grpc-tools/releases/tag/v0.1.2) -* Fixed bug where the `--destination` flag didn't work (issue [#13](https://github.com/bradleyjkemp/grpc-tools/issues/13)) +* Fixed bug where the `--destination` flag didn't work (issue [#13](https://github.com/bradleyjkemp/grpc-tools/issues/13)). ## [v0.1.1](https://github.com/bradleyjkemp/grpc-tools/releases/tag/v0.1.1) -* Added automatic detection of mkcert certificates in the current directory +* Added automatic detection of mkcert certificates in the current directory. ## [v0.1.0](https://github.com/bradleyjkemp/grpc-tools/releases/tag/v0.1.0) -* Added grpc-dump, grpc-fixture, grpc-replay +* Added grpc-dump, grpc-fixture, grpc-replay. diff --git a/grpc-proxy/proxy.go b/grpc-proxy/proxy.go index fd62871..d66f31e 100644 --- a/grpc-proxy/proxy.go +++ b/grpc-proxy/proxy.go @@ -11,6 +11,7 @@ import ( "github.com/improbable-eng/grpc-web/go/grpcweb" "github.com/sirupsen/logrus" "google.golang.org/grpc" + _ "google.golang.org/grpc/encoding/gzip" "net" ) diff --git a/integration_test/test.sh b/integration_test/test.sh index 23bfe28..ed6656f 100755 --- a/integration_test/test.sh +++ b/integration_test/test.sh @@ -59,7 +59,7 @@ all_proxy=http://localhost:16354 curl -X POST 'https://grpc-web.github.io:1234/g -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9' -H 'custom-header-1: value1' \ -H 'User-Agent: Mozilla/5.0' -H 'Content-Type: application/grpc-web+proto' -H 'Accept: */*' \ -H 'X-Grpc-Web: 1' -H 'Cache-Control: no-cache' -H 'Referer: http://localhost:8081/echotest.html' \ - -H 'Connection: keep-alive' + -H 'Connection: keep-alive' -H 'grpc-encoding: gzip' kill ${fixturePID} kill ${dumpPID}