profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/craig-day/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Craig Day craig-day Zendesk San Francisco, CA

anamartinez/large_object_store 22

Store large objects in memcache or others by slicing them.

craig-day/ecto_sharding 8

Database sharding support for Elixir Ecto

craig-day/compute-tag 2

An action to compute the next tag for git

craig-day/cldrex 1

Elixir library that uses the Common Locale Data Repository to format dates, numbers, and more.

craig-day/exenv 1

Elixir versions management tool

craig-day/absinthe_plug 0

Plug support for Absinthe, the GraphQL toolkit for Elixir

craig-day/anovelmous-web 0

Web Front End for Anovelmous

craig-day/asdf-dhall 0

dhall plugin for asdf version manager https://github.com/asdf-vm/asdf

Pull request review commentvert-x3/vertx-web

Caching http client

+/*+ * Copyright 2021 Red Hat, Inc.+ *+ *  All rights reserved. This program and the accompanying materials+ *  are made available under the terms of the Eclipse Public License v1.0+ *  and Apache License v2.0 which accompanies this distribution.+ *+ *  The Eclipse Public License is available at+ *  http://www.eclipse.org/legal/epl-v10.html+ *+ *  The Apache License v2.0 is available at+ *  http://www.opensource.org/licenses/apache2.0.php+ *+ *  You may elect to redistribute this code under either of these licenses.+ */+package io.vertx.ext.web.client;++import io.vertx.codegen.annotations.GenIgnore;+import io.vertx.codegen.annotations.VertxGen;+import io.vertx.core.Vertx;+import io.vertx.core.http.HttpClient;+import io.vertx.ext.web.client.impl.CachingWebClientImpl;+import io.vertx.ext.web.client.impl.cache.SharedDataCacheStore;+import io.vertx.ext.web.client.spi.CacheStore;++/**+ * An asynchronous cache aware HTTP / HTTP/2 client called {@code CachingWebClient}.+ * <p>+ * This client wraps a {@link WebClient} and makes it cache aware by adding features to it:+ * <ul>+ *   <li>Cache-Control header parsing</li>+ *   <li>Response serialization and deserialization for the {@link CacheStore}</li>+ *   <li>Freshness checking</li>+ * </ul>+ * <p>+ * The client honors the cache headers:+ * <ul>+ *  <li>Cache-Control with the following properties understood:+ *    <ul>+ *      <li>public</li>+ *      <li>private</li>+ *      <li>no-cache</li>+ *      <li>no-store</li>+ *      <li>max-age</li>+ *      <li>s-maxage</li>+ *    </ul>+ *  </li>+ *  <li>Expires</li>+ *  <li>ETag</li>+ *  <li>Vary</li>+ * </ul>+ * <p/>+ *+ * @author <a href="mailto:craigday3@gmail.com">Craig Day</a>+ */+@VertxGen+public interface CachingWebClient {++  /**+   * Create a cache aware web client using an+   * {@link io.vertx.core.shareddata.AsyncMap} as the {@link CacheStore}.+   *+   * @param vertx the vertx instance+   * @return the creatd web client+   */+  static WebClient create(Vertx vertx) {

@pmlopes and @vietj , just to be clear here do we want CachingWebClient to be just like WebClientSession? Meaning it should extends WebClient, or just renaming the static interface methods to match name/signature? Related, should the caching client implementation then extends WebClientBase, or can it just keep the two methods it has where it just adds the interceptor?

craig-day

comment created time in 18 hours

PullRequestReviewEvent

pull request commentvert-x3/vertx-web

Caching http client

Ok. @vietj I pushed up some simple examples and docs. Let me know what you think.

craig-day

comment created time in 3 days

push eventcraig-day/vertx-web

Craig Day

commit sha 6e178e7394223427844ddc3a0de66a7c0639dc5b

first round of simple docs

view details

push time in 3 days

push eventcraig-day/vertx-web

Michael Edgar

commit sha d427e10d3a696ace43360000ed8b2c1cdfee6777

Retain unmodified OpenAPI JsonObject in OpenAPIHolderImpl Create a copy of the JsonObject before making modifications/updating `$ref` values. Signed-off-by: Michael Edgar <michael@xlate.io>

view details

Paulo Lopes

commit sha 0f7f8116a5fb0360b415e23f0ba3600ae1fc25db

Convert tests Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 2fb99a5165e18de9d05b072a8c713f7c429f2390

Fix #1969: Add missing annotations Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 40c61e1e910e829f5d411d4aa6d0edb9bfc9a075

Merge branch '1996_openapiholder_retain_local_refs' of git://github.com/MikeEdgar/vertx-web into MikeEdgar-1996_openapiholder_retain_local_refs

view details

Paulo Lopes

commit sha 3233259506557b6ca5479cc8dc31c7a1c82f0086

Merge branch 'MikeEdgar-1996_openapiholder_retain_local_refs'

view details

Paulo Lopes

commit sha 974a740bdb6325d7becacd416b84892c89a152d4

Enable back the ERROR event Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 8fd4a73b7e1bc75327d5cd5f9121d7203b62a119

Update test as max body has been increased in core Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 81db11b937cee0d8893a26d00cfb8edb25e9cf85

Generic scope check missed an else statement Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Julien Viet

commit sha 5521abf380c143bc786bf54c9d8a1c058ae93d08

true

view details

Julien Viet

commit sha 39d0d33ba8554219f977635961940ab982ee2cbf

Update CI/CD actions

view details

Paulo Lopes

commit sha 64a7e92eec586cb978faad28578fb0a1b333030d

Merge pull request #2019 from vert-x3/issues/missing-else-check Generic scope check missed an else statement

view details

Paulo Lopes

commit sha 9b5271959f946510d2651ba172d7f088497fe6ff

Don't use predictable random and avoid NPEs Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

knotenpunkt

commit sha b142ae2136c3163d3fc387478f280c0c93b3286e

Update to the latest GraphQL version

view details

Thomas Segismont

commit sha 1a6b11e7272cd5a1b7669179810e58bb3119b580

Removed deprecated GraphQL dataloader creation method calls Signed-off-by: Thomas Segismont <tsegismont@gmail.com>

view details

Thomas Segismont

commit sha ebfa5100ffc91e28823244a4d0e731958532b55e

Merge branch 'knotenpunkt-master'

view details

Thomas Segismont

commit sha 35407fcd1ee375f12f48e19716dedc2bcc991521

GraphQL: added example of VertxBatchLoader to the doc Closes #1981 Signed-off-by: Thomas Segismont <tsegismont@gmail.com>

view details

Thomas Segismont

commit sha 1d2c8cde73a864d74c3251f41b3b11aea8db1d25

Support RxJava generation of ValidationHandlerBuilder and ValidationHandler Fixes #1822 With this change, it is possible to do this with RxJava API: ValidationHandler validation = ValidationHandlerBuilder.create(schemaParser) .body(Bodies.json(bodySchemaBuilder)) .build(); And then use the validation handler in a rx-router. Signed-off-by: Thomas Segismont <tsegismont@gmail.com>

view details

Julien Viet

commit sha f3c300371e524bd00f63ecb0297a4426215cf893

Releasing 4.2.0.Beta1

view details

Julien Viet

commit sha cab369fa949db664fdd9f4ce6db43d125064b11e

Back to snapshots

view details

Craig Day

commit sha b9eb4133dec192b5ca1967fa96c868544458193b

[graphq] support an initialValue param as execution root

view details

push time in 3 days

push eventcraig-day/vertx-web

Thomas Segismont

commit sha 1d2c8cde73a864d74c3251f41b3b11aea8db1d25

Support RxJava generation of ValidationHandlerBuilder and ValidationHandler Fixes #1822 With this change, it is possible to do this with RxJava API: ValidationHandler validation = ValidationHandlerBuilder.create(schemaParser) .body(Bodies.json(bodySchemaBuilder)) .build(); And then use the validation handler in a rx-router. Signed-off-by: Thomas Segismont <tsegismont@gmail.com>

view details

Julien Viet

commit sha f3c300371e524bd00f63ecb0297a4426215cf893

Releasing 4.2.0.Beta1

view details

Julien Viet

commit sha cab369fa949db664fdd9f4ce6db43d125064b11e

Back to snapshots

view details

Craig Day

commit sha b9eb4133dec192b5ca1967fa96c868544458193b

[graphq] support an initialValue param as execution root

view details

Thomas Segismont

commit sha 342982409d38e2defff1587c99c2ddcfd5c1aec3

ApolloWSConnectionHandler should use initialValue if provided in payload Signed-off-by: Thomas Segismont <tsegismont@gmail.com>

view details

Markus Spika

commit sha 24b2c593bfdc491e24a18d5a68f7785c5f6a0f31

bugfix: conditional pause/resume request in AuthorizationHandler for HTTP2. fixes #2030 AuthorizationHandler needs to check the requests state in case a BodyHandler comes first (same as AuthenticationHandler does) Signed-off-by: Markus Spika <markus.spika@gmail.com>

view details

Paulo Lopes

commit sha 8048c419f9bfff7167af5a6c2aceecdcc77d74d1

Merge pull request #2031 from DemonicTutor/f/ms/fixAuthorizationHandlerPause bugfix: conditional pause/resume request in AuthorizationHandler for HTTP2. fixes #2030

view details

Paulo Lopes

commit sha 9c726f4d58ceb0eccfe1b48aeb2532244bd28e20

Initial import of the MFA/OTP handler Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 1a535a1a5a2e0a470fccb228d579b655276131f9

Completed OTP handler Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

knotenpunkt

commit sha faff38257bcf4c9608a645ca151ae8fe56d6f920

Update to the latest GraphQL version 17.2 (bugfix release) (#2029)

view details

Deven Phillips

commit sha efae47fa8e9a95ea6a58c1bdf2ed1b16dea16183

Added case for "https" in switch statement Signed-off-by: Deven Phillips <deven.phillips@redhat.com>

view details

Deven Phillips

commit sha 51cb712b8c527d1118822738d9ab73caa07684c7

Added case for "https" in switch statement Signed-off-by: Deven Phillips <deven.phillips@redhat.com> Signed-off-by: Deven Phillips <josphill@redhat.com>

view details

Deven Phillips

commit sha 51e13bbef6d7a52d7eb6019a87818163ced80ed1

Merge remote-tracking branch 'origin/issues/1817' into issues/1817 Signed-off-by: Deven Phillips <josphill@redhat.com>

view details

Paulo Lopes

commit sha 24faf8ec7a7b7e4ea1484a4ab693b4b6739b25d7

Merge pull request #2035 from InfoSec812/issues/1817 Added case for "https" in switch statement

view details

Julien Viet

commit sha 18e059787ae0c7156e9a5ac6924d9a6502188d31

WebClient duplicate request headers on redirection fixes #2037 fixes #2017

view details

pendula95

commit sha a083ba770dfe518eb5ab72533be74622ebc84531

added oAuth2 provider to WebClientSession

view details

pendula95

commit sha b03c00cd17a938d996b3492e219ed3220be4cd40

wrapped with promise to wait async result

view details

pendula95

commit sha 13e37b33d28ae6df433f1fb8d0e2eedb4f42a630

fixed test for WebClientSession with oAuth2 provider

view details

Paulo Lopes

commit sha a3e0268ab1fa4683c60c901bb94dd8234342f57c

Use Credentials Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha d7f13c1d9d16d965e534e0c0cb838836e29c98fd

Moved to a composition model, removing the hard dependency on oauth2 Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

push time in 3 days

pull request commentvert-x3/vertx-web

Caching http client

@vietj sounds good! I was working on it over the weekend and working more today. Should hopefully have a commit pushed up today.

craig-day

comment created time in 5 days

pull request commentvert-x3/vertx-web

Caching http client

Sounds good. I'll work on that over the next few days. When you say "need documentation and examples", where would I write that?

craig-day

comment created time in 15 days

pull request commentvert-x3/vertx-web

Caching http client

Oh, sorry. I pushed up a first attempt. Yeah, I think it could use a review.

craig-day

comment created time in 21 days

push eventcraig-day/vertx-web

Craig Day

commit sha d09125c84158dd2b2d3aed297befd6846ee62b82

checkpoint on pr review

view details

Craig Day

commit sha 2e8c65783e3b8d0bf8e8917665d599128c974ad9

store private responses in local cache set by WebClientSession

view details

push time in 24 days

pull request commentvert-x3/vertx-web

Caching http client

@vietj yes that makes a lot of sense! I'm working on that now. Thanks for the clear thoughts.

craig-day

comment created time in 24 days

pull request commentvert-x3/vertx-web

[graphql] support an initialValue param as execution root

@tsegismont thanks so much for the quick response!

craig-day

comment created time in 24 days

delete branch craig-day/vertx-web

delete branch : craig-day/graphql-initial-value

delete time in 24 days

pull request commentvert-x3/vertx-web

[graphql] support an initialValue param as execution root

@vietj @tsegismont any chance this could sneak into the 4.2 milestone? :)

craig-day

comment created time in a month

PR opened vert-x3/vertx-web

[graphq] support an initialValue param as execution root

Motivation:

The GraphQL spec documents the execution methods, or more specifically the field execution, as accepting an initialValue to be used to resolve the field value. In graphql-java, this initialValue is represented by the root field on the ExecutionInput. Currently, there is no way to get anything into the root field on the execution input with the GraphQL handler.

This can be particularly useful in the case of subscriptions, where the event triggering a subscription resolution may contain data that should be included in the results.

ExecuteRequest reference: link ExecuteSubscriptionEvent reference: link

both of those methods pass initialValue into the objectValue parameter of ExecuteSelectionSet

ExecuteSelectionSet reference: link ExecuteField reference: link

This PR attempts to solve that by adding support for an initialValue parameter, both as a query param and a JSON body key. This value is assumed to be some form of valid JSON that can be decoded to an object. After decoding the value, if we end up with a valid result, I then set that object as the root of the execution input.

Conformance:

Your commits should be signed and you should have signed the Eclipse Contributor Agreement as explained in https://github.com/eclipse/vert.x/blob/master/CONTRIBUTING.md Please also make sure you adhere to the code style guidelines: https://github.com/vert-x3/wiki/wiki/Vert.x-code-style-guidelines

+193 -13

0 comment

7 changed files

pr created time in a month

create barnchcraig-day/vertx-web

branch : craig-day/graphql-initial-value

created branch time in a month

push eventcraig-day/vertx-web

Thomas Segismont

commit sha 00517d488320067e96c2217b3a9cdf74af3fceb6

Update RxJava override to RxJava3 (#1967) Signed-off-by: Thomas Segismont <tsegismont@gmail.com>

view details

Paulo Lopes

commit sha 143666d9fd288c9965721ec69d309e8bc1c43050

Update CSRF session data on non GET, othwerwise tokens will never match if a requests don't interleave GET/POST Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha cb74469042a3a122b335e1a5a0109756a8a45bbc

Adding reproducer Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 1fc3000071ac5e11d52e137742324e6042211ebe

More tests for stateless mode Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 87c4180da4d13a20aef981e4898e9c8f30090d2c

Merge pull request #1972 from vert-x3/issue/csrf-update-session-on-non-get Update CSRF session data on non GET, othwerwise tokens will never mat…

view details

Paulo Lopes

commit sha 468ec9283d573039f8bf3d06aae8ee9fff5d6b16

Adding another CSRF test Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

gmonjal

commit sha 47c9ab9b5033bd91a3d50e46021f49f0f765eec9

Issue-1966 : Making the method "processException" back to protected as users are relying on it to handle specific errors.

view details

Paulo Lopes

commit sha 7a8c6550ee5f4fdd9755ebfabb326765a6e52f3a

Merge pull request #1977 from MeYoGui/issue/1966 [Issue-1966] : Making the method "processException" back to protected

view details

Paulo Lopes

commit sha f7875afd2114e7c879d81f32505894561b840647

Fix #1380: Only run success action if socket map state is still valid Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha e321e222b2086086b8901941f79acc3a90341af2

reorg calls to cleary identify which ones need state checks Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 4872bb0b4e989e21ef7fbf7ab9a29b9156eacfcd

Merge pull request #1978 from vert-x3/issues/1380 Fix #1380: Only run success action if socket map state is still valid

view details

Paulo Lopes

commit sha 97917b0ad77ee80bfd6d65ca2f87b57ff3ad2d6a

Fail fast on bad configuration Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha bc9a0366a6d09477b5d701d58029bc73dd622cd2

Add missing pause/resume to authz handler Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 2b92005fcbf06968ab0f0d162344e7be8ca8d106

Clean up bridge state on socket exception Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 48fb4512b56b6203fa23fcb70c2ea8899adb1915

Don't use a new state, just refer to the error in the close event Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha ebefc4bcf0596cfc1bcbd8846e1200625ca67831

Update the body of the synthetic error message + update docs Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 2a6eba91124b886785faaf13a563a95d7d6a3f86

Merge pull request #1987 from vert-x3/issues/1986 Clean up bridge state on socket exception

view details

Francesco Guardiani

commit sha b13fc6b0855cf2420e7f4284786afa95e161e25d

Fix NPE #1975 (#1990) Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

view details

Paulo Lopes

commit sha 4b9e66279356df22ad63a52cd196f6f76cb603af

Merge pull request #1984 from vert-x3/issues/1983 Add missing pause/resume to authz handler

view details

Julien Viet

commit sha 03073491d36e60dd1f0b92546b763edf3a2b194c

Add missing HttpServerRequestWrapper#decoderResult() method

view details

push time in a month

pull request commentvert-x3/vertx-web

Caching http client

have the session set it on the context

I'm not sure what that means. I started working on a change to add a CacheStore field to the context, but the rest I got lost on. What role does WebClientSession play here? I think I'm confused on if you think the session should control the caching, or if the CacheInterceptor should just be made aware of the session information.

What I started doing was:

  • Added a CacheStore field to the HttpContext
  • Added a PREPARE_REQUEST hook to the CacheInterceptor and if context.cacheStore() is null, then set the cache store on the context
  • Change the SessionAwareInterceptor to add the encoded cookie string to the context attrs during CREATE_REQUEST
  • Update the CacheInterceptor to check the attrs for a cookie during SEND_REQUEST and if it is present then include that in the cache key

Does any of this match the direction you were thinking?

On an unrelated note, I think the cache implementation needs to change in the Vary case. Right now, there is a local map that maps a variation to a cache key, but that is on the instance of the CacheInterceptor. I think that will effectively mean that varying caches will be less effective because the information will only be scoped to one instance of the client. Does that seem like a concern, or do you think clients are lived long enough for that to be OK?

craig-day

comment created time in a month

pull request commentvert-x3/vertx-web

Caching http client

After an initial look I have some questions/thoughts. I'm not sure how we would best make the interceptors aware of each other. I think we can put something into the context to help with that, but that might introduce an order dependency of which interceptor runs the create_request state first.

A bigger question I have is where do we actually store the cached response? If we have a session interceptor, it has a CookieStore, but that isn't flexible enough to store a HTTP response. Similarly, the cache store for the cache interceptor doesn't know about the cookies, but I think I could embed the cookies into the cache key by hashing them or something.

All of that to say that I don't think it's an "easy" thing to just add, because neither of the stores can handle both the cookies and the http response for caching. I'm not sure which API it makes more sense to change, or maybe I'm going in the wrong direction with this.

craig-day

comment created time in a month

pull request commentvert-x3/vertx-web

Caching http client

I'll look into this today and tomorrow. Finally understanding what the best behavior is :D

craig-day

comment created time in a month

pull request commentvert-x3/vertx-web

Caching http client

Hey @vietj, sorry missed the last notification. I think I see what you're saying. Right now, the client can be configured to enable/disable caching private things, but is the concern that it isn't good enough?

Are you thinking that rather than having configuration for private cache, we should see if we're in a session aware client? I suppose if we can make the clients aware of each other, then we can store private responses with the session information, otherwise we only store public responses in the shared cache. Does that seem more desirable? If so, should we and how do we make the interceptors aware of each other?

craig-day

comment created time in a month

pull request commentvert-x3/vertx-web

Caching http client

My initial thought is that they should mix together reasonably well as I'm not sure caching cares much about the session headers. However, I don't know a lot of details around the session and all of the things it does. I could see there being a concern about caching a response longer than a session might be valid, but due to the nature of it being a cached result, we aren't really at risk of over-exposing information I think. Not sure if that makes sense.

The easiest option is to make them exclusive and either say use the cache or the session-aware client, but I don't know if that's necessary. Looking at the session interceptor, it looks like it stores cookies and then applies them to future requests. I don't think this conflicts with the caching interceptor explicitly.

The session interceptor operates on CREATE_REQUEST and DISPATCH_RESPONSE phases, whereas the cache interceptor operates on SEND_REQUEST and DISPATCH_RESPONSE. Both interceptors only store information to an external store during dispatch and that will continue to work as desired.

The biggest area I'm not sure about is what happens when the session interceptor sets headers during CREATE_REQUEST and then the cache interceptor dispatches a cached response during SEND_REQUEST. Since we aren't sending the request to the upstream now, does this even matter? Maybe this means when the session interceptor handles the dispatch, it won't be able to store the data it expects. Do you have thoughts on this?

To summarize, I don't think having both interceptors will matter here, but I might be missing something that the session interceptor does.

craig-day

comment created time in a month

pull request commentvert-x3/vertx-web

Caching http client

@vietj anything else I need to do here? Just want to make sure you aren't waiting on me for anything.

craig-day

comment created time in 2 months

pull request commentvert-x3/vertx-web

Caching http client

Thanks for the pointer @vietj . Squashed some commits, rebased on latest, and fix the codegen with that GenIgnore annotation

craig-day

comment created time in 2 months

push eventcraig-day/vertx-web

Craig Day

commit sha 69278e4d122c12e4a1148ac95e23ecb02ac9efb7

dont use current cache client to create new one

view details

Craig Day

commit sha f3deda4f85903977cbc7789a5190c1f083e72769

helper class to rewrap existing webclient in the impl package

view details

push time in 2 months

push eventcraig-day/vertx-web

Paulo Lopes

commit sha 143666d9fd288c9965721ec69d309e8bc1c43050

Update CSRF session data on non GET, othwerwise tokens will never match if a requests don't interleave GET/POST Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha cb74469042a3a122b335e1a5a0109756a8a45bbc

Adding reproducer Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 1fc3000071ac5e11d52e137742324e6042211ebe

More tests for stateless mode Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 87c4180da4d13a20aef981e4898e9c8f30090d2c

Merge pull request #1972 from vert-x3/issue/csrf-update-session-on-non-get Update CSRF session data on non GET, othwerwise tokens will never mat…

view details

Paulo Lopes

commit sha 468ec9283d573039f8bf3d06aae8ee9fff5d6b16

Adding another CSRF test Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

gmonjal

commit sha 47c9ab9b5033bd91a3d50e46021f49f0f765eec9

Issue-1966 : Making the method "processException" back to protected as users are relying on it to handle specific errors.

view details

Paulo Lopes

commit sha 7a8c6550ee5f4fdd9755ebfabb326765a6e52f3a

Merge pull request #1977 from MeYoGui/issue/1966 [Issue-1966] : Making the method "processException" back to protected

view details

Paulo Lopes

commit sha f7875afd2114e7c879d81f32505894561b840647

Fix #1380: Only run success action if socket map state is still valid Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha e321e222b2086086b8901941f79acc3a90341af2

reorg calls to cleary identify which ones need state checks Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 4872bb0b4e989e21ef7fbf7ab9a29b9156eacfcd

Merge pull request #1978 from vert-x3/issues/1380 Fix #1380: Only run success action if socket map state is still valid

view details

Paulo Lopes

commit sha 97917b0ad77ee80bfd6d65ca2f87b57ff3ad2d6a

Fail fast on bad configuration Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha bc9a0366a6d09477b5d701d58029bc73dd622cd2

Add missing pause/resume to authz handler Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 2b92005fcbf06968ab0f0d162344e7be8ca8d106

Clean up bridge state on socket exception Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 48fb4512b56b6203fa23fcb70c2ea8899adb1915

Don't use a new state, just refer to the error in the close event Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha ebefc4bcf0596cfc1bcbd8846e1200625ca67831

Update the body of the synthetic error message + update docs Signed-off-by: Paulo Lopes <pmlopes@gmail.com>

view details

Paulo Lopes

commit sha 2a6eba91124b886785faaf13a563a95d7d6a3f86

Merge pull request #1987 from vert-x3/issues/1986 Clean up bridge state on socket exception

view details

Francesco Guardiani

commit sha b13fc6b0855cf2420e7f4284786afa95e161e25d

Fix NPE #1975 (#1990) Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>

view details

Paulo Lopes

commit sha 4b9e66279356df22ad63a52cd196f6f76cb603af

Merge pull request #1984 from vert-x3/issues/1983 Add missing pause/resume to authz handler

view details

Julien Viet

commit sha 03073491d36e60dd1f0b92546b763edf3a2b194c

Add missing HttpServerRequestWrapper#decoderResult() method

view details

Julien Viet

commit sha 7d7601de42bd7a8252681f37a6377ace3cf28788

Releasing 4.1.1

view details

push time in 2 months

pull request commentvert-x3/vertx-web

Caching http client

I'm not sure how to generate the JSON converter for CachingWebClientOptions. I added @VertxGen to the CachingWebClient interface, and @DataObject to CachingWebClientOptions. The first error I got said I needed a JSON constructor and then a toJSON function, so I added those and copied the format from WebClientOptions, but I'm not sure how to generate the CachingWebClientOptionsConverter that they use. Can you either tell me how to (or link some docs) run the codegen, or can we just remove @DataObject?

craig-day

comment created time in 2 months

pull request commentvert-x3/vertx-web

Caching http client

I'm running into some codegen problems now. @vietj can you help me with the codegen stuff?

craig-day

comment created time in 2 months

push eventcraig-day/vertx-web

Craig Day

commit sha bbf4537016cbe1e2252dbfec786eace656557be7

try to setup vertxgen dataobject stuff for cachingwebclient and options

view details

push time in 2 months

Pull request review commentvert-x3/vertx-web

Caching http client

+/*+ * Copyright 2021 Red Hat, Inc.+ *+ *  All rights reserved. This program and the accompanying materials+ *  are made available under the terms of the Eclipse Public License v1.0+ *  and Apache License v2.0 which accompanies this distribution.+ *+ *  The Eclipse Public License is available at+ *  http://www.eclipse.org/legal/epl-v10.html+ *+ *  The Apache License v2.0 is available at+ *  http://www.opensource.org/licenses/apache2.0.php+ *+ *  You may elect to redistribute this code under either of these licenses.+ */+package io.vertx.ext.web.client.impl.cache;++import io.vertx.core.Future;+import io.vertx.core.Handler;+import io.vertx.core.buffer.Buffer;+import io.vertx.core.http.HttpHeaders;+import io.vertx.core.http.HttpMethod;+import io.vertx.ext.web.client.CachingWebClientOptions;+import io.vertx.ext.web.client.HttpRequest;+import io.vertx.ext.web.client.HttpResponse;+import io.vertx.ext.web.client.impl.HttpContext;+import io.vertx.ext.web.client.impl.HttpRequestImpl;+import io.vertx.ext.web.client.spi.CacheStore;+import java.util.Collections;+import java.util.HashSet;+import java.util.Map;+import java.util.Set;+import java.util.concurrent.ConcurrentHashMap;++/**+ * An interceptor for caching responses that operates on the {@link HttpContext}.+ *+ * @author <a href="mailto:craigday3@gmail.com">Craig Day</a>+ */+public class CacheInterceptor implements Handler<HttpContext<?>> {++  private static final String IS_CACHE_DISPATCH = "cache.dispatch";+  private static final String REVALIDATION_RESPONSE = "cache.response_to_revalidate";++  private final CacheStore cacheStore;+  private final CachingWebClientOptions options;+  private final Map<CacheVariationsKey, Set<Vary>> variationsRegistry;++  public CacheInterceptor(CacheStore store, CachingWebClientOptions options) {+    this.cacheStore = store;+    this.options = options;+    this.variationsRegistry = new ConcurrentHashMap<>();+  }++  @Override+  public void handle(HttpContext<?> context) {+    if (!options.isCachingEnabled()) {+      context.next();+      return;+    }++    switch (context.phase()) {+      case SEND_REQUEST:+        handleSendRequest((HttpContext<Buffer>) context);+        break;+      case DISPATCH_RESPONSE:+        handleDispatchResponse((HttpContext<Buffer>) context);+        break;+      default:+        context.next();+        break;+    }+  }++  private void handleSendRequest(HttpContext<Buffer> context) {+    HttpRequestImpl<Buffer> requestImpl = (HttpRequestImpl<Buffer>) context.request();+    if (!HttpMethod.GET.equals(requestImpl.method())) {+      context.next();+      return;+    }++    Vary variation = selectVariation(requestImpl);+    if (variation == null) {+      context.next();+      return;+    }++    cacheStore+      .get(new CacheKey(context.request(), variation))+      .compose(cached -> respondFromCache(context, cached))+      .onComplete(ar -> {+        if (ar.succeeded()) {+          context.set(IS_CACHE_DISPATCH, true);+          context.dispatchResponse(ar.result());+        } else {+          context.next();+        }+      });+  }++  private void handleDispatchResponse(HttpContext<Buffer> context) {+    Boolean isCacheDispatch = context.get(IS_CACHE_DISPATCH);+    if (isCacheDispatch != null && isCacheDispatch) {+      context.next();+      return;+    }++    CachedHttpResponse responseToValidate = context.get(REVALIDATION_RESPONSE);+    if (responseToValidate != null) {+      // We're revalidating a cached response+      processRevalidationResponse(context, responseToValidate).onComplete(ar -> {+        if (ar.succeeded()) {+          context.response(ar.result());+        }+        context.next();+      });+    } else {+      // We're storing a new response in cache+      processResponse(context, null).onComplete(ar -> {+        // TODO: is this right? if we don't need the data then use a callback, not a future+        context.next();+      });+    }+  }++  private Vary selectVariation(HttpRequest<?> request) {+    CacheVariationsKey key = new CacheVariationsKey(request);+    Set<Vary> possibleVariations = variationsRegistry.getOrDefault(key, Collections.emptySet());++    for (Vary variation : possibleVariations) {+      if (variation.matchesRequest(request)) {+        return variation;+      }+    }++    return null;+  }++  private Future<HttpResponse<Buffer>> processResponse(HttpContext<Buffer> context, CachedHttpResponse cachedResponse) {+    HttpRequest<Buffer> request = context.request();+    HttpResponse<Buffer> response = context.response();++    if (options.getCachedStatusCodes().contains(response.statusCode())) {+      // Request was successful, attempt to cache response+      return cacheResponse(request, response).map(response);+    } else if (cachedResponse != null && cachedResponse.useStaleIfError()) {+      // TODO: we should check that this is an error too

we should check that context.response() was an error response before checking the cachedResponse.useStaleIfError() flag. If the response didn't result in an error, we should just use that instead of falling back to the cached response.

craig-day

comment created time in 2 months