equal
deleted
inserted
replaced
135 this(name, value, null /*header*/); |
135 this(name, value, null /*header*/); |
136 } |
136 } |
137 |
137 |
138 private HttpCookie(String name, String value, String header) { |
138 private HttpCookie(String name, String value, String header) { |
139 name = name.trim(); |
139 name = name.trim(); |
140 if (name.length() == 0 || !isToken(name) || isReserved(name)) { |
140 if (name.length() == 0 || !isToken(name)) { |
141 throw new IllegalArgumentException("Illegal cookie name"); |
141 throw new IllegalArgumentException("Illegal cookie name"); |
142 } |
142 } |
143 |
143 |
144 this.name = name; |
144 this.name = name; |
145 this.value = value; |
145 this.value = value; |
777 |
777 |
778 if (c < 0x20 || c >= 0x7f || tspecials.indexOf(c) != -1) |
778 if (c < 0x20 || c >= 0x7f || tspecials.indexOf(c) != -1) |
779 return false; |
779 return false; |
780 } |
780 } |
781 return true; |
781 return true; |
782 } |
|
783 |
|
784 /* |
|
785 * @param name |
|
786 * the name to be tested |
|
787 * |
|
788 * @return {@code true} if the name is reserved by cookie specification, |
|
789 * {@code false} if it is not |
|
790 */ |
|
791 private static boolean isReserved(String name) { |
|
792 if (name.equalsIgnoreCase("Comment") |
|
793 || name.equalsIgnoreCase("CommentURL") // rfc2965 only |
|
794 || name.equalsIgnoreCase("Discard") // rfc2965 only |
|
795 || name.equalsIgnoreCase("Domain") |
|
796 || name.equalsIgnoreCase("Expires") // netscape draft only |
|
797 || name.equalsIgnoreCase("Max-Age") |
|
798 || name.equalsIgnoreCase("Path") |
|
799 || name.equalsIgnoreCase("Port") // rfc2965 only |
|
800 || name.equalsIgnoreCase("Secure") |
|
801 || name.equalsIgnoreCase("Version") |
|
802 || name.equalsIgnoreCase("HttpOnly") |
|
803 || name.charAt(0) == '$') |
|
804 { |
|
805 return true; |
|
806 } |
|
807 |
|
808 return false; |
|
809 } |
782 } |
810 |
783 |
811 /* |
784 /* |
812 * Parse header string to cookie object. |
785 * Parse header string to cookie object. |
813 * |
786 * |