1108 if (s.length() >= start.length() &&
1109 start.equalsIgnoreCase(s.substring(0, start.length()))) {
1110 return true;
1111 }
1112
1113 return false;
1114 }
1115
1116 /*
1117 * Split cookie header string according to rfc 2965:
1118 * 1) split where it is a comma;
1119 * 2) but not the comma surrounding by double-quotes, which is the comma
1120 * inside port list or embeded URIs.
1121 *
1122 * @param header
1123 * the cookie header string to split
1124 *
1125 * @return list of strings; never null
1126 */
1127 private static List<String> splitMultiCookies(String header) {
1128 List<String> cookies = new java.util.ArrayList<String>();
1129 int quoteCount = 0;
1130 int p, q;
1131
1132 for (p = 0, q = 0; p < header.length(); p++) {
1133 char c = header.charAt(p);
1134 if (c == '"') quoteCount++;
1135 if (c == ',' && (quoteCount % 2 == 0)) {
1136 // it is comma and not surrounding by double-quotes
1137 cookies.add(header.substring(q, p));
1138 q = p + 1;
1139 }
1140 }
1141
1142 cookies.add(header.substring(q));
1143
1144 return cookies;
1145 }
1146 }
|
1108 if (s.length() >= start.length() &&
1109 start.equalsIgnoreCase(s.substring(0, start.length()))) {
1110 return true;
1111 }
1112
1113 return false;
1114 }
1115
1116 /*
1117 * Split cookie header string according to rfc 2965:
1118 * 1) split where it is a comma;
1119 * 2) but not the comma surrounding by double-quotes, which is the comma
1120 * inside port list or embeded URIs.
1121 *
1122 * @param header
1123 * the cookie header string to split
1124 *
1125 * @return list of strings; never null
1126 */
1127 private static List<String> splitMultiCookies(String header) {
1128 List<String> cookies = new java.util.ArrayList<>();
1129 int quoteCount = 0;
1130 int p, q;
1131
1132 for (p = 0, q = 0; p < header.length(); p++) {
1133 char c = header.charAt(p);
1134 if (c == '"') quoteCount++;
1135 if (c == ',' && (quoteCount % 2 == 0)) {
1136 // it is comma and not surrounding by double-quotes
1137 cookies.add(header.substring(q, p));
1138 q = p + 1;
1139 }
1140 }
1141
1142 cookies.add(header.substring(q));
1143
1144 return cookies;
1145 }
1146 }
|