diff --git a/core/src/main/java/io/grpc/Metadata.java b/core/src/main/java/io/grpc/Metadata.java index eb057586f0..bd92440dca 100644 --- a/core/src/main/java/io/grpc/Metadata.java +++ b/core/src/main/java/io/grpc/Metadata.java @@ -68,8 +68,9 @@ public class Metadata { /** * Simple metadata marshaller that encodes strings as is. * - *
This should be used with ASCII strings that only contain printable characters and space. - * Otherwise the output may be considered invalid and discarded by the transport. + *
This should be used with ASCII strings that only contain the characters listed in the class
+ * comment of {@link AsciiMarshaller}. Otherwise the output may be considered invalid and
+ * discarded by the transport, or the call may fail.
*/
public static final AsciiMarshaller It produces serialized names and values interleaved. result[i*2] are names, while
* result[i*2+1] are values.
*
- * Names are ASCII string bytes. If the name ends with "-bin", the value can be raw binary.
- * Otherwise, the value must be printable ASCII characters or space.
+ * Names are ASCII string bytes that contains only the characters listed in the class comment
+ * of {@link Key}. If the name ends with {@code "-bin"}, the value can be raw binary. Otherwise,
+ * the value must contain only characters listed in the class comments of {@link AsciiMarshaller}
*
* The returned byte arrays must not be modified.
*
@@ -354,12 +356,19 @@ public class Metadata {
/**
* Marshaller for metadata values that are serialized into ASCII strings that contain only
- * printable characters and space.
+ * following characters:
+ * Note this has to be the subset of valid characters in {@code field-content} from RFC 7230
+ * Section 3.2.
*/
public interface AsciiMarshaller
+ *
+ *