diff options
author | 2016-01-14 12:47:37 -0800 | |
---|---|---|
committer | 2016-01-14 12:47:37 -0800 | |
commit | 21c0ebf6d4f89baedf726cb2d23c2f253d14a27d (patch) | |
tree | 17960865c72cdde9a1d2ea71eca745317939d590 /src/node/ext/call.cc | |
parent | 2e18d43930067472dd020f2507ebd1d868d1f978 (diff) | |
parent | d212b33553c61314c0cfc3490061f174fcaa36db (diff) |
Merge pull request #4653 from murgatroid99/release-0_12_master_merge
Release 0 12 master merge
Diffstat (limited to 'src/node/ext/call.cc')
-rw-r--r-- | src/node/ext/call.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index c6e10bc1ff..e1fc111e9e 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -95,10 +95,6 @@ Local<Value> nanErrorWithCode(const char *msg, grpc_call_error code) { return scope.Escape(err); } -bool EndsWith(const char *str, const char *substr) { - return strcmp(str+strlen(str)-strlen(substr), substr) == 0; -} - bool CreateMetadataArray(Local<Object> metadata, grpc_metadata_array *array, shared_ptr<Resources> resources) { HandleScope scope; @@ -126,7 +122,7 @@ bool CreateMetadataArray(Local<Object> metadata, grpc_metadata_array *array, grpc_metadata *current = &array->metadata[array->count]; current->key = **utf8_key; // Only allow binary headers for "-bin" keys - if (EndsWith(current->key, "-bin")) { + if (grpc_is_binary_header(current->key, strlen(current->key))) { if (::node::Buffer::HasInstance(value)) { current->value = ::node::Buffer::Data(value); current->value_length = ::node::Buffer::Length(value); @@ -180,7 +176,7 @@ Local<Value> ParseMetadata(const grpc_metadata_array *metadata_array) { } else { array = Local<Array>::Cast(maybe_array.ToLocalChecked()); } - if (EndsWith(elem->key, "-bin")) { + if (grpc_is_binary_header(elem->key, strlen(elem->key))) { Nan::Set(array, index_map[elem->key], MakeFastBuffer( Nan::CopyBuffer(elem->value, @@ -777,4 +773,4 @@ NAN_METHOD(Call::SetCredentials) { } } // namespace node -} // namespace grpc +} // namespace grpc
\ No newline at end of file |