Commit Graph

1285 Commits

Author SHA1 Message Date
Simone Bordet eaa4c70cfc Issue #2065 - Backport #347 to Jetty 9.2.x.
Implemented as integer guard + timestamp.
The timestamp is not enough to guard against long times spent sending
(and/or in application callbacks during sends).
2017-12-16 22:25:59 +01:00
Simone Bordet ce4fad3deb Fixes #2065 - Backport #347 to Jetty 9.2.x. 2017-12-15 17:48:47 +01:00
Greg Wilkins c6c5a3b890 Merge branch 'issue-2022' of https://github.com/Baqend/jetty.project into jetty-9.4.x-2022-FineGrainedComplianceModes 2017-12-15 16:19:14 +01:00
fb 7ee8bb82c6 Same code style fixes and remove unnecessary code reformatting
Signed-off-by: fb <fb@baqend.com>
2017-12-15 15:23:17 +01:00
fb a324a5ad77 Implement weak http header parsing and make the compliance mode configurable in the client
Signed-off-by: fb <fb@baqend.com>
2017-12-15 15:13:48 +01:00
fb b76240e678 Fixes #2022 - Ignore invalid chars in http header names, when the compliance mode is not RFC7230
Signed-off-by: fb <fb@baqend.com>
2017-12-15 15:12:34 +01:00
Simone Bordet d3db89d7e3 Fixes #2019 - Expose HttpClientTransport in JMX.
Added missing @ManagedObject annotation to AbstractConnectorHttpClientTransport.

Also exported to JMX the "multiplexed" attribute for the FCGI transport
and the "useALPN" attribute for the HTTP/2 transport.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2017-12-14 12:28:46 +01:00
Simone Bordet ba5ed4c6ce Issue #2050 - Clarify ObjectMBean getObject[Name|Context]Basis() methods.
Clarified the role of the HttpClient name with respect to JMX.
Improved test case.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2017-12-14 11:24:43 +01:00
Simone Bordet f2bf3d63bc Fixes #2020 - Introduce a name for `HttpClient` instances.
Added HttpClientMBean, and overridden getObjectContextBasis() so that
the HttpClient name is inherited by children components such as the
HttpClientTransport, the ThreadPool, etc.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2017-12-14 11:24:43 +01:00
Greg Wilkins c66bacba02 Issue #922 (#1965) bytesIn/Out stats
Ensure -1 fill is not appended to bytesIn counts
Don't include discarded bytes from head responses in counts
refactored gather writes in HttpConnection to be clearer and removed
redundant buffer checks
2017-11-14 09:12:00 +01:00
Olivier Lamy 786f128808 implements connection.getBytes[In|Out] for http transport #922 (#1965)
* implements connection.getBytes[In|Out] for http transport, #922

Signed-off-by: olivier lamy <olamy@webtide.com>

* use LongAdder rather than AtomicLong

Signed-off-by: olivier lamy <olamy@webtide.com>

* changes by Greg review

Signed-off-by: olivier lamy <olamy@webtide.com>

* changes by Greg review

