test/jdk/java/net/httpclient/whitebox/jdk.incubator.httpclient/jdk/incubator/http/Http1HeaderParserTest.java
branchhttp-client-branch
changeset 56019 2cb33775fc6f
parent 55973 4d9b002587db
parent 48535 5f9977540ac9
equal deleted inserted replaced
56010:782b2f2d1e76 56019:2cb33775fc6f
   173               "Content-Length: 65\r\n" +
   173               "Content-Length: 65\r\n" +
   174               "Content-Type: text/html;$NEWLINE" +  // folding field-value with '\n'|'\r
   174               "Content-Type: text/html;$NEWLINE" +  // folding field-value with '\n'|'\r
   175               " \t \t charset=UTF-8\r\n" +          // mix of preceding SP and HT
   175               " \t \t charset=UTF-8\r\n" +          // mix of preceding SP and HT
   176               "Connection: keep-alive\r\n\r\n" +
   176               "Connection: keep-alive\r\n\r\n" +
   177               "XXYYZZAABBCCDDEEFFGGHHII",
   177               "XXYYZZAABBCCDDEEFFGGHHII",
       
   178 
       
   179               "HTTP/1.1 401 Unauthorized\r\n" +
       
   180               "WWW-Authenticate: Digest realm=\"wally land\","
       
   181                       +"$NEWLINE    domain=/,"
       
   182                       +"$NEWLINE nonce=\"2B7F3A2B\","
       
   183                       +"$NEWLINE\tqop=\"auth\"\r\n\r\n",
       
   184 
   178            };
   185            };
   179         for (String newLineChar : new String[] { "\n", "\r" }) {
   186         for (String newLineChar : new String[] { "\n", "\r", "\r\n" }) {
   180             for (String template : foldingTemplate)
   187             for (String template : foldingTemplate)
   181                 responses.add(template.replace("$NEWLINE", newLineChar));
   188                 responses.add(template.replace("$NEWLINE", newLineChar));
   182         }
   189         }
   183 
   190 
   184         String[] bad = // much of this is to retain parity with legacy MessageHeaders
   191         String[] bad = // much of this is to retain parity with legacy MessageHeaders
   329                     found = true;
   336                     found = true;
   330                     List<String> otherValues = other.getValue();
   337                     List<String> otherValues = other.getValue();
   331                     assertEquals(values.size(), otherValues.size(),
   338                     assertEquals(values.size(), otherValues.size(),
   332                                  format("%s. Expected list size %d, actual size %s",
   339                                  format("%s. Expected list size %d, actual size %s",
   333                                         msg, values.size(), otherValues.size()));
   340                                         msg, values.size(), otherValues.size()));
   334                     if (!values.containsAll(otherValues) && otherValues.containsAll(values))
   341                     if (!(values.containsAll(otherValues) && otherValues.containsAll(values)))
   335                         assertTrue(false, format("Lists are unequal [%s] [%s]", values, otherValues));
   342                         assertTrue(false, format("Lists are unequal [%s] [%s]", values, otherValues));
   336                     break;
   343                     break;
   337                 }
   344                 }
   338             }
   345             }
   339             assertTrue(found, format("header name, %s, not found in %s", key, actual));
   346             assertTrue(found, format("header name, %s, not found in %s", key, actual));