File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
main/java/org/springframework/web/util
test/java/org/springframework/web/util Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ public class UriComponentsBuilder {
6060
6161 private static final String SCHEME_PATTERN = "([^:/?#]+):" ;
6262
63- private static final String HTTP_PATTERN = "(http|https):" ;
63+ private static final String HTTP_PATTERN = "(?i)( http|https):" ;
6464
6565 private static final String USERINFO_PATTERN = "([^@/]*)" ;
6666
@@ -223,7 +223,8 @@ public static UriComponentsBuilder fromHttpUrl(String httpUrl) {
223223 if (m .matches ()) {
224224 UriComponentsBuilder builder = new UriComponentsBuilder ();
225225
226- builder .scheme (m .group (1 ));
226+ String scheme = m .group (1 );
227+ builder .scheme ((scheme != null ) ? scheme .toLowerCase () : scheme );
227228 builder .userInfo (m .group (4 ));
228229 builder .host (m .group (5 ));
229230 String port = m .group (7 );
Original file line number Diff line number Diff line change @@ -161,6 +161,14 @@ public void fromUriStringQueryParamWithReservedCharInValue() throws URISyntaxExc
161161 assertEquals ("1USD=?EUR" , result .getQueryParams ().getFirst ("q" ));
162162 }
163163
164+ // SPR-10779
165+
166+ @ Test
167+ public void fromHttpUrlStringCaseInsesitiveScheme () {
168+ assertEquals ("http" , UriComponentsBuilder .fromHttpUrl ("HTTP://www.google.com" ).build ().getScheme ());
169+ assertEquals ("https" , UriComponentsBuilder .fromHttpUrl ("HTTPS://www.google.com" ).build ().getScheme ());
170+ }
171+
164172 @ Test
165173 public void path () throws URISyntaxException {
166174 UriComponentsBuilder builder = UriComponentsBuilder .fromPath ("/foo/bar" );
You can’t perform that action at this time.
0 commit comments