Signed-off-by: olivier lamy <olamy@webtide.com>
2017-11-14 08:41:47 +01:00
Simone Bordet 333c22d670 Issue #1924 - ManagedSelector livelock.
* Actually using the MAX_ACTION_PERIOD value rather than a harcoded one.
* Waking up the selector outside the sync block.
2017-10-30 00:36:01 +01:00
Greg Wilkins ab849e8cc5 Issue #1920 - Connect Timeouts with NonBlocking CreateEndPoint.
Added a LiveLock (BusyBlocking) test.
Modified ManagedSelector to fair share between actions and selecting
2017-10-28 14:55:40 +11:00
Simone Bordet 76e744979b Issue #1893 - Jetty HttpClient Connection TTL.
Removed test for TTL functionality.
Added test for the round robin behavior.
2017-10-25 11:22:46 +02:00
Simone Bordet 6e8242d1a4 Issue #1893 - Jetty HttpClient Connection TTL.
Removed the functionality, not needed anymore.
2017-10-25 11:02:33 +02:00
Simone Bordet ddf074d78f Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2017-10-23 17:37:23 +02:00
Simone Bordet 4d8ab1828e Merged branch 'jetty-9.2.x' into 'jetty-9.3.x'. 2017-10-23 17:36:39 +02:00
Simone Bordet e449387158 Fixes #1914 - jetty client fails to parse response with RFC2045 conformant Content-Type: charset="utf-8". 2017-10-23 17:36:11 +02:00
Simone Bordet 0d3827d882 Fixes #1893 - Jetty HttpClient Connection TTL.
Implemented live timeout on RoundRobinConnectionPool.
2017-10-19 17:47:35 +02:00
Simone Bordet d2fc88839c Added/fixed @ManagedObject annotation. 2017-10-19 17:47:35 +02:00
Simone Bordet 850e70f27c Fixes #1897 - Introduce a round-robin connection pool for HttpClient. 2017-10-16 18:21:36 +02:00
Simone Bordet 91c11f5a64 Fixes #1888 - Implement cookie matching on Path attribute.
Implemented path matching following RFC 6265.
2017-10-11 17:39:06 +02:00
Simone Bordet a436b9eb6c Fixes #1878 - Handle 100 Continue response without Expect header.
Fixed - again - accept().
2017-10-09 15:59:41 +02:00
Simone Bordet 6fd3351272 Fixes #1878 - Handle 100 Continue response without Expect header.
Fixed accept() to test for the response code being indeed 100.
2017-10-09 13:38:17 +02:00
Simone Bordet c69c7b29c7 Fixes #1878 - Handle 100 Continue response without Expect header. 2017-10-09 12:08:24 +02:00
Simone Bordet a4d7b4c4dc Removed unnecessary code. 2017-10-03 10:19:06 +02:00
Simone Bordet 3b98a6c000 Issue #1851 - Improve insufficient thread warnings/errors.
ThreadBudget -> ThreadPoolBudget.
Added selectors to the leased threads.
2017-10-02 13:40:31 +02:00
Simone Bordet 17a1484143 Code cleanups.
Removed unnecessary imports and fixed typos.
2017-10-02 11:43:45 +02:00
Greg Wilkins 7d98cbb870 Issue #1851 Improve insufficient thread warnings/errors
Squashed commit of the following:

commit 1d9e8e4b4d53898cb6435f67529347bd2ba82cf0
Merge: 7280594 55b0f10
Author: Greg Wilkins <gregw@webtide.com>
Date:   Thu Sep 28 07:20:37 2017 +1000

    Merge branch 'jetty-9.4.x' into jetty-9.4.x-1851-ThreadBudget

commit 7280594a0058538b603ad35625713a79830e9b93
Author: Greg Wilkins <gregw@webtide.com>
Date:   Wed Sep 27 22:48:58 2017 +1000

    fixed headers

commit f962f18e5b098ae40846ee3832736ee4650aed84
Author: Greg Wilkins <gregw@webtide.com>
Date:   Wed Sep 27 18:12:33 2017 +1000

    Issue #1851 added reset

commit a63894de284c8d8dc5ed031f1f6e0fccaf6c7715
Author: Greg Wilkins <gregw@webtide.com>
Date:   Wed Sep 27 18:08:53 2017 +1000

    Issue #1851 improved test

commit 8bcc460dc63273165305a7adcb88e991e30de4b7
Author: Greg Wilkins <gregw@webtide.com>
Date:   Wed Sep 27 18:03:47 2017 +1000

    Issue #1851 Improve insufficient thread warnings/errors

    Refactor approach to use Leases, to handle multiple executors

commit fe4be5f56594f342ab5c2e6c886397d9b4fe9c14
Merge: abc5eac a248d38
Author: Greg Wilkins <gregw@webtide.com>
Date:   Wed Sep 27 15:37:56 2017 +1000

    Merge branch 'jetty-9.4.x' into jetty-9.4.x-1851-ThreadBudget

commit abc5eac2b73d306a91b28ef4db778455095a5bdb
Author: Greg Wilkins <gregw@webtide.com>
Date:   Wed Sep 27 12:20:03 2017 +1000

    Issue #1851 Improve insufficient thread warnings/errors

    Created a ThreadBudget class that can be used to warn/error for
    registered and unregistered allocations of threads.

    The server on doStart does an unregistered check of all its components that
    implement the Allocation interface.

    The client will register itself as an Allocation if a shared Executor is used.
