OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 class _HttpHeaders implements HttpHeaders { | 7 class _HttpHeaders implements HttpHeaders { |
8 _HttpHeaders(String this.protocolVersion) | 8 _HttpHeaders(String this.protocolVersion) |
9 : _headers = new Map<String, List<String>>(); | 9 : _headers = new Map<String, List<String>>(); |
10 | 10 |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 index++; | 408 index++; |
409 } | 409 } |
410 } | 410 } |
411 | 411 |
412 String parseName() { | 412 String parseName() { |
413 int start = index; | 413 int start = index; |
414 while (!done()) { | 414 while (!done()) { |
415 if (s[index] == " " || s[index] == "\t" || s[index] == "=") break; | 415 if (s[index] == " " || s[index] == "\t" || s[index] == "=") break; |
416 index++; | 416 index++; |
417 } | 417 } |
418 return s.substring(start, index).toLowerCase(); | 418 return s.substring(start, index); |
419 } | 419 } |
420 | 420 |
421 String parseValue() { | 421 String parseValue() { |
422 int start = index; | 422 int start = index; |
423 while (!done()) { | 423 while (!done()) { |
424 if (s[index] == " " || s[index] == "\t" || s[index] == ";") break; | 424 if (s[index] == " " || s[index] == "\t" || s[index] == ";") break; |
425 index++; | 425 index++; |
426 } | 426 } |
427 return s.substring(start, index).toLowerCase(); | 427 return s.substring(start, index); |
428 } | 428 } |
429 | 429 |
430 void expect(String expected) { | 430 void expect(String expected) { |
431 if (done()) { | 431 if (done()) { |
432 throw new HttpException("Failed to parse header value [$s]"); | 432 throw new HttpException("Failed to parse header value [$s]"); |
433 } | 433 } |
434 if (s[index] != expected) { | 434 if (s[index] != expected) { |
435 throw new HttpException("Failed to parse header value [$s]"); | 435 throw new HttpException("Failed to parse header value [$s]"); |
436 } | 436 } |
437 index++; | 437 index++; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 int index = 0; | 662 int index = 0; |
663 | 663 |
664 bool done() => index == s.length; | 664 bool done() => index == s.length; |
665 | 665 |
666 String parseName() { | 666 String parseName() { |
667 int start = index; | 667 int start = index; |
668 while (!done()) { | 668 while (!done()) { |
669 if (s[index] == "=") break; | 669 if (s[index] == "=") break; |
670 index++; | 670 index++; |
671 } | 671 } |
672 return s.substring(start, index).trim().toLowerCase(); | 672 return s.substring(start, index).trim(); |
673 } | 673 } |
674 | 674 |
675 String parseValue() { | 675 String parseValue() { |
676 int start = index; | 676 int start = index; |
677 while (!done()) { | 677 while (!done()) { |
678 if (s[index] == ";") break; | 678 if (s[index] == ";") break; |
679 index++; | 679 index++; |
680 } | 680 } |
681 return s.substring(start, index).trim().toLowerCase(); | 681 return s.substring(start, index).trim(); |
682 } | 682 } |
683 | 683 |
684 void expect(String expected) { | 684 void expect(String expected) { |
685 if (done()) throw new HttpException("Failed to parse header value [$s]"); | 685 if (done()) throw new HttpException("Failed to parse header value [$s]"); |
686 if (s[index] != expected) { | 686 if (s[index] != expected) { |
687 throw new HttpException("Failed to parse header value [$s]"); | 687 throw new HttpException("Failed to parse header value [$s]"); |
688 } | 688 } |
689 index++; | 689 index++; |
690 } | 690 } |
691 | 691 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 | 771 |
772 String name; | 772 String name; |
773 String value; | 773 String value; |
774 DateTime expires; | 774 DateTime expires; |
775 int maxAge; | 775 int maxAge; |
776 String domain; | 776 String domain; |
777 String path; | 777 String path; |
778 bool httpOnly = false; | 778 bool httpOnly = false; |
779 bool secure = false; | 779 bool secure = false; |
780 } | 780 } |
OLD | NEW |