You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "ok2c (via GitHub)" <gi...@apache.org> on 2024/02/23 14:29:49 UTC
[PR] Redesign of client HTTP context APIs [httpcomponents-client]
ok2c opened a new pull request, #552:
URL: https://github.com/apache/httpcomponents-client/pull/552
* Aligns client context APIs with those in core
* Context classes are now plain beans
* Backward compatibility with older versions (through internal Delegate classes)
* Javadoc imprvements
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Redesign of client HTTP context APIs [httpcomponents-client]
Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c merged PR #552:
URL: https://github.com/apache/httpcomponents-client/pull/552
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Redesign of client HTTP context APIs [httpcomponents-client]
Posted by "sratz (via GitHub)" <gi...@apache.org>.
sratz commented on PR #552:
URL: https://github.com/apache/httpcomponents-client/pull/552#issuecomment-2622607194
I think the problem is that `HttpClientContext` never kept the well-known named attributes and their equivalent object member in sync, i.e.
`setAttribute("http.cookie-store", ...)` and `setCookieStore()` have always referred to two completely independent things.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Redesign of client HTTP context APIs [httpcomponents-client]
Posted by "sratz (via GitHub)" <gi...@apache.org>.
sratz commented on PR #552:
URL: https://github.com/apache/httpcomponents-client/pull/552#issuecomment-2622594563
> > does not solve the problem, as that would work in 5.4, but not in 5.3 anymore.
>
> @sratz Why would not that work in 5.3?
Because there the reverse is true, `org.apache.hc.client5.http.impl.classic.InternalHttpClient.setupContext(HttpClientContext)` only looks at the attributes, not at the getter methods:
https://github.com/apache/httpcomponents-client/blob/4f852608c3315975bf6cd72d10999626784cd9a6/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/InternalHttpClient.java#L123-L138
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Redesign of client HTTP context APIs [httpcomponents-client]
Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on PR #552:
URL: https://github.com/apache/httpcomponents-client/pull/552#issuecomment-2622515880
> does not solve the problem, as that would work in 5.4, but not in 5.3 anymore.
@sratz Why would not that work in 5.3?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Redesign of client HTTP context APIs [httpcomponents-client]
Posted by "sratz (via GitHub)" <gi...@apache.org>.
sratz commented on PR #552:
URL: https://github.com/apache/httpcomponents-client/pull/552#issuecomment-2623843069
> @sratz `context.setCookieStore(cookieStore);` will work correctly regardless of the version. What changed in 5.4 is that standard attributes no longer get shoved into a map.
Ok, you're right.
However, there's still a breaking change that the string-based attributes are now not considered at all anymore in 5.4. So they are not just deprecated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Redesign of client HTTP context APIs [httpcomponents-client]
Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on PR #552:
URL: https://github.com/apache/httpcomponents-client/pull/552#issuecomment-1961436304
@arturobernalg Please take a look.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Redesign of client HTTP context APIs [httpcomponents-client]
Posted by "ok2c (via GitHub)" <gi...@apache.org>.
ok2c commented on PR #552:
URL: https://github.com/apache/httpcomponents-client/pull/552#issuecomment-2622662274
> only looks at the attributes, not at the getter methods:
@sratz `context.setCookieStore(cookieStore);` will work correctly regardless of the version. What changed in 5.4 is that standard attributes no longer get shoved into a map.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: [PR] Redesign of client HTTP context APIs [httpcomponents-client]
Posted by "sratz (via GitHub)" <gi...@apache.org>.
sratz commented on PR #552:
URL: https://github.com/apache/httpcomponents-client/pull/552#issuecomment-2622456032
This change is incompatible.
Consider when a *consumer* sets the attributes on the context:
```java
BasicCookieStore cookieStore = new BasicCookieStore();
HttpClientContext context = new HttpClientContext();
context.setAttribute(HttpClientContext.COOKIE_STORE, cookieStore); // <----
CloseableHttpClient client = HttpClients.createDefault();
client.execute(new HttpGet("https://httpbin.org/cookies/set/foo/bar"), context, response -> null);
System.out.println(cookieStore.getCookies());
```
httpclient < 5.4 correctly uses the request-specific cookie store and prints:
```[[name: foo; value: bar; domain: httpbin.org; path: /; expiry: null]]```
httpclient 5.4 does not care about the attribute anymore ([diff](https://github.com/apache/httpcomponents-client/pull/552/files#diff-16278c1c7854154453531a554fbcaf624a76d7b6ca1e95eb529148f361fd9348R179-R180)) and prints:
```[]```
Switching from
```
context.setAttribute(HttpClientContext.COOKIE_STORE, cookieStore);
```
to
```
context.setCookieStore(cookieStore);
```
does not solve the problem, as that would work in 5.4, but not in 5.3 anymore.
The only chance I see to support both is to do *both*
```
context.setAttribute(HttpClientContext.COOKIE_STORE, cookieStore);
context.setCookieStore(cookieStore);
```
Shouldn't this have been compatible? I.e. ([here](https://github.com/apache/httpcomponents-client/pull/552/files#diff-16278c1c7854154453531a554fbcaf624a76d7b6ca1e95eb529148f361fd9348R179-R180)), consider *both* the getter and the attribute?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org