Commit Graph

1417 Commits

Author SHA1 Message Date
Christoph Dreis
b234c77b67 Add missing verify() in EncoderHttpMessageWriterTests
Closes gh-24062
2019-11-25 10:51:00 +00:00
Rossen Stoyanchev
7bed4f36da Add missing verify() in Jackson2TokenizerTests
Closes gh-24056
2019-11-22 16:38:43 +00:00
Rossen Stoyanchev
21b2fc1f01 Improve HttpHandlerConnection completion
Before this commit the connector waited for a completed response (via
ServerHttpResponse#setComplete or ServerHttpResponse#writeWith) or an
error signal in handling, but it didn't deal explicitly with the case
where both can occur.

This commit explicitly waits for the completion of handling (success
or error) before passing the response downstream. If an error occurs
after response completion, it is wrapped in a dedicated exception that
also provides access to the completed response.

Close gh-24051
2019-11-22 10:28:05 +00:00
Rossen Stoyanchev
f4e0288357 Remove mentions of Tomcat async request timeout value
Close gh-24030
2019-11-19 17:08:43 +00:00
Juergen Hoeller
1607f1db0b Fix Checkstyle nohttp violation 2019-11-15 10:50:28 +01:00
Rossen Stoyanchev
c33cb26a73 Polishing contribution
See gh-1885
2019-11-14 17:38:01 +00:00
Mark Hobson
46fe74d2f9 Preserve media type parameters when setting charset
Issue: SPR-17040
2019-11-14 17:38:01 +00:00
Rossen Stoyanchev
04aa3d05da Refactor solution for respones error details
See gh-1956
2019-11-13 14:24:12 +00:00
jerzykrlk
91ec274b10 SPR-17130 http error details in the exception message 2019-11-13 14:24:12 +00:00
Rossen Stoyanchev
1261e64465 Minor refactoring
Apply default Accept header for HttpUrlConnection only.

See gh-23855
2019-11-08 08:44:04 +00:00
Lorenzo Torracchi
afae8c3045 Avoid default "Accept" from HttpUrlConnection
Closes gh-23740
2019-11-08 08:43:25 +00:00
Arjen Poutsma
bf36f49dc5 Corrupt multipart should not hang SynchronossPartHttpMessageReader
This commit notifies the Synchronoss listener that the buffer stream
has ended.

Closes gh-23768
2019-11-07 09:10:07 +01:00
Rossen Stoyanchev
3a241b546f Relax domain name checks in ResponseCookie
Closes gh-23924
2019-11-06 17:54:39 +00:00
Sam Brannen
29599a93a4 Re-enable support for invalid Expires attributes in MockCookie
Changes introduced in commit 9b2087618b
caused a regression for Cookie support in MockHttpServletResponse.
Specifically, an Expires attribute that cannot be parsed using
`ZonedDateTime.parse()` now results in an exception; whereas,
previously an entry such as `Expires=0` was allowed.

This commit fixes this issue in MockCookie by catching and ignoring any
DateTimeException thrown while attempting to parse an Expires attribute.

Closes gh-23911
2019-11-06 18:28:28 +01:00
Sam Brannen
92228f0fc0 Test status quo for @RequestHeader UUID conversion support
See gh-23939
2019-11-06 13:49:44 +01:00
Sam Brannen
9f00eb68e9 Clean up warnings 2019-10-30 19:14:58 +01:00
Sam Brannen
cef4478b7b Treat InvalidPathException like an IOException in MockServletContext
Prior to this commit, if MockServletContext was configured with a
FileSystemResourceLoader, invocations of the following methods on a
Microsoft Windows operating system resulted in an InvalidPathException
if the supplied path contained a colon (such as "C:\\temp"). This is
inconsistent with the behavior on non-Windows operating systems. In
addition, for comparable errors resulting in an IOException, those
methods (except getRealPath()) return null instead of throwing the
exception.

- getResourcePaths()
- getResource()
- getResourceAsStream()
- getRealPath()

This commit makes handling of InvalidPathException and IOException
consistent for these methods: both exceptions now result in null be
returned by these methods.

Closes gh-23717
2019-10-30 15:59:44 +01:00
Rossen Stoyanchev
34cfbe5d26 ResponseStatusException associated headers
A ResponseStatus exception now exposes extra method to return headers
for the response. This is used in ResponseStatusExceptionHandler to
apply the headers to the response.

Closes gh-23741
2019-10-30 12:10:45 +00:00
Juergen Hoeller
046380988b Nullability refinements 2019-10-30 00:26:11 +01:00
Rossen Stoyanchev
5abf24e7d7 Expose maxInMemorySize via CodecConfigurer
Centralized maxInMemorySize exposed via CodecConfigurer along with
ability to plug in an instance of MultipartHttpMessageWrite.

Closes gh-23884
2019-10-29 12:33:16 +00:00
Rossen Stoyanchev
00ead7a756 Refine multipart parsing limits
See gh-23884
2019-10-29 12:33:16 +00:00
Brian Clozel
ea6f51e9e3 Configurable limits with Synchronoss
See gh-23884
2019-10-29 12:33:16 +00:00
Brian Clozel
69bcdfc17f Polishing 2019-10-29 12:33:16 +00:00
Rossen Stoyanchev
89d053d7f4 Limits on input stream in codecs
- Add maxInMemorySize property to Decoder and HttpMessageReader
  implementations that aggregate input to trigger
  DataBufferLimitException when reached.

- For codecs that call DataBufferUtils#join, there is now an overloaded
  variant with a maxInMemorySize extra argument. Internally, a custom
  LimitedDataBufferList is used to count and enforce the limit.

- Jackson2Tokenizer and XmlEventDecoder support those limits per
  streamed JSON object.

See gh-23884
2019-10-29 12:33:16 +00:00
Sam Brannen
ce0b012f43 Polish contribution
See gh-23769
2019-10-29 13:27:39 +01:00
Vedran Pavic
9b2087618b Preserve expires attribute in MockCookie
At present, MockCookie doesn't preserve expires attribute. This has a
consequence that a cookie value set using
MockHttpServletResponse#addHeader containing an expires attribute will
not match the cookie value obtained from
MockHttpServletResponse#getHeader, since the expires attribute will get
calculated based on current time.

This commit enhances MockCookie to preserve the expires attribute.

Closes gh-23769
2019-10-29 12:56:24 +01:00
Rossen Stoyanchev
2995b6f224 Merge branch '5.1.x' 2019-09-25 17:28:24 +01:00
Rossen Stoyanchev
17c423f5af Support for sameSite attribute in WebFlux
Bypass server cookie and write Set-Cookie header directly for Reactor
Netty, and Servlet API which do not provide options.

For Undertow use the sameSite attribute.

Closes gh-23693
2019-09-25 17:16:48 +01:00
Sam Brannen
402046f3c7 Polish data buffer allocation tests 2019-09-24 14:24:36 +02:00
Sam Brannen
2572cd0503 Make PathPatternParserTests compatible with JDK 13
Closes gh-23669
2019-09-21 17:33:28 +02:00
Brian Clozel
4cfcc108fe Merge branch '5.1.x' 2019-09-17 09:49:47 +02:00
Brian Clozel
ca2b2f5533 Wait for complete disposal of Reactor Netty resources
Fixes gh-23631
2019-09-17 09:49:05 +02:00
Phillip Webb
d945ae9191 Add blank line between java and javax imports
See gh-23539

Co-authored-by: Sam Brannen <sbrannen@pivotal.io>
2019-09-16 13:41:59 +02:00
Sam Brannen
bd28bb1f56 Add additional tests for HttpHeaders.keySet() operations
See gh-22821
2019-09-16 12:36:05 +02:00
Phillip Webb
aa69703f3b Fix LinkedCaseInsensitiveMap collection methods
Ensure that results returned from keySet, entrySet & values are tracked
to remove case insensitive keys from the source map.

Closes gh-22821
2019-09-16 12:36:05 +02:00
Sam Brannen
a871f609ea Introduce failing tests for HttpHeaders
See gh-22821
2019-09-16 12:28:38 +02:00
Sam Brannen
52128fe863 Polish RequestLoggingFilterTests 2019-09-16 11:35:26 +02:00
Napster
33cee066e5 Log HTTP method in logging filters and revise log message format
Closes gh-23567
2019-09-16 11:35:26 +02:00
Sam Brannen
cf5cb9484a Add additional tests for HttpHeaders.keySet() operations
See gh-22821
2019-09-15 15:48:37 +02:00
Phillip Webb
5d785390eb Add ClientHttpRequestInitializer support
Add `ClientHttpRequestInitializer` interface that can be used with any
`HttpAccessor` to initialize each `ClientHttpRequest` before it's used.

This provides a useful alternative to `ClientHttpRequestInterceptor`
when users need to configure things like `HttpHeaders`.

Closes gh-22002
2019-09-12 16:01:46 -07:00
Rossen Stoyanchev
7194261961 Merge branch '5.1.x' 2019-09-12 21:17:00 +01:00
Rossen Stoyanchev
07b0fa132e doFilterNestedErrorDispatch delegates to filter chain
Closes: gh-23596
2019-09-12 13:42:12 +01:00
Sam Brannen
30cff46e7f Prevent improper use of testing framework APIs
Prior to this commit, a lot of work had been done to prevent improper
use of testing Framework APIs throughout the codebase; however, there
were still some loopholes.

This commit addresses these loopholes by introducing additional
Checkstyle rules (and modifying existing rules) to prevent improper use
of testing framework APIs in production code as well as in test code.

- Checkstyle rules for banned imports have been refactored into
  multiple rules specific to JUnit 3, JUnit 4, JUnit Jupiter, and
  TestNG.
- Accidental usage of org.junit.Assume has been switched to
  org.junit.jupiter.api.Assumptions.
- All test classes now reside under org.springframework packages.
- All test classes (including abstract test classes) now conform to the
  `*Tests` naming convention.
  - As an added bonus, tests in the renamed
    ScenariosForSpringSecurityExpressionTests are now included in the
    build.
- Dead JUnit 4 parameterized code has been removed from
  DefaultServerWebExchangeCheckNotModifiedTests.

Closes gh-22962
2019-09-12 11:20:56 +02:00
Sam Brannen
5d5f9aceca Avoid accidental usage of JUnit 4 assumptions
This commit also avoids starting a server if an assumption fails.
2019-09-06 16:03:36 +02:00
Sam Brannen
591995ecc8 Polish and revive disabled tests
This commit revives some previously disabled tests and converts
some usage of @Disabled to @EnabledForTestGroups(...).
2019-09-06 15:57:27 +02:00
Sam Brannen
d9e3b8b9a5 Introduce default constructor in TomcatHttpServer 2019-09-05 13:45:38 +02:00
Sam Brannen
73f5d05fd9 Avoid deprecation warning in RandomHandlerIntegrationTests 2019-09-05 13:29:01 +02:00
Phillip Webb
deba2ed1b3 Add blank line between java and javax imports
See gh-23539
2019-09-04 22:05:46 -07:00
Rossen Stoyanchev
bc81fa520e Reject range starting above resource length
Closes: gh-23576
2019-09-04 18:05:59 +01:00
Brian Clozel
0c7359911a Re-enable StreamingSimpleClientHttpRequestFactoryTests
Since the okhttp3 3.14 downgrade, we don't need to ignore this test
anymore.
2019-09-04 16:02:43 +02:00