Commit Graph

64 Commits

Author SHA1 Message Date
mmukhi 8214c28a62 Make IO Buffer size configurable. (#1544)
* Make IO Buffer size configurable.

* Fixing typo
2017-09-28 14:11:14 -07:00
mmukhi 894322f00c Dedicated goroutine for writing. (#1498) 2017-09-14 13:44:14 -07:00
dfawley 69abda08b5 stats: add methods to allow setting grpc-trace-bin and grpc-tags-bin headers (#1404)
This is in preparation for preventing any user-supplied metadata starting with "grpc-", which is reserved.

* stats: add methods to allow setting grpc-trace-bin and grpc-tags-bin headers

Pick these up in grpc's transport when sending and fill them when receiving.

* Add tags/trace to metadata and tests for that behavior

This is temporary to maintain compatibility and provide a migration strategy.
2017-08-24 10:00:40 -07:00
dfawley 971efedc20 Revert "Make all "grpc-" metadata field names reserved (#1391)" (#1400)
This reverts commit 3ddcdc268d.
2017-07-28 11:04:27 -07:00
dfawley 3ddcdc268d Make all "grpc-" metadata field names reserved (#1391) 2017-07-26 10:50:56 -07:00
Menghan Li d6723916d2 Use log severity and verbosity level (#1340)
- All logs use 1 severity level instead of printf
 - All transport logs only go to verbose level 2+
 - The default logger only log errors and verbosity level 1
 - Add environment variable GRPC_GO_LOG_SEVERITY_LEVEL and GRPC_GO_LOG_VERBOSITY_LEVEL to set severity or verbosity levels for the default logger
2017-07-13 12:10:19 -07:00
Jan Tattermusch ddbf6c46a6 autofix license notice 2017-06-08 14:42:19 +02:00
MakMukhi 3dd14ccc71 Http status to grpc status conversion (#1195) 2017-05-11 09:40:46 -07:00
dfawley 4d1604cc04 Use unpadded base64 encoding for binary metadata headers; handle padded or unpadded input (#1209) 2017-04-28 11:32:27 -07:00
dfawley b610ffd3f8 Never encode binary metadata within the metadata map (#1188)
This change ensures consistency for the user when accessing metadata values:
they are never encoded except when sent on the wire.  Previously, they would
appear encoded to client code, but not to server code.  As such, this
represents a behavior change, but one unlikely to affect user code, as it's
unusual to inspect the metadata after setting it.
2017-04-28 10:56:58 -07:00
apolcyn ff17eeb5f6 opt in to frame reuse on the framer to reduce garbage (#1096) 2017-04-10 15:44:10 -07:00
dfawley b47cbd158b Use proto import from google.golang.org instead of github.com (#1176) 2017-04-10 10:15:59 -07:00
dfawley 1d27587e10 Change status package to deal with concrete types instead of interfaces (#1171) 2017-04-06 11:41:07 -07:00
dfawley b507112439 Add status package for reporting gRPC status and errors (#1156)
When an error implemented by the status package is returned from a service
handler, the server will transmit a rich status message in the
"grpc-status-details-bin" trailing metadata field if any detailed data is
attached to the error.  Client-side, we will decode them if present in the
server's response and return them to the user code performing the RPC.

This is backward compatible with the existing errors supported by the grpc
package.  However, the grpc.Errorf, grpc.Code and grpc.ErrorDesc functions for
managing errors are now deprecated; status.Errorf and status.Status type
asserions should be used instead.
2017-04-05 10:35:40 -07:00
Menghan Li b982c1caa6 Behavior change: do not strip out gRPC user-agent (#1158) 2017-04-03 12:31:31 -07:00
Menghan Li 14a6be430b Add grpc.Version string and use it in the UA (#1144) 2017-03-24 11:29:02 -07:00
Qi Zhao 6d7caeea7c Merge pull request #911 from menghanl/grpc_message_decode
Use strconv.ParseUint in decodeGrpcMessage to support non-ascii desc
2016-09-27 17:26:54 -07:00
iamqizhao b531d0156b fix the flakiness of TestStreamingRPCTimeoutServerError 2016-09-27 17:07:14 -07:00
Menghan Li 86ef444b35 Use strconv.ParseUint in decodeGrpcMessage to support non-ascii desc 2016-09-27 11:52:31 -07:00
Menghan Li 086edd7dfd Unexport transport.StreamErrorf and transport.ConnectionErrorf 2016-09-02 14:15:27 -07:00
iamqizhao faa2ad14db prepare GA announcement 2016-08-18 17:09:26 -07:00
Menghan Li 22c41c77e6 Change function names 2016-07-27 15:46:40 -07:00
Menghan Li d87c63e172 Move grpcMessageDecode() to http_util 2016-07-27 15:46:40 -07:00
Menghan Li 2350c4144c Merge pull request #610 from peter-edge/percent_encoding
Do percent encoding matching grpc-java for the statusDesc
2016-07-21 11:36:23 -07:00
Menghan Li 5d7ad14de4 Rename isGrpcContentType to validContentType 2016-06-07 17:46:06 -07:00
Menghan Li 7ef3c44f78 Move isGrpcContentType to http_util.go and fix processHeaderField 2016-06-07 14:29:37 -07:00
Michal Witkowski eec6ad361b authority: address comments from PR 2016-05-25 11:38:25 +01:00
Michal Witkowski 1ef2c5293f fix `TestCompressOK` and client reserved HTTP header handling 2016-05-17 14:35:18 +01:00
Michal Witkowski e54a726f0a make :authority propagate to MD 2016-05-16 18:10:00 +01:00
iamqizhao 2f0d12ea11 Added the unmapped http2 error and fixed a related bug in RST_STREAM handling. 2016-03-29 11:07:22 -07:00
Peter Edge 2c4841f18d Do percent encoding matching grpc-java for the statusDesc.
Signed-off-by: Peter Edge <peter.edge@gmail.com>
2016-03-28 23:54:47 +02:00
Menghan Li 71e3dbec56 Use ErrorDetail() to provide better error msg for malformed HTTP2 2016-03-28 11:34:29 -07:00
Peter Mattis a1d076a617 Use a bufio.Reader for input.
This reduces the number of system calls for reading network data,
providing a nice speedup when there are concurrent RPCs.
2016-03-09 12:07:58 -05:00
Brad Fitzpatrick ac5c8d7972 transport: use http2.Framer's MetaHeadersFrame functionality
The Framer now has support for merging HEADERS+CONTINUATION frames.
This remove the frame merging & hpack state machine from grpc.

In addition to being more compliant with the spec, this also means
gRPC enforces the header list size, removing a DoS vector.

Change-Id: Id46a6a1e741e62a859c3e3fb9f0cc36febf1d836
2016-02-25 23:44:45 +00:00
Brad Fitzpatrick 110fd99e30 Fix crashes where transports returned errors unhandled by the message parser.
The http.Handler-based transport body reader was returning error types
not understood by the recvMsg parser. See #557 for some background and
examples.

Fix the http.Handler transport and add tests. I copied in a subset of
the http2 package's serverTest type, adapted slightly to work with
grpc. In the process of adding tests, I discovered that
ErrUnexpectedEOF was also not handled by the regular server
transport. Document the rules and fix that crash as well.

Unrelated stuff in this CL:

* make tests listen on localhost:0 instead of :0, to avoid Mac firewall
  pop-up dialogs.

* rename parser.s field to parser.r, to be more idiomatic that it's an
  io.Reader and not anything fancier. (it's not acting like type
  stream, even if that's the typical concrete type)

* move 5 byte temp buffer into parser, rather than allocating it for
  each new message. (drop in the bucket improvement in garbage; more
  to do later)

* rename http2RSTErrConvTab to http2ErrConvTab, per Qi's earlier
  CL. Also add the HTTP/1.1-required error mapping for completeness,
  not that it should ever arise with gRPC, also per Qi's earlier CL
  referenced in #557.
2016-02-24 15:09:17 -08:00
Brad Fitzpatrick 8aa7cbbc33 transport: don't crash if peer sends an empty header field name
The grpc-http2 transport doesn't validate hpack-decoded field names to be
valid http2 field names before checking their first byte. Had it verified
first and found that the empty string is illegal, this crash wouldn't happen,
but currently a malicious request can crash a gRPC server by sending an empty
hpack string.
2016-02-10 21:53:30 +00:00
iamqizhao e000b83ffb Improve an error message 2016-02-09 11:16:47 -08:00
iamqizhao da3bb0c9f7 Support compression 2016-01-22 18:21:41 -08:00
iamqizhao 6a026b9f10 recover the content-type check 2015-10-20 16:20:52 -07:00
David Symonds eb3bd654cd Switch from github.com/bradfitz/http2 to golang.org/x/net/http2.
The latter is now the official HTTP2 package for Go.
2015-09-24 18:12:31 +10:00
iamqizhao 21395fb393 bump gRPC-Go to beta 2015-09-14 13:27:27 -07:00
iamqizhao bcc6d1ba11 tentatively disable content-type check 2015-09-02 22:23:11 -07:00
iamqizhao ccfc0efd97 check content-type == application/grpc 2015-09-02 16:52:46 -07:00
iamqizhao 1f3aecfe8e remove some dead code 2015-08-26 14:03:38 -07:00
iamqizhao c0e23d7ef3 make the tests happy 2015-08-26 12:40:24 -07:00
iamqizhao 125950284c separate auth info from normal metadata 2015-08-26 11:30:43 -07:00
iamqizhao 97574c6499 make the test happy 2015-08-24 11:40:40 -07:00
yangzhouhan 676c10ae4d gofmt 2015-08-10 17:42:54 -07:00
yangzhouhan 484e2d96e5 change the metadata datastructure 2015-08-10 16:06:27 -07:00
iamqizhao 766bcab28b an error code revision 2015-07-29 18:28:41 -07:00