You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by GitBox <gi...@apache.org> on 2022/06/22 18:32:15 UTC
[GitHub] [httpcomponents-core] gaojieliu opened a new pull request, #351: HTTPCLIENT-2222: fixed ProtocolNegotiationException
gaojieliu opened a new pull request, #351:
URL: https://github.com/apache/httpcomponents-core/pull/351
Aligned with the implementation of the latest release to get rid of
ProtocolNegotiationException:
https://github.com/apache/httpcomponents-core/blob/rel/v5.2-beta2/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/ClientH2PrefaceHandler.java#L142
cc @ok2c
--
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
[GitHub] [httpcomponents-core] ok2c merged pull request #351: HTTPCLIENT-2222: fixed ProtocolNegotiationException
Posted by GitBox <gi...@apache.org>.
ok2c merged PR #351:
URL: https://github.com/apache/httpcomponents-core/pull/351
--
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
[GitHub] [httpcomponents-core] ok2c commented on a diff in pull request #351: HTTPCLIENT-2222: fixed ProtocolNegotiationException
Posted by GitBox <gi...@apache.org>.
ok2c commented on code in PR #351:
URL: https://github.com/apache/httpcomponents-core/pull/351#discussion_r904936239
##########
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/H2OnlyClientProtocolNegotiator.java:
##########
@@ -104,7 +106,8 @@ private void writeOutPreface(final IOSession session) throws IOException {
}
if (!preface.hasRemaining()) {
session.clearEvent(SelectionKey.OP_WRITE);
- startProtocol(HttpVersion.HTTP_2, new ClientH2IOEventHandler(http2StreamHandlerFactory.create(ioSession)), null);
+ final ByteBuffer data = inBuf != null ? inBuf.data() : null;
Review Comment:
@carterkozak `IOEventHandler`s can be called by a single I/O event dispatch thread at a time by design and therefore do not need to synchronize access to their internal structures if they do not delegate event handling to external handlers.
--
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
[GitHub] [httpcomponents-core] carterkozak commented on a diff in pull request #351: HTTPCLIENT-2222: fixed ProtocolNegotiationException
Posted by GitBox <gi...@apache.org>.
carterkozak commented on code in PR #351:
URL: https://github.com/apache/httpcomponents-core/pull/351#discussion_r904116599
##########
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/H2OnlyClientProtocolNegotiator.java:
##########
@@ -131,7 +134,10 @@ public void outputReady(final IOSession session) throws IOException {
@Override
public void inputReady(final IOSession session, final ByteBuffer src) throws IOException {
if (src != null) {
- throw new ProtocolNegotiationException("Unexpected input");
+ if (inBuf == null) {
+ inBuf = BufferedData.allocate(src.remaining());
+ }
+ inBuf.put(src);
Review Comment:
I think we need to handle a potential buffer overflow here in the case an existing `inBuf` doesn't have enough room for `src`
--
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
[GitHub] [httpcomponents-core] garydgregory commented on pull request #351: HTTPCLIENT-2222: fixed ProtocolNegotiationException
Posted by GitBox <gi...@apache.org>.
garydgregory commented on PR #351:
URL: https://github.com/apache/httpcomponents-core/pull/351#issuecomment-1180682780
It's here:
https://search.maven.org/artifact/org.apache.httpcomponents.core5/httpcore5
Gary
On Mon, Jul 11, 2022, 12:55 gaojieliu ***@***.***> wrote:
> Hi @ok2c <https://github.com/ok2c>
> Hope you have a great vocation!
> I saw there is a tag for 5.1.4 release, but I didn't see the artifact in
> maven repo:
>
> https://mvnrepository.com/artifact/org.apache.httpcomponents.client5/httpclient5
>
> Could you share how much time it would normally take to show up in maven
> repo?
>
> Thanks
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/httpcomponents-core/pull/351#issuecomment-1180644841>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAJB6N4GSYPSGTDZPMYUX3DVTRGYPANCNFSM5ZRH4MHA>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
--
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
[GitHub] [httpcomponents-core] gaojieliu commented on pull request #351: HTTPCLIENT-2222: fixed ProtocolNegotiationException
Posted by GitBox <gi...@apache.org>.
gaojieliu commented on PR #351:
URL: https://github.com/apache/httpcomponents-core/pull/351#issuecomment-1180644841
Hi @ok2c
Hope you have a great vocation!
I saw there is a tag for 5.1.4 release, but I didn't see the artifact in maven repo:
https://mvnrepository.com/artifact/org.apache.httpcomponents.client5/httpclient5
Could you share how much time it would normally take to show up in maven repo?
Thanks
--
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
[GitHub] [httpcomponents-core] ok2c commented on pull request #351: HTTPCLIENT-2222: fixed ProtocolNegotiationException
Posted by GitBox <gi...@apache.org>.
ok2c commented on PR #351:
URL: https://github.com/apache/httpcomponents-core/pull/351#issuecomment-1164328379
@gaojieliu These are reasonable changes, though, I thought they were only relevant to protocol negotiators in `master` that have been completely rewritten in the course of 5.2 development.
--
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
[GitHub] [httpcomponents-core] gaojieliu commented on pull request #351: HTTPCLIENT-2222: fixed ProtocolNegotiationException
Posted by GitBox <gi...@apache.org>.
gaojieliu commented on PR #351:
URL: https://github.com/apache/httpcomponents-core/pull/351#issuecomment-1180708567
Hi @garydgregory
Thank a lot, and let me give it a try!
--
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
[GitHub] [httpcomponents-core] gaojieliu commented on a diff in pull request #351: HTTPCLIENT-2222: fixed ProtocolNegotiationException
Posted by GitBox <gi...@apache.org>.
gaojieliu commented on code in PR #351:
URL: https://github.com/apache/httpcomponents-core/pull/351#discussion_r904126821
##########
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/H2OnlyClientProtocolNegotiator.java:
##########
@@ -131,7 +134,10 @@ public void outputReady(final IOSession session) throws IOException {
@Override
public void inputReady(final IOSession session, final ByteBuffer src) throws IOException {
if (src != null) {
- throw new ProtocolNegotiationException("Unexpected input");
+ if (inBuf == null) {
+ inBuf = BufferedData.allocate(src.remaining());
+ }
+ inBuf.put(src);
Review Comment:
https://github.com/apache/httpcomponents-core/blob/master/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/BufferedData.java#L75
`BufferedData` is an expandable buffer, so overflow shouldn't happen.
--
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
[GitHub] [httpcomponents-core] gaojieliu commented on pull request #351: HTTPCLIENT-2222: fixed ProtocolNegotiationException
Posted by GitBox <gi...@apache.org>.
gaojieliu commented on PR #351:
URL: https://github.com/apache/httpcomponents-core/pull/351#issuecomment-1164608924
Hi @ok2c
Thanks a lot for merging this code change.
What will be the procedure to include this change in a new release: 5.1.4?
We would like to pick up this change ASAP.
Thanks
--
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
[GitHub] [httpcomponents-core] gaojieliu commented on pull request #351: HTTPCLIENT-2222: fixed ProtocolNegotiationException
Posted by GitBox <gi...@apache.org>.
gaojieliu commented on PR #351:
URL: https://github.com/apache/httpcomponents-core/pull/351#issuecomment-1165724996
Hi @ok2c
Thanks for the update, and enjoy your vacation!
--
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
[GitHub] [httpcomponents-core] carterkozak commented on a diff in pull request #351: HTTPCLIENT-2222: fixed ProtocolNegotiationException
Posted by GitBox <gi...@apache.org>.
carterkozak commented on code in PR #351:
URL: https://github.com/apache/httpcomponents-core/pull/351#discussion_r904113191
##########
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/H2OnlyClientProtocolNegotiator.java:
##########
@@ -104,7 +106,8 @@ private void writeOutPreface(final IOSession session) throws IOException {
}
if (!preface.hasRemaining()) {
session.clearEvent(SelectionKey.OP_WRITE);
- startProtocol(HttpVersion.HTTP_2, new ClientH2IOEventHandler(http2StreamHandlerFactory.create(ioSession)), null);
+ final ByteBuffer data = inBuf != null ? inBuf.data() : null;
Review Comment:
We can avoid the unnecessary additional volatile read (I find this pattern helpful in general, especially when null checks are involved, though I realize in this case we never transition from non-null to null)
```suggestion
final BufferedData inBufSnapshot = inBuf;
final ByteBuffer data = inBufSnapshot != null ? inBufSnapshot.data() : null;
```
--
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
[GitHub] [httpcomponents-core] ok2c commented on pull request #351: HTTPCLIENT-2222: fixed ProtocolNegotiationException
Posted by GitBox <gi...@apache.org>.
ok2c commented on PR #351:
URL: https://github.com/apache/httpcomponents-core/pull/351#issuecomment-1165685488
@gaojieliu I will do my best to get around to cutting a new release n the first week of July, but I am going to be on vacation during that time and other PMCs might be as well, so do not take it as a promise.
--
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