2017-09-28 07:35:05 +10:00
Simone Bordet 6aafc3b792 Fixes #1845 - Allow null User-Agent in HttpClient. 2017-09-25 13:03:26 +02:00
Greg Wilkins a6f02c26a8 Issue #1509 Review GZIPContentDecoder buffer pooling
A temporary fix that uses a hueristic to limit the pool size.

Perhaps such a hueristic should be the default for the queue size of all ByteBufferPools, as infinite queue size is rarely going to be a good thing?

Also, I think all the pools need to have better javadoc, plus an upper/lower bound of the size of buffer that they will pool, as gzip will tend to ask for lots of random sized buffers to put the expanded data into, some could be very
large and unlikely to be reused.
2017-09-21 14:29:58 +10:00
Simone Bordet aa4a77794e Issue #212 - HttpClient to support pluggable AuthenticationStore.
AuthenticationStore must be initialized eagerly.
2017-09-14 13:00:52 +02:00
Simone Bordet ce9be291d3 Fixes #212 - HttpClient to support pluggable AuthenticationStore. 2017-09-14 11:29:39 +02:00
Simone Bordet c402f8d5fa Fixed test after #1804. 2017-09-11 17:03:22 +02:00
Simone Bordet b078c910a7 Code cleanup: replaced anonymous inner classes with lambdas. 2017-09-11 17:02:32 +02:00
Simone Bordet 6c44538bb6 Fixes #1750 - PoolingHttpDestination creates ConnectionPool twice.
Now destinations needs to be started in tests, take 2.
2017-08-18 19:36:27 +02:00
Simone Bordet 7390707e07 Fixes #1750 - PoolingHttpDestination creates ConnectionPool twice.
Now destinations needs to be started in tests.
2017-08-17 16:37:13 +02:00
Simone Bordet 3b805123b8 Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2017-08-17 11:47:56 +02:00
Simone Bordet bcf96517bd Fixes #1750 - PoolingHttpDestination creates ConnectionPool twice. 2017-08-17 11:42:56 +02:00
Simone Bordet c395097812 Fixes #1749 - Dump HttpDestination exchange queue.
Improved code.
2017-08-17 11:42:27 +02:00
Simone Bordet 2bfe6fa964 Fixes #1749 - Dump HttpDestination exchange queue. 2017-08-17 11:15:23 +02:00
Joakim Erdfelt 1311052b15 Cleaning up state of branch to match the original jetty-9.4.x
+ Does not include changes to /jetty-cdi/
+ Does not include changes to /jetty-websocket/ for javax.websocket-1.1
2017-08-08 09:47:04 -07:00
Simone Bordet b1b569bd23 475546 - ClosedChannelException when connecting to HTTPS over HTTP proxy with CONNECT.
Not closing the connection if the request method is CONNECT.
2017-08-08 09:15:49 -07:00
Simone Bordet 8cfd971f92 JavaDoc clarification. 2017-08-08 09:15:14 -07:00
Simone Bordet 191b6e044f Fixes #1656 - Improve configurability of ConnectionPools.
Introduced ConnectionPool.Factory and HttpClientTransport.connectionPoolFactory.
This allows applications to create a ConnectionPool given the HttpDestination.
2017-08-08 09:14:19 -07:00
Simone Bordet be970de6db 475546 - ClosedChannelException when connecting to HTTPS over HTTP proxy with CONNECT.
Not closing the connection if the request method is CONNECT.
2017-08-02 22:29:28 +02:00
Simone Bordet 1ac103b6ce Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2017-05-17 13:16:21 +02:00
Simone Bordet d53af5d737 Fixes #523 - TLS close behaviour breaking session resumption.
Since requests cannot be connection delimited, don't call
sslEngine.closeInbound() on the server.

On the client, added a configuration parameter to allow missing
TLS Close Message, since many servers do that.

