Commit Graph

1687 Commits

Author SHA1 Message Date
Sam Brannen
685a195ba1 Deprecate SocketUtils
SocketUtils was introduced in Spring Framework 4.0, primarily to assist
in writing integration tests which start an external server on an
available random port. However, these utilities make no guarantee about
the subsequent availability of a given port and are therefore
unreliable. Instead of using SocketUtils to find an available local
port for a server, it is recommended that users rely on a server's
ability to start on a random port that it selects or is assigned by the
operating system. To interact with that server, the user should query
the server for the port it is currently using.

SocketUtils is now deprecated in 5.3.16 and will be removed in 6.0.

Closes gh-28052
2022-02-15 14:28:58 +01:00
Sam Brannen
f8a5a8d7be Use modern language features in tests 2022-02-03 14:50:10 +01:00
rstoyanchev
c4e362500b Polishing tests 2022-02-02 17:09:04 +00:00
rstoyanchev
8d5a6520ce Ensure all converters don't close InputStream
Closes gh-27969
2022-02-02 15:55:13 +00:00
rstoyanchev
4effca35b5 Ignore Content-Type that is invalid (not concrete)
Closes gh-27957
2022-02-02 15:55:07 +00:00
shirohoo
7211912057 Polish tests in spring-web
This PR polishes trivial things in tests in spring-web.

Closes gh-27958
2022-01-20 15:44:24 +01:00
Juergen Hoeller
6b3052200a Skip "data:" lines without content
Closes gh-27923
2022-01-12 16:35:42 +01:00
Sam Brannen
df263d01b9 Use idiomatic AssertJ assertions for true, false, and null 2022-01-10 14:15:55 +01:00
Arjen Poutsma
722ab25f27 Support empty file names in UriUtils::extractFileExtension
Closes gh-27639
2021-11-19 12:37:00 +01:00
d4ksn
29572600dc Ensure that references > MAX_REFERENCE_SIZE are not processed
This commit ensures that only HTML references of length <
MAX_REFERENCE_SIZE are considered as potential references. This check is
possible because reference longer than 10 digits are out of bounds for
Integers.

Closes gh-1249
2021-11-16 15:04:08 +01:00
Rossen Stoyanchev
c6ce65ef56 Polishing contribution
Closes gh-27623
2021-11-09 09:47:02 +00:00
happyWilliam0
b5743966d6 Improve efficiency of UrlPathHelper#getSanitizedPath
See gh-27623
2021-11-09 09:47:02 +00:00
Arjen Poutsma
0416168d0e Fix bug in max header calculation in DefaultPartHttpMessageReader
This commit fixes a bug in the DefaultPartHttpMessageReader, in the
check for exceeding the maximum header size. Before this commit, the
entire buffer size was considered, thus triggering an exception even
though the max header limit was not exceeded. After this commit, we only
consider the size up until the end-of-header mark (CRLFCRLF).

Furthermore, this commit increases the default maximum header size to
10k, the same default as Commons File upload.

Closes gh-27612
2021-10-27 16:28:32 +02:00
Rossen Stoyanchev
a178bbe86f DefaultResponseErrorHandler shows full error details
Closes gh-27552
2021-10-13 20:51:34 +01:00
Juergen Hoeller
4b01370f54 UriTemplateRequestEntity overrides equals/hashCode
Closes gh-27531
2021-10-08 20:41:18 +02:00
Sam Brannen
48a507a993 Clean up warnings 2021-10-05 14:35:32 +02:00
Juergen Hoeller
49427b0c3c Upgrade to Apache Johnzon 1.2.14, Vavr 0.10.4, WebJars Locator 0.48, HtmlUnit 2.53 2021-10-02 12:08:09 +02:00
Arjen Poutsma
3be2b32e21 Remove only leading space for SSE data
Prior to this commit, all white space was trimmed from Server Sent Event
data. After this commit, only a leading space is removed (if present).

Closes gh-27473
2021-09-28 14:56:39 +02:00
Sam Brannen
2567b20949 Upgrade to spring-javaformat 0.0.28 and downgrade to Checkstyle 8.41
In order to be able to use text blocks and other new Java language
features, we are upgrading to a recent version of Checkstyle.

The latest version of spring-javaformat-checkstyle (0.0.28) is built
against Checkstyle 8.32 which does not include support for language
features such as text blocks. Support for text blocks was added in
Checkstyle 8.36.

In addition, there is a binary compatibility issue between
spring-javaformat-checkstyle 0.0.28 and Checkstyle 8.42. Thus we cannot
use Checkstyle 8.42 or higher.

In this commit, we therefore upgrade to spring-javaformat-checkstyle
0.0.28 and downgrade to Checkstyle 8.41.

This change is being applied to `5.3.x` as well as `main` in order to
benefit from the enhanced checking provided in more recent versions of
Checkstyle.

Closes gh-27481
2021-09-28 10:29:31 +02:00
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