Commit Graph

1668 Commits

Author SHA1 Message Date
Sam Brannen
04e6b233ca Upgrade to JUnit 5.8
Closes gh-27392
2021-09-13 16:38:30 +02:00
Sam Brannen
c3e424c29a Polishing 2021-09-10 16:01:23 +02:00
Rossen Stoyanchev
c23f0cd070 Polishing contribution
See gh-27374
2021-09-10 11:22:01 +01:00
Ruslan Stelmachenko
63ffa710d6 Include all bytes of body in UnknownContentTypeException
HttpMessageConverterExtractor uses MessageBodyClientHttpResponseWrapper
which may read the first byte of the response stream to check if there
is content. After that it is necessary to use the wrapper to get the
full body.

This commit ensures that when UnknownContentTypeException is raised
it gets the body through the wrapper, or otherwise the first byte is
missed if the InputStream is not markable.

Closes gh-27374
2021-09-10 10:42:08 +01:00
Sam Brannen
d8191b4808 Polish contribution
See gh-26984
2021-09-07 14:24:57 +02:00
Yin-Jui
417bce8be5 Add tests for MessageBodyClientHttpResponseWrapper
Closes gh-26984
2021-09-07 14:24:57 +02:00
Sam Brannen
b28f403bf8 Fix Checkstyle violation
See gh-27303
2021-08-22 14:45:55 +02:00
Sam Brannen
6c71cf2f96 Polishing 2021-08-22 14:27:47 +02:00
Sam Brannen
99970a5ddc Polish contribution
See gh-27303
2021-08-22 14:22:51 +02:00
Erik van Paassen
462e19d417 Fix UrlPathHelper#shouldRemoveSemicolonContent() (#27303)
The checkReadOnly() method should only be called from
methods that modify properties to prevent modification
of read-only instances.

Fixes #27256
2021-08-22 14:10:25 +02:00
Sam Brannen
6770e4b3cc Fix and document CompositeUriComponentsContributor#hasContributors()
Prior to this commit, the hasContributors() method incorrectly returned
false if contributors had been configured.

This commit fixes the logic in hasContributors() and documents it.

Closes #27271
2021-08-18 17:33:50 +02:00
Syuziko
eaf9deedfd Polish tests
See gh-27248
2021-08-07 18:53:47 +02:00
Rossen Stoyanchev
6c68419073 Polishing contribution
Closes gh-27216
2021-07-27 17:41:30 +01:00
Moncef AOUDIA
a747cc3e91 Fix error message in SynchronossPartHttpMessageReader 2021-07-27 17:25:30 +01:00
Rossen Stoyanchev
0b1d14cdd9 Follow-up fix, checking also "ws" and port 80 case
See gh-27097
2021-07-16 09:34:12 +01:00
Rossen Stoyanchev
e1f51cbce7 Check both https and wss in forwarded header checks
Closes gh-27097
2021-07-13 16:32:12 +01:00
Juergen Hoeller
e1c0f3b067 CommonsMultipartResolver supports configurable HTTP methods
Closes gh-27161
2021-07-12 23:19:08 +02:00
Juergen Hoeller
1ff8da3635 StandardServletMultipartResolver provides strict Servlet compliance option
Closes gh-26826
2021-07-12 23:18:54 +02:00
Juergen Hoeller
128689e79b Use entrySet iterator in getBodyFromServletRequestParameters
Closes gh-27081
2021-07-12 17:43:19 +02:00
Sam Brannen
a2ef6badc4 Use StringBuilder.append(char) where possible
To slightly improve performance, this commit switches to
StringBuilder.append(char) instead of StringBuilder.append(String)
whenever we append a single character to a StringBuilder.

Closes gh-27098
2021-06-25 10:44:28 +02:00
Sam Brannen
3676084472 Ensure DefaultPathSegment does not allow parameters to be mutated
Prior to this commit, if a PathContainer was created using
Options.MESSAGE_ROUTE, DefaultPathSegment#parameters() returned a
mutable map which would allow the user to modify the contents of the
static, shared EMPTY_PARAMS map in DefaultPathContainer.

This commit prevents corruption of the shared EMPTY_PARAMS map by
ensuring that parameters stored in DefaultPathSegment are always
immutable.

Closes gh-27064
2021-06-15 15:16:20 +02:00
Sam Brannen
bcb0580492 Polish DefaultPathContainerTests 2021-06-15 13:35:45 +02:00
Rossen Stoyanchev
a42540e64a Multipart writer detects custom Jackson encoder
Closes gh-27017
2021-06-08 17:41:04 +01:00
Brian Clozel
e35fe33b72 Revisit fix for gh-26905 in UriComponentsBuilder
This commit revisits the recently updated `PORT_PATTERN` in
`UriComponentsBuilder`. The fix introduced in gh-26905 fails with
ambiguous URL patterns, especially when the port and path parts of the
pattern are hard to differentiate, for example
"https://localhost:{port}{path}".

This commit reinstates the previous behavior without undoing the actual
fix. The only limitation introduced here is the fact that only a single
pattern variable is allowed for the port pattern part.

Fixes gh-27039
2021-06-08 15:26:13 +02:00
Arjen Poutsma
5cbbbed377 Use given name in MultipartBodyBuilder::part
Make sure that we use the parameter name in MultipartBodyBuilder::part
when adding a Part, instead of using the name specified in the
'Content-Disposition' header that might have been in the part's headers.

