Commit Graph

213 Commits

Author SHA1 Message Date
Ludovic Orban 2fcccef0c4 #10226 fix GZIPContentDecoder buffer leak of zero-capacity buffers
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-08-29 09:58:39 +02:00
Greg Wilkins 8ed56b3466
Implement containsLast in HttpFields (#10340)
Fully implement list iterator so that we can efficiently check for the last item in a multi header list.

---------

Signed-off-by: gregw <gregw@webtide.com>
2023-08-26 10:05:29 +10:00
Greg Wilkins 4086c7ee47
Persistent HttpFields (#10339)
Use a marked field rather than freeze/thaw, to support fields that cannot be removed.
2023-08-25 13:02:32 +10:00
Ludovic Orban 1fff9787bd #10226 - handle review comments
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-08-22 10:17:33 +02:00
Ludovic Orban 5b93435358 #10330 - handle review comments
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-08-22 10:17:33 +02:00
Ludovic Orban dd6a971f27 #10330 - Fix broken EE10 DefaultServlet range requests
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-08-22 10:17:33 +02:00
Joakim Erdfelt 2178dc2913
Issue #10309 - Duplicate `X-Powered-By` headers (#10310)
* Make HttpChannelState responsible for X-Powered-By / Server headers
* Remove X-Powered-By handling in HttpGenerator
2023-08-21 17:00:21 -05:00
Simone Bordet 660ba4bbe5
Fixes #10284 - Document all HttpFields methods (#10308)
* Added javadocs where missing and updated existing in both HttpFields and HttpField.
* Removed HttpFields.takeAsImmutable() because it had a confusing semantic.
* Deprecated HttpFields.[Mutable|Immutable]HttpFields and moved their implementation to top level package private classes.
* Deprecated HttpField.valueParameters(), as there is an identical getValueParameters()
* Fixed inconsistencies of HttpField.value, where in most cases could not be null, but in one case was allowed; now it can never be null.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-08-18 10:19:36 +02:00
gregw 13cf2dade7 Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x
# Conflicts:
#	jetty-core/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java
#	jetty-core/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java
2023-08-18 17:38:44 +10:00
Greg Wilkins 5aea1e44b7
Experiment/12/improve default servlet (#10222)
* Improve Jetty 12 DefaultServlet

 + don't wrap the httpServletRequest unless necessary due to wrapping
 + don't wrap the httpServletResponse unless necessary due to wrapping
 + send content asynchronously if large and unfiltered
 + Remove unused boolean return from ServletChannel.handle
 + added TODOs where range request handling could calculate content length
 + Call multipartlength, even though it is always -1
 + Use static for bytes written
2023-08-18 00:54:05 +10:00
Joakim Erdfelt 9c324326c5
Merge `release/12.0.0` back into `jetty-12.0.x` (#10237)
* Updating to version 12.0.0

* Updating to version 12.0.1-SNAPSHOT
2023-08-08 00:55:19 +02:00
Simone Bordet c946a41871 Fixes #10123 - MultiPartByteRanges request gets stuck
The handling of reads in MultiPartByteRanges.PathContentSource was broken for ranges that were larger than the read buffer size.

Fixed by properly counting how many bytes are left to read.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-07-18 21:37:35 +02:00
Lachlan 993a111805
Merge pull request #10071 from eclipse/jetty-12.0.x-sizeLimitHandler
add SizeLimitHandler to Jetty-12
2023-07-14 16:37:02 +10:00
Greg Wilkins 0ee0716d33
Various cleanups of StringUtil and TypeUtil (#10082)
* Various cleanups of StringUtil and TypeUtil

Removed deprecated and unused methods
Moved charset handling to MimeTypes
resolve IDE warnings

* updates from review
2023-07-12 10:31:28 +02:00
Greg Wilkins 67f194a818
Improve javadoc of Violations for #9444 (#10079)
Improve javadoc of Violations for #9444
2023-07-10 10:03:06 +02:00
Lachlan Roberts 7cee1f54ba add SizeLimitHandler to Jetty-12
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-07-06 13:59:00 +10:00
Greg Wilkins ec2dbe73a8
Fully async Multipart Form handling (#9975)
A fully async ContentSourceCompletableFuture for use by MultiPartFormData and MultiPartByteRanges
Restructure MultiPartFormData to have a Parser class
---------

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2023-06-30 17:01:16 +02:00
Greg Wilkins daa7167834
Implement quality lists for Locales (#9983)
Implement quality lists for Locales that orders known locales before unknown.
2023-06-28 14:22:13 +02:00
Greg Wilkins a3e82326cf
Experiment/jetty 12 chunk isError and warnings (#9904)
* Remove usage of instanceof Content.Chunk.Error
* Updated AsyncContent to accept a transient failures
* Updated AsyncContent to accept a transient failure with inputstream
2023-06-23 09:17:15 +02:00
Greg Wilkins 0b1c28a888
Jetty 12 inserted handler in ee10 servlet context (#9927)
This PR refactors the ee10 handing of servlet API request and response objects:

 + The ServletContextHandler matches the request to a servlet and creates a one time only ServletContextRequest and a ServletContextResponse
 + A reusable ServletChannel object with all the heavy weight HttpInput and HttpOutput object is associated with the ServletContextRequest and ServletContextResponse.
 + Once the handling reaches the ServletHandler, the possibly wrapped request, response and callback are associated with the ServletChannel before handling.
 + Were possible the ServletApiRequest and ServletApiResponse use the possibly wrapped request/response

Added tests to check that GzipHandler can now be nested inside of an EE10 context.

---------

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: gregw <gregw@webtide.com>
Co-authored-by: Ludovic Orban <lorban@bitronix.be>
2023-06-22 17:04:49 +02:00
Jan Bartel 715535ab95 Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2023-06-22 11:50:06 +02:00
Ludovic Orban 8e79c1b58b
Add `EventsHandler` API (#9901)
* #8885 add EventsHandler API

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-06-15 17:31:11 +02:00
Greg Wilkins a44a99ad9b
SetCookieHttpField #9173 (#9789)
Added utility methods and classes to allow for efficient interception of a Set-Cookie header in a HttpStream wrapper.
2023-06-07 13:50:19 +02:00
Lachlan Roberts 9acd5e83dc Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2023-05-29 16:47:59 +10:00
Greg Wilkins 18c4846b1c
Jetty 12 simplify EchoHandler (#9783) 2023-05-18 09:50:09 +02:00
Greg Wilkins 068a60a868
Simplified QuotedStringTokenizer (#9729)
Simplified QuotedStringTokenizer #9729
* Now implements a simple subset of `quoted-string` from RFC9110
* introduced builder
* Extracted QuotedStringTokenizer interface and re-introduced the legacy implementation
* Re-introduced the ability to have unescaped \ in filenames
* Whitespace is Character.isWhiteSpace
* Disable test pending RFC8187
* No OWS around =
2023-05-18 08:25:53 +02:00
Joakim Erdfelt 2fdcae40f0
Refine how Request / Channel / Stream completion works (#9684)
Fixes #9684
+ Restore LargeHeaderTest Test
+ Fix Bad Content-Length produced if write + error occurs
+ Fix race between callback failure and error handling failure
+ Introduce new ResponseCompleteTest to attempt to capture complete race issue
+ More DEBUG + ignoring failure for completeStream
+ Removed ErrorResponse in favour or an errorMode

---------

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: gregw <gregw@webtide.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2023-05-15 08:15:37 +02:00
Jan Bartel 2261ce9a50
Issue #9762 ee9 double parses cookies (#9764)
* Issue #9762 ee9 double parses cookies

* implemented the TODOs to cache servlet cookies

---------

Co-authored-by: gregw <gregw@webtide.com>
2023-05-12 17:14:44 +02:00
Lachlan Roberts 422cddf8b1 merge hpack/qpack changes to 12 from #9634
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-05-08 16:44:28 +10:00
Greg Wilkins 4c16e6a707
Jetty 12 content length 0 take3 (#9740)
* Optimize Content-Length: 0 handling

Create and use a pre-encoded HttpFields.CONTENT_LENGTH_0 constant
Used the constant in more places
renamed the `putLongField` methods of HttpFields.Mutable to just `put`
Fixed wrong docs examples
2023-05-07 19:22:15 +02:00
Simone Bordet baf72248aa
Fixed tests after merge.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-05-04 22:36:00 +02:00
Simone Bordet 3463e42861
Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-05-04 12:08:00 +02:00
Greg Wilkins 7275bf15a9
Jetty 12.0.x core security (#9405)
core security module

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: gregw <gregw@webtide.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Jan Bartel <janb@webtide.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2023-05-02 15:35:49 +02:00
Olivier Lamy 46018e6057
Jetty-12.0.x tests in parallel (down build time on CI from 1h25 to 55min) some modules are still not parallel due to some static usage (#9635)
* parallel tests runs

---------

Signed-off-by: Olivier Lamy <olamy@apache.org>
2023-04-21 10:42:12 +10:00
Ludovic Orban f28784fe0d #9410 Fix thread-safety of fail() implementations and buffer leaks
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-04-13 11:59:48 +02:00
gregw 90de876770 Fixed default for #9444 2023-04-11 11:36:11 +02:00
Lachlan 7ebd07d18d
Merge pull request #9628 from eclipse/jetty-12.0.x-9554-Hpack-Qpack
Issue #9554 - move common hpack/qpack code to jetty-http
2023-04-11 16:07:52 +10:00
Simone Bordet ca2d85d8a0
Jetty 12 rehandle welcome files (#8856)
* Introduced WelcomeMode so that now welcome files can be redirected, served, or rehandled.
* Updated ResourceHandler and DefaultServlet accordingly.
* Introduced WelcomeServletMode to replace 2 booleans.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-04-08 18:59:18 +02:00
Simone Bordet 744b37f80b
Fixes #7608 - Jetty-12 MetaData cleanup needed (#9618)
* Removed unnecessary constructors from MetaData, MetaData.Request and MetaData.Response.
* Removed MetaData.Request.getURIString() (available as getHttpURI().toString()).
* Renamed MetaData.getFields() -> getHttpFields(), as they can be headers or trailers.
* Renamed MetaData.Request.getURI() -> getHttpURI().
* Normalized handling of contentLength, now always -1 (rather than Long.MIN_VALUE) if unknown.
* Permutated MetaData.Response constructor parameters to be consistent with MetaData.Request.
* MetaData.Request's method and httpURI must be non-null.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2023-04-07 21:23:01 +02:00
Lachlan Roberts e187309c6c move huffman tables into separate class
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-04-05 21:13:30 +10:00
Lachlan Roberts 183291ee64 Issue #9554 - un-duplicate implementation for HPACK integer decoding.
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-04-05 16:35:06 +10:00
Lachlan Roberts 7fb5b422fe Issue #9554 - un-duplicate implementation for HuffmanDecoder
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-04-05 16:04:04 +10:00
Lachlan Roberts f6688b0208 Issue #9554 - move Hpack/Qpack common classes to jetty-http
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
2023-04-05 15:56:17 +10:00
Greg Wilkins 8636666eec
Jetty 12 - Remove ISO-8859-1 fallback decoding during UTF-8 decoding (#9507)
* Deleted the Ut8fStringBuffer and Utf8Appendable classes in favour of just having Utf8StringBuilder
* Simplified the Utf8StringBuilder and CharsetStringBuilder APIs and improved their exception throwing.
* Allow for replacement characters without throwing

---------

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: gregw <gregw@webtide.com>
Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2023-04-04 10:57:07 +02:00
Ludovic Orban 46a250ebe8
#9538 - fixed testParallelContentSourceListenersTotalFailure (#9543)
* #9538 - fixed testParallelContentSourceListenersTotalFailure

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2023-03-29 23:00:45 +02:00
Joakim Erdfelt 46cdb70449
Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2023-03-20 12:05:57 -05:00
Greg Wilkins bd0186c2f7
Jetty 12.0.x 9444 servlet paths fully decoded (#9479)
getServletPath and getPathInfo will never return an encoded path segment. Instead, they will throw an IllegalArgumentException if they are called when there is a URI with violations.

Signed-off-by: gregw <gregw@webtide.com>
Co-authored-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2023-03-11 14:13:09 +01:00
Greg Wilkins b63c5ef611
HttpMessage interface for BadMessageException
Convert class BadMessageException to a HttpMessage.RuntimeException to allows different types of HttpExceptions exceptions.
This follows the pattern of the QuietException interface.
2023-03-10 09:59:05 +01:00
Joakim Erdfelt 0099491435
Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x 2023-03-08 14:31:45 -06:00
Greg Wilkins 916cd9894d
Decode safe Path for #9444 (#9455)
Added URIUtil.decodeSafePath for EE10, to allow for %2F and %25 to remain encoded in the servlet API.
Fixed async dispatch to also safeDecode
Updated tests to expect decoded space
Apply suggestions from code review

Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2023-03-03 14:36:19 +01:00