Commit 44415c4
[dart:_http] Require Cookie name and value to be valid.
This is a breaking change. #37192
This change makes the name and value positional optional parameters in the
Cookie class constructor mandatory by changing the signature from
Cookie([String name, String value])
to
Cookie(String name, String value)
The parameters were already effectively mandatory as a bug introduced in
Dart 1.3.0 (2014) meant the name and value parameters could not be null, and
any such uses already threw a noSuchMethod exception because null did not
have a length getter. As such, this is not a breaking change but adopts the
current behavior as a null name and value was already of questionable use.
Breaking change: This change adds validation to the String name and String
value setters, which had not been validating the fields at all, unlike the
constructor. This also forbids the name and value from being set to null.
That meant potentially invalid cookies could be sent to servers if the
cookie was modified after construction. This change adds the validation to
follow the rule of least surprise.
The documentation has been updated accordingly and improved a bit.
Closes #37192
Closes #29463
Change-Id: Iffed3dc265ca9c68142c4372522913f9d1ff4d51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103840
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>1 parent be260fe commit 44415c4
3 files changed
Lines changed: 99 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
53 | 79 | | |
54 | 80 | | |
55 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
912 | 912 | | |
913 | 913 | | |
914 | 914 | | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
919 | | - | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
920 | 919 | | |
921 | 920 | | |
922 | 921 | | |
923 | | - | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
924 | 930 | | |
925 | 931 | | |
926 | 932 | | |
927 | 933 | | |
928 | | - | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
929 | 943 | | |
930 | 944 | | |
931 | 945 | | |
932 | 946 | | |
933 | | - | |
| 947 | + | |
934 | 948 | | |
935 | 949 | | |
936 | 950 | | |
937 | 951 | | |
938 | | - | |
939 | | - | |
| 952 | + | |
| 953 | + | |
940 | 954 | | |
941 | 955 | | |
942 | 956 | | |
943 | 957 | | |
944 | | - | |
| 958 | + | |
945 | 959 | | |
946 | 960 | | |
947 | 961 | | |
948 | 962 | | |
949 | | - | |
| 963 | + | |
950 | 964 | | |
951 | 965 | | |
952 | 966 | | |
953 | 967 | | |
954 | | - | |
| 968 | + | |
955 | 969 | | |
956 | 970 | | |
957 | 971 | | |
958 | 972 | | |
959 | | - | |
| 973 | + | |
| 974 | + | |
960 | 975 | | |
961 | 976 | | |
962 | 977 | | |
963 | 978 | | |
964 | | - | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
965 | 983 | | |
966 | 984 | | |
967 | 985 | | |
968 | | - | |
| 986 | + | |
969 | 987 | | |
970 | 988 | | |
971 | 989 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
829 | 829 | | |
830 | 830 | | |
831 | 831 | | |
832 | | - | |
833 | | - | |
| 832 | + | |
| 833 | + | |
834 | 834 | | |
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
838 | 838 | | |
839 | 839 | | |
840 | 840 | | |
841 | | - | |
842 | | - | |
843 | | - | |
844 | | - | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
845 | 857 | | |
846 | 858 | | |
847 | 859 | | |
| |||
924 | 936 | | |
925 | 937 | | |
926 | 938 | | |
927 | | - | |
928 | | - | |
| 939 | + | |
| 940 | + | |
929 | 941 | | |
930 | 942 | | |
931 | 943 | | |
932 | | - | |
933 | | - | |
| 944 | + | |
934 | 945 | | |
935 | 946 | | |
936 | 947 | | |
937 | 948 | | |
938 | 949 | | |
939 | 950 | | |
940 | 951 | | |
941 | | - | |
| 952 | + | |
942 | 953 | | |
943 | 954 | | |
944 | 955 | | |
| |||
956 | 967 | | |
957 | 968 | | |
958 | 969 | | |
959 | | - | |
| 970 | + | |
960 | 971 | | |
961 | 972 | | |
962 | 973 | | |
| |||
976 | 987 | | |
977 | 988 | | |
978 | 989 | | |
979 | | - | |
980 | | - | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
981 | 993 | | |
982 | 994 | | |
983 | | - | |
| 995 | + | |
984 | 996 | | |
985 | 997 | | |
986 | | - | |
| 998 | + | |
987 | 999 | | |
988 | 1000 | | |
989 | 1001 | | |
| 1002 | + | |
| 1003 | + | |
990 | 1004 | | |
| 1005 | + | |
| 1006 | + | |
991 | 1007 | | |
992 | 1008 | | |
993 | 1009 | | |
994 | | - | |
995 | | - | |
996 | | - | |
997 | | - | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
998 | 1014 | | |
999 | 1015 | | |
1000 | 1016 | | |
1001 | 1017 | | |
1002 | 1018 | | |
1003 | | - | |
| 1019 | + | |
1004 | 1020 | | |
1005 | 1021 | | |
1006 | 1022 | | |
1007 | 1023 | | |
1008 | 1024 | | |
1009 | 1025 | | |
1010 | 1026 | | |
1011 | | - | |
| 1027 | + | |
1012 | 1028 | | |
1013 | 1029 | | |
1014 | 1030 | | |
| 1031 | + | |
1015 | 1032 | | |
1016 | 1033 | | |
0 commit comments