Closes gh-27007
2021-05-31 15:17:12 +02:00
Rossen Stoyanchev
de1ba79c55 Switch to non-blocking thread after WebSession creation
See gh-26958
2021-05-24 16:27:56 +01:00
Christoph Dreis
360f555e77 Introduce ResponseEntity.internalServerError()
Closes gh-26952
2021-05-18 16:57:20 +02:00
Ruslan Akhundov
66588bae92 CorsConfiguration supports port pattern and port lists
See gh-26927
2021-05-17 17:28:16 +01:00
Arjen Poutsma
0d0d75e253 Ensure DefaultPartHttpMessageReader temp directories do not collide
This commit makes sure that the DefaultPartHttpMessageReader uses a
random temporary directory to store uploaded files, so that two
instances do not collide.

See gh-26931
2021-05-11 21:12:50 +02:00
Juergen Hoeller
1469bdbc70 Nullability refinements and related polishing 2021-05-11 16:50:19 +02:00
Rossen Stoyanchev
aa51ed1940 Fix failing tests
This commit ensures that if an Origin is returned as it was provided,
possibly with a trailing slash.

See gh-26892
2021-05-10 14:15:16 +01:00
Rossen Stoyanchev
dc4e053d59 CorsConfiguration ignores trailing "/" in pattern
Recent commit dddcc5e9ad ensured a
trailing "/" in the Origin header has no effect. This commit does the
same for a trailing "/" in configured patterns.

See gh-26892
2021-05-10 13:30:02 +01:00
Rossen Stoyanchev
0468ef46ac Follow-up fix for recent change to PORT_PATTERN
The pattern was changed in 65797d04f2
to check for characters up until "/", instead of for digits, but now
also checks up until "?" and "#".

Closes gh-26905
2021-05-10 07:19:17 +01:00
Sam Brannen
355d394d7f Polish contribution
See gh-25200
2021-05-08 19:40:13 +02:00
Vlad Kisel
9ddab9e69b Support single-value request param resolution for data class constructors
Prior to this commit, when Web MVC attempted to resolve a constructor
argument for a data class constructor with @ModelAttribute binding,
ModelAttributeMethodProcessor failed to unwrap the array returned by
WebRequest.getParameter(String).

According to the Javadoc for WebRequest.getParameter(String), "a
single-value parameter will be exposed as an array with a single
element."

This commit fixes this issue by extracting the single value from such
an array and using that as the constructor argument (potentially
converted by the WebDataBinder).

Closes gh-25200
2021-05-08 19:25:54 +02:00
Sam Brannen
c20a43f72b Polish WebRequestDataBinderIntegrationTests 2021-05-08 18:12:55 +02:00
Rossen Stoyanchev
e0fa58aa0f Polishing contribution
Closes gh-26905
2021-05-07 17:30:40 +01:00
Jeon Ilwoong
65797d04f2 UriComponentsBuilder handles invalid port correctly
See gh-26905
2021-05-07 17:15:16 +01:00
Rossen Stoyanchev
dddcc5e9ad Ignore trailing slash in Origin header
See gh-26892
2021-05-07 14:56:56 +01:00
Rebwon
7954dc7a00 Polish tests
Closes gh-26708
2021-04-12 20:11:14 +02:00
Rossen Stoyanchev
c5ac8e8ab6 Use createUnresolved for forwarded header address
Avoid DNS resolution.

See gh-26748
2021-04-07 12:50:07 +01:00
Rossen Stoyanchev
8a1182a678 Additional validation for forwarded header address value
Closes gh-26748
2021-04-06 19:43:13 +01:00
Rossen Stoyanchev
5e1e29a2dd Fix failing tests
See gh-26746
2021-03-31 12:25:39 +01:00
Arjen Poutsma
d83fb09914 Change header encoding to UTF8 in DefaultPartHttpMessageReader
This commit changes the encoding used to parse multipart headers from
ISO-8859-1 to UTF-8, in accordance with RFC 7578.

Closes gh-26736
2021-03-30 10:51:19 +02:00
Sam Brannen
70f0895f96 Polish HeaderWebSessionIdResolverTests
See gh-26675
2021-03-15 12:12:53 +01:00
MaengSol
2728a9b931 Polishing
Closes gh-26675
2021-03-15 12:02:40 +01:00
Rossen Stoyanchev
6d4c0091b5 Add application/*+xml to Jaxb2XmlEncoder
Closes gh-26655
2021-03-10 17:33:04 +00:00
Brian Clozel
5a11569790 Allow ServerHttpRequest content-type mutation
Prior to this commit, `ServerHttpRequest.mutate()` would not reflect
changes made on the "Accept" and "Content-Type" HTTP headers.
This was due to the fact that the instantiation of a new request based
on the mutated values would not use the writable HTTP headers used
during the mutation, but rather a read-only view of the headers backed
by `ReadOnlyHttpHeaders`.

`ReadOnlyHttpHeaders` caches those values for performance reasons, so
getting those from the new request would not reflect the changes made
during the mutation phase.

This commit ensures that the new request uses the mutated headers.

Fixes gh-26615
2021-03-01 20:55:03 +01:00
Arjen Poutsma
1a79c54b01 Support quoted boundary in DefaultPartHttpMessageReader
This commit makes sure that quoted boundary parameters are supported in
the DefaultPartHttpMessageReader.

Closes gh-26616
2021-03-01 14:07:20 +01:00
Rossen Stoyanchev
8791928f61 Update variable detection in UriComponentsBuilder#encode
This commit better aligns how URI variable placeholders are detected
in UriComponentsBuilder#encode (i.e. the pre-encoding of the literal
parts of a URI template) and how they are expanded later on.
The latter relies on a pattern that stops at the first closing '}'
which excludes the possibility for well-formed, nested placeholders
other than variables with regex syntax, e.g. "{year:\d{1,4}}".

UriComponentsBuilder#encode now also stops at the first closing '}' and
further ensures the placeholder is not empty and that it has '{' before
deciding to treat it as a URI variable.

Closes gh-26466
2021-02-11 08:34:06 +00:00