* Fixes#5845 - Use UTF-8 encoding for client basic auth if requested.
* Introduced get/setCharset in BasicAuthenticator on server-side.
* Looking for the "charset" parameter on the client-side, and if there, use it.
* Added test case.
* Code cleanups.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Changed the AbstractConnectionPool.acquire() logic to call tryCreate() even
when create=false.
This is necessary when e.g. a sender thread T2 with create=true steals a
connection whose creation was triggered by another sender thread T1.
In the old code, T2 did not trigger the creation of a connection, possibly
leaving a request queued.
In the new code, T2 would call tryCreate(), possibly triggering
the creation of a connection.
This change re-introduces the fact that when sending e.g. 20 requests
concurrently, 20+ connections may be created.
However, it is better to err on creating more than creating less and leaving
requests queued.
Further refactoring moved field pending from Pool to AbstractConnectionPool.
As a consequence, AbstractConnectionPool.tryCreate() now performs a
demand/supply calculation to decide whether to create a new connection.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Greg Wilkins <gregw@webtide.com>
* enable spotbugs in CI
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
record issues
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
use warning new generation
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
activate errorprone
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
fix Jenkinsfile
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
do not run spotbugs for jetty-runner as we do not want to fix all dependencies bugs :)
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
junit should allow empty results
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
maven console can be use only once...
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
one liner
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
recordissues only once
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
force id
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
aggregate results
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
configure a name for aggregated reports
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
mo more -T3 no need anymore of remote session test profile
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
I want to see what failing tests look like with new report.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
skip spotbugs for jetty-jmh
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
get rid of findbugs as we now have spotbugs
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
Revert "I want to see what failing tests look like with new report."
This reverts commit df0d13e4c53d7461872e1f925ec06bd36e4a66c9.
activate errorProne parser
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
make pmd quiet for CI
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
remove -fae flag and do not display transfer progress
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
try junitParser() to see what it does
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
junit parser is a bad idea...
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
increase timeout
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
no -T2 for javadoc
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
fix skip spotbugs and pmd verbose
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
* remove -T options
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
The upgrade could happen in the context of a HttpParser.parseNext()
call, which eventually upgrades the EndPoint, passing what remains in
the NetworkBuffer to the new Connection and releasing the NetworkBuffer.
The messageComplete() parser callback was still returning false even
if the response was 101, causing the HTTP/1.1 parser to continue, but
now the NetworkBuffer was null, producing the NullPointerException.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Introduced HttpDestination.send(Request, Response.CompleteListener) to send a request using the given destination.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Make EOF and errors be special content.
Transition to a much simplified FSM by using the needContent() / produceContent() model.
Implement blocking on top of async, this way there is only one FSM.
(Milestone 6)
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
The problem was a race condition during content decoding.
Since decoding needs to be done in a loop, the condition to loop is to
check whether there is demand for the next chunk of decoded content.
Checking for demand also sets the stalled flag, and this must be done
only after the response state has been set back to CONTENT.
Unfortunately this was not done in the decoding loop.
The fix is to always update the response state in the decoding loop.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Fixes#5379 - Better handling for wrong SNI.
Reworked the SNI logic.
Added support for IP addresses in the SAN extension of certificates in the X509 class.
Fixed keystores to have CN=localhost and SAN with ip=127.0.0.1 and ip=[::1].
Fixed tests that were not using the correct Host header.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Issue #5357 - Updating to https://eclipse.org/
- Removing redundant <url> refs in pom.xml
- Correcting bad indenting from merge
- Correcting mailing list references
- Correcting bugs.eclipse.org references
- Correcting text file references
- Correcting html references
- Correcting further references
- Correcting download.eclipse.org reference
- Adding test for demo-base /proxy/current/
- Ensuring jetty-client is included in javadoc-proxy.war/WEB-INF/lib
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
* Issue #5304 HTTP2 HostHeader
Updated HostHeaderCustomizer to actually add the Host header, either from values passed in the custructor or from the getServerName and getServerPort methods.
The HttpURI is no longer updated.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #5304 HTTP2 HostHeader
+ Found and fixed bug in HttpFields
+ Added port normalization support to HttpScheme
+ added test
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* blank line
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #5304 HTTP2 HostHeader
+ refixed bug in HttpFields
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #5304 HTTP2 HostHeader
+ still fixing HttpFields bug
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #5304 HTTP2 Host Header
updates from review
* Speculative idea to make a pluggable Pool strategy
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Speculative idea to make a pluggable Pool strategy
+ javadoc
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Speculative idea to make a pluggable Pool strategy
+ Added a ThreadLocalStrategy for a single cached item
+ Tell strategies about newly reserved entries
+ Fixed multiplexing test that was dependent on the impl of the cache
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Speculative idea to make a pluggable Pool strategy
+ added tests
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Feedback from review
+ Don't have a fallback iteration, instead make a SearchStrategy and DualStrategy
* Feedback from review
+ split strategies into Cache and Strategies
* Feedback from review
+ Added reserve and release
* Improved Pool Strategies:
+ reverted to post notifications for removed, reserved and released.
+ Added a few more strategies that need to be benchmarked, that use the list iterator.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Testing all the different strategies
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* More simplifications and made LRU work (ish)
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* javadoc
* More javadoc
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* JMH Test
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* one strategy
Signed-off-by: gregw <gregw@webtide.com>
* test
Signed-off-by: gregw <gregw@webtide.com>
* Split implementations:
+ pluggable strategies
+ hard coded
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* More benchmarks
* Built in strategy
* removed strategies version and simplified to single configurable solution.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* updates from review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* better javadoc
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Updated ConnectionPool classes to use Pool strategies
* Small javadocs fixes.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Updates from review
* javadoc
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
* Fixes#3766 - Introduce HTTP/2 API to batch frames.
Introduced Stream.FrameList to hold HEADERS+DATA+HEADERS frames.
These are often used by the client and by the server when the
request/response content is known and FrameList will allow to
send them in a single TCP write, rather than multiple ones.
Rewritten HttpSenderOverHTTP2.sendHeaders() and
HttpTransportOverHTTP2.sendHeaders() to take advantage of
FrameList.
Now using ConcurrentHashMap as a client context, because
with DEBUG logging enabled it may be access concurrently.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Reworked HTTP/2 release after an exchange is terminated.
Previously, the release was bound to 2 events: onStreamClosed(),
introduced for #2796, and exchangeTerminated().
Unfortunately, if the former happens before the latter and
closes the connection, the latter will see the exchange as
aborted, while in fact it was successful, causing what
reported in #5147, an AsynchronousCloseException.
Now, the release is always performed by the exchangeTerminated()
event. With respect to #2796, the stream is always already
closed by the time the exchangeTerminated() event fires (it
was not before).
Reworked the implementation of RoundRobinConnectionPool using
a lock and aggressively trying to open new connections.
A second fix is related to HttpDestination.release(Connection).
If the connection is closed for e.g. overuse, we need to trigger
the processing of queued requests via send(create: true).
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Now closing the connection if an unsolicited response is detected,
no matter what response status code, or whether it has a
Connection: close header, or whether it's just random bytes from
the server, and also no matter whether the client read -1.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Implemented as part of #4975.
Added a test case that proves that the connection is closed
when the max usage count is reached.
Improved logging.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Some updates to the new Pool class:
+ fixed a race with pending reservations
+ use a pending counter
+ Reservation API to simplify Entry API
+ removed public methods on Entry API
* Some updates to the new Pool class:
+ fixed a race with pending reservations
+ use a pending counter
+ Reservation API to simplify Entry API
+ removed public methods on Entry API
* Updates from review
* Updates from review
Tests for cache size and acquire with creator
* Method no longer required with Reservation
* update from the feedback on the feedback of the feedback from the review.
Moved enable to Entry, removed Reservation class and clarified usage in javadoc
* Issue #5095 XmlConfiguration locking Use pool instead of static shared instance
fixed javadoc
* Issue #5095 XmlConfiguration locking Use pool instead of static shared instance
fixed javadoc
* Issue #5095 XmlConfiguration locking Use pool instead of static shared instance
fixed javadoc
* Issue #5095 XmlConfiguration locking Use pool instead of static shared instance
updates from review
On the client:
* Origin.Address.host is passed through HostPort.normalizeHost(),
so that if it is IPv6 is bracketed.
Now the ipv6 address passed to an `HttClient` request is bracketed.
* HttpRequest was de-bracketing the host, but now it does not anymore.
On the server:
* Request.getLocalAddr(), getLocalName(), getRemoteAddr(),
getRemoteHost(), getServerName(), when dealing with an IPv6 address,
return it bracketed.
The reason to return bracketed IPv6 also from *Addr() methods is that
if it is used with InetAddress/InetSocketAddress it still works, but
often it is interpreted as a URI host so brackets are necessary.
* DoSFilter was blindly bracketing - now it does not.
Added a number of test cases, and fixed those that expected
non-bracketed IPv6.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Replaced relevant usages of synchronized with AutoLock.
* Made AutoLock serializable since classes that use it may be stored in the HttpSession.
* Added convenience methods to AutoLock to execute lambdas with the lock held.
* Introduced AutoLock.WithCondition to use a Lock and a Condition together.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Replace uses of Random with SecureRandom.
We do not believe any of these uses of Random represent any security vulnerability, but we are making this
change for an abundance of caution and to avoid warnings from 3rd party scanning tools.
For some reason, Request.getHeaders() returned HttpFields,
but HttpRequest.getHeaders() returned HttpFields.Mutable,
and it was obviously wrong.
Fixed WebSocket code that was relying on this API error.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Fixed MaxConcurrentStreamsTest - it was always broken.
The problem was that the call to super.onSettings(...) was done
_after_ sending the request, so the connection pool was still
configured with the default maxMultiplex=1024.
Also fixed AbstractConnectionPool to avoid a second call to
activate() if we are not trying to create a new connection.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Fixed MultiplexConnectionPool.acquire() to use the new boolean
parameter to decide whether or not create a new connection.
This fixes ConnectionPoolTest instability.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Fixes#4976 HttpClient async content throws NPE in DEBUG log.
Reworked handling of asynchronous content by immediately exiting
HttpReceiverOverHTTP.process(), so that there is no race with
other threads that have been scheduled to resume the processing.
The call to HttpReceiver.dispose() that could be triggered by
an asynchronous failure is now performed either by the failing
thread (if the HttpReceiver is not processing) or by an I/O
thread (if the HttpReceiver is processing) similarly to what
happens when terminating the response.
The content decoding has been reworked to perform the required
state changes similarly to what non-decoded content is doing,
as this was completely lacking before (it was actually a side
bug that is now fixed).
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Ludovic Orban <lorban@bitronix.be>
* Fixes#4904 - WebsocketClient creates more connections than needed.
Fixed connection pool's `acquire()` methods to correctly take into account the number of queued requests.
Now the connection creation is conditional, triggered by
explicit send() or failures.
The connection creation is not triggered _after_ a send(),
where we aggressively send more queued requests - or
in release(), where we send queued request after a previous
one was completed.
Now the connection close/removal aggressively sends more
requests triggering the connection creation.
Also fixed a collateral bug in `BufferingResponseListener` - wrong calculation of the max content length.
Restored `ConnectionPoolTest` that was disabled in #2540, cleaned it up, and let it run for hours without failures.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added test to replicate the traffic seen in the issue.
The test shows that we do close the server EndPoint.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Introduced:
* Request Request.headers(Consumer<HttpFields.Mutable>).
This allows applications to modify the headers, and chain calls.
It also delegates the precise semantic of put/add/remove/clear to HttpFields, so there is no API duplication.
* HttpRequest.header(HttpField) to efficiently add fields while normalizing the request (only used in implementation).
* HttpResponse.header(HttpField) to efficiently add fields while parsing the response (only used in implementation).
This pairs with HttpResponse.trailer(HttpField).
* HttpResponse.headers(Consumer<HttpFields.Mutable>) to modify the fields after they have been populated (only used in tests).
Removed:
* Request.[set,add,put,remove], replaced by headers(Consumer<HttpFields.Mutable>).
Deprecated:
* Request.header(String, String)
* Request.header(HttpHeader, String)
Both replaced by headers(Consumer<HttpFields.Mutable>) with clearer semantic for add/put/remove.
All the rest is code cleanup to remove the usage of the deprecated header() methods.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Made HttpURI, HttpFields and MetaData immutable. The first two follow the same builder pattern and MetaData is constructor injection only.
* Immutable version of HttpFields
Preserve API and usage of HttpFields class while providing a read only interface and immutable implementation.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable version of HttpFields
Use an ArrayList in HttpFields. While slightly slower than the array, it will mostly be used as a builder pattern for an Immutable
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable version of HttpFields
Fixed exception type.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable version of HttpFields
asImmutable method
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData
Made HttpURIU immutable with a builder pattern.
MetaData immutable and working within http module.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData
Fixes from review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData
Passing tests upto and including jetty-server
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData
Cleanup of HttpURI.Builder API as suggested in PR.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData
Added builder for MetaData.Request
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData
more api fixes
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData
WIP making HttpFiels itself immutable. Currently working up to jetty-servlet.
Need to consider if content-length really is meta data and how much and when can we trust it.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData
WIP
Need to consider if content-length really is meta data and how much and when can we trust it. Also need to consider difference between h2 and h1 authority in metadata.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
jetty-client and jetty-servlet passing tests.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
Better align the style of immutability between `HttpFields` and `HttpURI`.
They both now have static build() and from() methods, plus Builder and Immutable implementations.
Potentially `Builder` could be renamed as `Mutable`
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
http2-server tests passed
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
http2-client tests passed
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
cleann build?
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
fix
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
more test fixes
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
Cleanups, mostly using EMPTY when appropriate.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
Cleanups, use immutable
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
No trailers for connect
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
Fix CONNECT path handling
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
fixed rewrite query handling
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
rename Builders to Muttables
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
misc cleanups
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
Revert to using arrays due to garbage generated by streams and iterators (12% of a simple benchmark!).
Even if this garbage is an artifact of the JIT being disabled by observation, it can hide other allocations, so best to just use simple arrays!
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
More optimizations and better test coverage.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable Metadata
various cleanups
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
More optimizations
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
review changes
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
changes after review:
+ less usage of Mutable
+ more usage of EMPTY
+ restored fragment handling
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
changes after review:
+ less usage of Mutable
+ less usage of asImmutable
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData WIP
changes after review:
+ less usage of Mutable
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData
changes after review:
+ better handling of URI in ContextHandler
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData
changes after review:
+ downcast in test to access mutable response headers.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Immutable MetaData
changes after review:
+ use put instead of add for one time headers
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* private
Signed-off-by: Greg Wilkins <gregw@webtide.com>
For some historical reason, host and port were not mutable after the request
was created. Since many other key parameters are mutable (e.g. the scheme)
it makes sense to make host and port mutable too.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Introduced NetworkTrafficSocketChannelEndPoint to replace
NetworkTrafficSelectChannelEndPoint, now deprecated.
Code and javadocs cleanup.
Moved the tests to jetty-client so that also the client is tested.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Review updates.
* Now AbstractRequestContent supports multiple subscriptions.
* Reviewed abort() path to fail the content and the subscription
and notify FailureListener sequentially with other listeners.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Introducing jetty-slf4j-impl
* Make Jetty use org.slf4j
* Removed most of org.eclipse.jetty.util.log classes
* Left org.eclipse.jetty.util.log.Log and
org.eclipse.jetty.util.log.Logger but as
simple bridge classes that are deprecated
* Migrated code using org.eclipse.jetty.util.log.StacklessLogging
to org.eclipse.jetty.logging.StacklessLogging found in
the jetty-slf4j-impl
* Moved logging start modules from jetty-util to jetty-home
* Simplified logging start modules
* Updated code that was using StdErrLog directly
* Updating module-info.java for org.slf4j
* removing org.eclipse.jetty.util.log.class references
* jetty-start supports manually declared default provider
+ and we use it to default "logging" to the "logging-jetty" provider
* Cleaning up jetty-maven-plugin and IT testing for Logging
* Using old slf4j for it testing
* Updating compiler config to show Xlint:exports warnings
* Updating console-capture and logging-noop
* Adding slf4j bridge (capture) jetty modules
* Updates to jetty logging module locations
* Changing reference to slf4j dependent mod
* Process requested enabled modules in topological order
* Limiting inclusions in shaded jetty-start
+ Also adding note to jetty-util classes that are used by
jetty-start
* Default logging level on baseline logging config is INFO (not DEBUG)
* Changing from system to server classes in logging
* Updating other modules to use new logging names
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
* Moved implementation of UpgradeTo from HTTP2ServerConnection
to HTTP2Connection, since now also the client connection
can be upgraded to.
* Split HTTP2Session.newStream(), since now the client must
be able to create the implicit stream 1 corresponding to
the HTTP/1.1 upgrade request, so that the HTTP/2 response
after the upgrade finds the stream.
* The HTTP/1.1 upgrade mechanism has been generalized.
Before it was based on HttpConnectionUpgrader and a hook
in HttpChannelOverHTTP.exchangeTerminating().
Now it is based on UpgradeProtocolHandler that when sees
a 101 response it will trigger the upgrade mechanism.
* Introduced ConnectionPool.accept(Connection) to transfer
a connection from the HTTP/1.1 connection pool to the
HTTP/2 connection pool after the upgrade.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Introduced Request.Content with a reactive model to provide
request content.
Introduced RequestContentAdapter to wrap ContentProviders
into Request.Content.
Updated implementation to use the reactive model rather than
the old pull model.
Reimplemented all ContentProviders in terms of Request.Content.
Converted most of the tests from ContentProvider to Request.Content.
Updated proxy servlets and documentation.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Generified the API to expose TLVs, so that they are all exposed,
not only the custom TLV types in the 0xE0-0xEF range.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Updated the keystores to PKCS12 and added the Basic Constraint CA:true
to the server certificate.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Fixed visibility of ProxyProtocolConnection.
Must be protected because it's the return type
of protected methods.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Introduced HttpRequest.normalized() to test and set whether
the request has already been normalized.
Added test case and few cleanups.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Fixes#4421 - HttpClient support for PROXY protocol.
Implemented support for the PROXY protocol in HttpClient.
Introduced Request.tag(Object) to tag requests that belong
to the same group (e.g. a client address) so that they can
generate a different destination.
The tag object may implement ClientConnectionFactory.Decorator
so that it can decorate the HttpDestination ClientConnectionFactory
and therefore work both with and without forward proxy configuration.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Now setting correctly the host and port to the server destination
_after_ the SOCKS tunnel is established, similarly to what is done
for the HTTP CONNECT tunnel.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
In case of multiple parts only the last iterator was closed.
Now, every part's iterator is closed.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Now the various content listeners inherit from each other, like
it should have been from the beginning.
This also allowed to remove code duplication due to the default
implementation of the methods in various places.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>