Commit Graph

44 Commits

Author SHA1 Message Date
Aditya Sood 987df13092
metadata: move FromOutgoingContextRaw() to internal (#6765)
Co-authored-by: Arvind Bright <arvind.bright100@gmail.com>
2024-01-18 09:55:32 -08:00
Evan Jones d7ea67b9f3
metadata: Use strings.EqualFold for ValueFromIncomingContext (#6743) 2023-10-30 09:51:19 -07:00
wenxuwan 6f44ae89b1
metadata: add benchmark test for FromIncomingContext and ValueFromIncomingContext (#6117) 2023-03-15 16:19:40 -04:00
Zach Reyes 1d16ef5bd8
metadata: Lowercase appended metadata (#6071) 2023-03-01 20:47:18 -05:00
horpto b81e8b62c9
metadata: slightly improve operateHeaders (#6008) 2023-02-08 13:27:02 -08:00
Doug Fawley 778860e606
testing: update Go to 1.19 (#5717) 2022-10-17 15:04:34 -07:00
horpto 60eecd9169
metadata: add ValueFromIncomingContext to more efficiently retrieve a single value (#5596) 2022-09-07 13:14:42 -07:00
Menghan Li 2fccb822f1
metadata: copy slices in FromContext() functions (#5267) 2022-03-22 14:15:22 -07:00
Konrad Reiche 7e35356501
metadata: add Delete method to MD (#4549) 2021-06-16 16:56:04 -07:00
Menghan Li 32d5490aee
metadata: convert keys to lowercase in FromContext() (#4416) 2021-06-03 15:23:46 -07:00
irfan sharif b602d17e45
metadata: reduce memory footprint in FromOutgoingContext (#4360)
When Looking at memory profiles for cockroachdb/cockroach, we observed
that the intermediate metadata.MD array constructed to iterate over
appended metadata escaped to the heap. Fortunately, this is easily
rectifiable.

  go build -gcflags '-m' google.golang.org/grpc/metadata
  ...
  google.golang.org/grpc/metadata/metadata.go:198:13: make([]MD, 0, len(raw.added) + 1) escapes to heap
2021-04-28 10:05:50 -07:00
Gaurav Gahlot d7a7a304ff
testing: Avoid using context.Background (#3949) 2020-11-05 09:25:17 -08:00
Garrett Gutierrez 132187f04c
Modified tests to use tlogger. (#3343)
* Modified tests to use tlogger.

* Fail on errors, with error expectations.

* Added expects and MixedCapsed grpclb_config tests

* Moved tlogger to grpctest, moved leakcheck tester to grpctest.go

* Added ExpectErrorN()

* Removed redundant leak checks

* Fixed new test

* Made tlogger globals into tlogger methods

* ErrorsLeft -> EndTest

* Removed some redundant lines

* Fixed error in test and empty map in EndTest
2020-02-06 13:03:20 -08:00
Doug Fawley 04ea82009c
cleanup: replace "x/net/context" import with "context" (#2439) 2018-11-12 13:30:41 -08:00
dfawley 90f728eaf7
Remove shadowing of built-ins (#2290) 2018-09-05 09:05:40 -07:00
Chyroc f8dbc38bdc Fix "deprecated" function godoc comments to match standard formatting (#2027) 2018-05-02 08:52:49 -07:00
Zachary Romero 291de7f0ab metadata: Add Get, Set, and Append methods to metadata.MD (#1940) 2018-04-04 09:11:19 -07:00
dfawley b96718f8f0
metadata: Fix bug where AppendToOutgoingContext could modify another context's metadata (#1930) 2018-03-19 16:23:41 -07:00
Jean de Klerk 08d626137c metadata: provide AppendToOutgoingContext interface (#1794)
- Provide AppendToOutgoingContext interface for imrproved performance
over manually creating md and joining with existing md
- Add benchmarks for old/new approaches

Fixes #1390
2018-02-12 11:10:37 -08:00
Blair Kuzman 1cd234627e Documentation: update broken wire.html link in metadata package. (#1791)
https://grpc.io/docs/guides/wire.html is no longer valid.

Looking at an archived version of that page
(https://web.archive.org/web/20171006045517/https://grpc.io/docs/guides/wire.html)
it looks equilavent to what is now posted at:
https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md.

The gRPC guide: https://grpc.io/docs/guides/ contains a link in the
sidebar navigation to the same page, so pretty sure it's correct.
2018-01-10 10:25:54 -08: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 596a6acc87 metadata: Remove NewContext and FromContext for gRFC L7 (#1392) 2017-08-17 13:10:28 -07:00
Mehrdad Afshari 93166a0b0b Canonicalize https://grpc.io as the preferred URL prefix 2017-07-10 16:28:39 -07:00
Menghan Li 0c68d6e2f2 Specify characters allowed in metadata keys (#1299) 2017-06-12 15:05:52 -07:00
Jan Tattermusch ddbf6c46a6 autofix license notice 2017-06-08 14:42:19 +02:00
Adele Zhou a40b8d44e0 Address the comments 2017-05-04 16:29:17 -07:00
Adele Zhou 7ddf89f9b7 Fix doc 2017-05-04 10:30:28 -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
dfawley 0c1d39df28 Separate incoming and outgoing metadata in context
This will prevent the incoming RPCs' metadata from appearing in outgoing RPCs
unless it is explicitly copied, e.g.:

incomingMD, ok := metadata.FromContext(ctx)
if ok {
  ctx = metadata.NewContext(ctx, incomingMD)
}

Fixes #1148
2017-04-07 11:54:56 -07:00
Yuxuan Li 6810d34606 fix issue #1056 and #1050 2017-02-13 17:37:53 -08:00
Menghan Li b13ef79499 add more comments to metadata Fromcontext (#986) 2016-11-16 17:42:18 -08:00
Michael Darakananda b32ff19331 Add context.Join instead 2016-09-23 11:12:52 +10:00
Michael Darakananda 164a9d0a3e metadata.NewContext merges old metadata
Previously metadata.NewContext(ctx, md) replaces whatever metadata in
ctx with md.
This patch merges the old metadata with md before returning the new
context.

Fixes #902.
2016-09-22 17:12:07 +10:00
Menghan Li fe4145af27 Allow comma in metadata Binary-Header value 2016-07-27 14:42:29 -07:00
iamqizhao a98f0170cf fix some print format errors 2015-12-16 11:36:52 -08:00
iamqizhao 2f524e51f1 add more tests 2015-12-15 16:13:30 -08:00
iamqizhao 3d2cc2df9c remove dead code 2015-12-15 15:53:37 -08:00
iamqizhao 87d84117a8 i) lower case metedata key names; ii) make binary encoding consistent with other impls. 2015-12-15 15:30:52 -08:00
yangzhouhan 1f14f6f0c5 gofmt 2015-08-10 17:34:20 -07:00
yangzhouhan 484e2d96e5 change the metadata datastructure 2015-08-10 16:06:27 -07:00
iamqizhao 450bbf71af fix a typo 2015-02-25 16:39:41 -08:00
iamqizhao c42573b827 improve error logging 2015-02-25 16:33:12 -08:00
David Symonds 3981839a52 Add import comments to grpc packages.
This enforces that these packages are used with these import paths.
See http://golang.org/cmd/go/#hdr-Import_path_checking for documentation.
2015-02-09 13:46:16 +11:00
David Symonds e71095e0ec Move source files up one level.
The top-level directory in this repository is going to be
the main "grpc" package.
2015-02-09 11:33:38 +11:00