| 734 | } |
| 735 | |
| 736 | private static String validateName(String n, boolean pseudo) { |
| 737 | checkNotNull(n, "name"); |
| 738 | checkArgument(!n.isEmpty(), "token must have at least 1 tchar"); |
| 739 | if (n.equals("connection")) { |
| 740 | logger.log( |
| 741 | Level.WARNING, |
| 742 | "Metadata key is 'Connection', which should not be used. That is used by HTTP/1 for " |
| 743 | + "connection-specific headers which are not to be forwarded. There is probably an " |
| 744 | + "HTTP/1 conversion bug. Simply removing the Connection header is not enough; you " |
| 745 | + "should remove all headers it references as well. See RFC 7230 section 6.1", |
| 746 | new RuntimeException("exception to show backtrace")); |
| 747 | } |
| 748 | for (int i = 0; i < n.length(); i++) { |
| 749 | char tChar = n.charAt(i); |
| 750 | if (pseudo && tChar == ':' && i == 0) { |
| 751 | continue; |
| 752 | } |
| 753 | |
| 754 | checkArgument( |
| 755 | VALID_T_CHARS.get(tChar), "Invalid character '%s' in key name '%s'", tChar, n); |
| 756 | } |
| 757 | return n; |
| 758 | } |
| 759 | |
| 760 | private Key(String name, boolean pseudo, Object marshaller) { |
| 761 | this.originalName = checkNotNull(name, "name"); |