Introduced SslConnection.allowMissingCloseMessage so that it
throws in case of truncation attacks.
2017-05-17 13:07:21 +02:00
Simone Bordet e7ac447d63 Fixes #1452 - Add tests for [want|need]ClientAuth. 2017-04-05 15:27:57 +02:00
Simone Bordet 7fc3dac5f3 Removed truststore.jks, not needed. 2017-04-05 15:27:57 +02:00
Simone Bordet c285d6f8bb Fixes #612 - Support HTTP Trailer.
Added support on both the server and the client, for HTTP/1 and HTTP/2.
2017-04-03 22:25:50 +02:00
Joakim Erdfelt 59c31a40e3 Merge remote-tracking branch 'origin/jetty-9.3.x' into jetty-9.4.x 2017-03-14 12:07:57 -07:00
Joakim Erdfelt f293f637c8 Issue #1394 - fix default character encoding for surefire testing 2017-03-13 11:10:10 -07:00
Joakim Erdfelt 01d539e2be Merge remote-tracking branch 'origin/jetty-9.3.x' into jetty-9.4.x 2017-03-09 14:20:19 -07:00
Joakim Erdfelt d2e35e239a Windows Test Issue
+ Changing from @Test(expect=<exception>) to
  @Rule ExpectedException for ...
  * no exception occuring when one is expected is a test failure
  * wrong exception is a test failure
  * wrong cause is a test failure
2017-03-09 06:51:57 -07:00
Greg Wilkins 0a2da4822d Merge remote-tracking branch 'origin/jetty-9.3.x' into jetty-9.4.x 2017-03-06 14:20:23 +11:00
Simone Bordet affeb67f1a Issue #1375 - Support pushed resources in HTTP client.
Implemented in the non-API HttpRequest class.
2017-03-05 19:01:08 +01:00
Carter Kozak 1a2bb90465 Issue #1309 Client GZIPContentDecoder uses client ByteBufferPool
Previously the GZIPContentDecoder would allocate a new buffer for
each gzip encoded response.

Signed-off-by: Carter Kozak <c4kofony@gmail.com>
2017-02-07 09:53:39 -05:00
Simone Bordet 7923032582 Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2017-02-02 00:24:51 +01:00
Greg Wilkins 461c6082ae Issue #1296 - Introduce HTTP parser "content complete" event. 2017-02-01 23:54:36 +01:00
Simone Bordet 0c8273f2ca Happy New Year 2017. 2017-01-19 19:26:41 +01:00
Simone Bordet 07838b057f Happy New Year 2017. 2017-01-19 18:54:03 +01:00
Simone Bordet 347c48d657 Revert "resolve merge and update license headers"
This reverts commit 53b31b03dd, reversing
changes made to 4565c186d7.
2017-01-19 18:26:43 +01:00
Jesse McConnell 53b31b03dd resolve merge and update license headers 2017-01-19 09:33:16 -06:00
Jesse McConnell ce3e6dafec update license headers to 2017 2017-01-19 09:30:00 -06:00
Simone Bordet 3883b8cbb5 Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2017-01-16 19:20:24 +01:00
Simone Bordet ddc63066fc Fixes #1259 - HostnameVerificationTest.simpleGetWithHostnameVerificationEnabledTest is broken.
When a fill() triggered by a flush() throws, now the write flusher is
failed rather than completed.
This ensures that both the read and the write side see the same
exception, rather than the write side seeing a ClosedChannelException.
2017-01-16 19:05:09 +01:00
Greg Wilkins 217d7af3d5 Issue #1259 ignoring broken test 2017-01-13 15:25:22 +11:00
Greg Wilkins 20ac50480c Re added the ERROR handling for #1242 2017-01-12 09:06:22 +11:00
Simone Bordet bc86ce4d09 Fixed tests and suppressed expected exceptions. 2017-01-12 09:05:09 +11:00
Greg Wilkins 0f3f051f0e Revert "Fixed tests and suppressed expected exceptions."
This reverts commit 77b1617fdd.
2017-01-12 08:55:35 +11:00
Simone Bordet 77b1617fdd Fixed tests and suppressed expected exceptions. 2017-01-10 15:54:37 +01:00
Simone Bordet d0930e1b9a Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2017-01-10 15:06:45 +01:00
Simone Bordet b8986d5812 Fixes #1228 - Internal error during SSL handshake.
Added a guard to avoid unwrapping during handshake if SSLEngine is
already closed.
2017-01-10 15:05:40 +01:00
Simone Bordet df51ebc029 Fixed test broken by #1172. 2016-12-22 11:14:48 +01:00
Greg Wilkins 68c8db635e ignored bad test 2016-12-22 18:27:15 +11:00
Simone Bordet 9c68bd44fa Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2016-12-20 16:17:14 +01:00
Simone Bordet a15f8964c4 Cleanups for #1172. 2016-12-20 16:15:35 +01:00
Konstantin Gribov 9657be1c72 Fixes #1171 - Jetty-client throws NPE for request to IDN hosts only when `HttpClient#send(...)` is called.
Added early check for null host when creating requests in HttpClient.
Added test for incorrect IDN redirect.

