Commit Graph

1646 Commits

Author SHA1 Message Date
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
Stephane Nicoll
87c0e9b48a Update copyright of change file
See gh-26538
2021-02-11 08:58:50 +01:00
izeye
9a4164c4a8 Polish
See gh-26538
2021-02-11 08:57:32 +01:00
Rossen Stoyanchev
53cafe728c Support to customize rather than replace default codecs
See gh-26212
2021-02-09 18:40:00 +00:00
Rossen Stoyanchev
26000ee29f Polishing contribution
Closes gh-26502
2021-02-08 17:35:59 +00:00
Christophe Maillard
0c2c66b38b Add HttpHandlerDecoratorFactory
See gh-26502
2021-02-08 15:47:21 +00:00
Rossen Stoyanchev
8fb9796d1d Polishing contribution
Closes gh-26463
2021-02-05 12:16:59 +00:00
Yusuke Yamamoto
a264013d7a Content-Disposition can parse BASE64 encoded filename
See gh-26463
2021-02-05 12:16:59 +00:00
Rossen Stoyanchev
7cdaaa22bd Extra ObjectMapper registrations in Jackson2CodecSupport
See gh-26212
2021-02-04 16:12:57 +00:00
Rossen Stoyanchev
f4c9f6b860 Media types by Class for HttpMessageConverter
See gh-26212
2021-02-04 16:12:57 +00:00
Rossen Stoyanchev
1721b0b8d7 Extra ObjectMapper registrations in HttpMessageConverter
See gh-26212
2021-02-04 16:12:57 +00:00
Sam Brannen
99bd8115dd Clean up deprecation warnings in Gradle build output 2021-02-02 11:37:30 +01:00
Sam Brannen
c5284009a1 Fix UriComponentsBuilder examples in ref docs
Closes gh-26453
2021-01-27 15:16:15 +01:00
Rossen Stoyanchev
8aeae49f40 Support for servletPath prefix in ServletRequestPathUtils
Closes gh-26445
2021-01-26 17:30:16 +00:00
Arjen Poutsma
e537844a09 Copy headers from part in MultipartBodyBuilder
This commit makes sure that Part.headers() is copied over when adding a
part in the MultipartBodyBuilder.

Closes gh-26410
2021-01-21 16:24:59 +01:00
Brian Clozel
e4dc863ad0 Fix headers keySet in WebFlux adapters
Prior to this commit, WebFlux native headers adapters would delegate the
`httpHeaders.keySet` to underlying implementations that do not honor the
`remove*` methods.

This commit fixes the `Set` implementation backing the
`httpHeaders.keySet` and ensures that headers can be safely removed from
the set.

Fixes gh-26361
2021-01-11 09:18:10 +01:00
Arjen Poutsma
ce1ae2f1b2 Only write non-default charset in FormHttpMessageConverter
This commit only writes the 'charset' parameter in the written headers
if it is non-default (not UTF-8), since RFC7578 states that the only
allowed parameter is 'boundary'.

See gh-25885
Closes gh-26290
2021-01-08 14:03:58 +01:00
Rossen Stoyanchev
994a35d691 Mutated ServerHttpRequest returns native request correctly
Closes gh-26304
2021-01-04 21:40:25 +00:00
Rossen Stoyanchev
499be70a71 Update async dispatch check in OncePerRequestFilter
We no longer need to rely on an indirect check since Servlet 3.0 is expected
so we can just check the DispatcherType of the request.

Closes gh-26282
2020-12-17 17:33:39 +00:00
Brian Clozel
83c19cd60e Fix NPE when calling NettyHeadersAdapter.add()
Prior to this commit, the `NettyHeadersAdapter` would directly delegate
the `add()` and `set()` calls to the adapted
`io.netty.handler.codec.http.HttpHeaders`. This implementation rejects
`null` values with exceptions.

This commit aligns the behavior here with other implementations, by not
rejecting null values but simply ignoring them.

Fixes gh-26274
2020-12-15 13:23:53 +01:00
Rossen Stoyanchev
7418c4b7b7 Fix buffer leak in AbstractServerHttpResponse
See gh-26232
2020-12-07 22:52:08 +00:00
Rossen Stoyanchev
8ac39a50fe ServletServerHttpResponse reflects Content-Type override
Closes gh-25490
2020-12-03 18:41:18 +00:00
Rossen Stoyanchev
5328184f3a ContentCachingResponseWrapper skips contentLength for chunked responses
Closes gh-26182
2020-12-01 17:46:12 +00:00