Signed-off-by: Konstantin Gribov <grossws@gmail.com>
Reviewed-by: Simone Bordet <simone.bordet@gmail.com>
2016-12-20 16:08:48 +01:00
Simone Bordet dd3a73e57a Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2016-12-14 11:19:49 +01:00
Joakim Erdfelt 9b609e0f6d Issue #1161 - Leaving CookieStore alone HttpClient and WebSocketClient are stopped
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
2016-12-14 09:00:12 +01:00
Joakim Erdfelt 646a411746 Fixing onUpgradeFrom buffer flip issue 2016-12-01 13:07:28 -07:00
Greg Wilkins 2ef23a6725 Issue #572
Improved to the toString and dump output of connections, endpoints and channel to assist with debugging
made the SSL callbacks and runnables Invocable to avoid thread starvation.
2016-11-23 16:58:35 +11:00
Simone Bordet 7716ada9dd Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2016-11-07 19:26:18 +01:00
Simone Bordet f82aa03300 Fixes #1078 - DigestAuthentication should use realm from server, even if unknown in advance. 2016-11-07 19:25:06 +01:00
Simone Bordet a51f77c390 Fixed compilation failure. 2016-11-04 12:19:48 +01:00
Simone Bordet 9760e0d4cd Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2016-11-04 12:10:10 +01:00
Simone Bordet 846d560b44 Fixes #905 - Jetty terminates SSL connections too early with Connection: close.
Requests with "Connection: close" are now closed only after the
request/response exchange has been terminated.
2016-11-04 12:09:44 +01:00
Simone Bordet 605aadba59 Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2016-11-04 09:54:36 +01:00
Simone Bordet d18b900b75 Fixes #1069 - Host header should be sent with HTTP/1.0. 2016-11-04 09:53:22 +01:00
Greg Wilkins 5395cfd021 Issue#1066 Simplify HttpGeneration
HTTP requests cannot be close limited
2016-11-04 08:29:49 +11:00
Simone Bordet 3c3be877c6 Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2016-11-03 14:22:23 +01:00
Simone Bordet fba901d156 Issue #1064 - HttpClient sets chunked transfer-encoding.
Fixed test assertion.
2016-11-03 14:21:40 +01:00
Simone Bordet 568d56caee Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2016-11-03 11:44:59 +01:00
Simone Bordet 7e903cfc6b Fixes #1064 - HttpClient sets chunked transfer-encoding.
Replaced the hint that there is a body by setting the Content-Type
header rather than the Transfer-Encoding header.
2016-11-03 11:40:45 +01:00
Greg Wilkins 6781a949b1 Issue#1066 Simplify HttpGeneration
Reduce the transformations needed on header fields, so they can be more often
set directly and no need to split and recombine.

The Content-Length field is added IF it is needed for framing or if it was explicitly set

The Transfer-Encoding: chunk field is used only as a hint that there is content.

Connection fields are used as is, but are checked for close and keep-alive
2016-11-03 16:55:33 +11:00
Simone Bordet f2061cbe60 Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'. 2016-10-06 16:33:58 +02:00
Sergiu Prodan 407111a796 Issue #295 Ensure Jetty Client use of Inflater calls .end() to avoid memory leak
Signed-off-by: Sergiu Prodan <p.sergiu92@gmail.com>
2016-10-06 16:12:53 +02:00
Sergiu Prodan f8b2979a8f Issue #295 Ensure Jetty Client use of Deflater calls .end() to avoid memory leak (#986)
* Issue #295 Ensure Jetty Client use of Inflater calls .end() to avoid memory leak

Signed-off-by: Sergiu Prodan <p.sergiu92@gmail.com>
2016-10-06 16:10:37 +02:00
Greg Wilkins 98bb582d45 Jetty 9.4.x http interceptor #382
* Issue #382 Request compression

Added identity HttpInput.Interceptor
Moved GZIPContentDecoder to jetty-http
Reworking interceptor and GZIPContentDecoder to avoid data copies
Completed and tested GZIPContentDecoder
Implemented GzipHttpInputInterceptor
updated GzipHandler.java
updated gzip module
use common GZIP decoder
Gzip Bomb
handle read() after empty interception
2016-10-05 13:49:20 +11:00