You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2018/11/15 14:36:58 UTC
[1/4] httpcomponents-core git commit: Fixed NPE in async reverse
proxy example [Forced Update!]
Repository: httpcomponents-core
Updated Branches:
refs/heads/master 291967d6c -> f5590e471 (forced update)
Fixed NPE in async reverse proxy example
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/18a06ef8
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/18a06ef8
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/18a06ef8
Branch: refs/heads/master
Commit: 18a06ef81c12b01e896c46ce4b36831efda22dad
Parents: cabf540
Author: Gary Gregory <gg...@rocketsoftware.com>
Authored: Sun Nov 11 15:36:23 2018 -0700
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Thu Nov 15 15:33:16 2018 +0100
----------------------------------------------------------------------
.../apache/hc/core5/http/examples/AsyncReverseProxyExample.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/18a06ef8/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
index b42bf6a..e3e896c 100644
--- a/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
+++ b/httpcore5/src/examples/org/apache/hc/core5/http/examples/AsyncReverseProxyExample.java
@@ -564,7 +564,10 @@ public class AsyncReverseProxyExample {
exchangeState.outputEnd = entityDetails == null;
final ResponseChannel responseChannel = exchangeState.responseMessageChannel;
- responseChannel.sendResponse(outgoingResponse, entityDetails, httpContext);
+ if (responseChannel != null) {
+ // responseChannel can be null under load.
+ responseChannel.sendResponse(outgoingResponse, entityDetails, httpContext);
+ }
System.out.println("[client<-proxy] " + exchangeState.id + " status " + outgoingResponse.getCode());
if (entityDetails == null) {
[4/4] httpcomponents-core git commit: Fix typo in comment.
Posted by ol...@apache.org.
Fix typo in comment.
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/c3fa8b86
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/c3fa8b86
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/c3fa8b86
Branch: refs/heads/master
Commit: c3fa8b86ce94de9d826bcdca12fcffa493153acf
Parents: ccf07fb
Author: Gary Gregory <ga...@gmail.com>
Authored: Sun Nov 11 20:28:17 2018 -0700
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Thu Nov 15 15:34:58 2018 +0100
----------------------------------------------------------------------
.../main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/c3fa8b86/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
index 9489ed1..1b350ab 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/ssl/SSLIOSession.java
@@ -623,7 +623,7 @@ public class SSLIOSession implements IOSession {
// Acquire buffer
final ByteBuffer inPlainBuf = this.inPlain.acquire();
- // Perform opertaions
+ // Perform operations
inPlainBuf.flip();
final int n = Math.min(inPlainBuf.remaining(), dst.remaining());
for (int i = 0; i < n; i++) {
[3/4] httpcomponents-core git commit: Bug fix: fixed a race condition
in non-blocking HTTP/1.1 protocol handlers causing premature clearing of
output interest
Posted by ol...@apache.org.
Bug fix: fixed a race condition in non-blocking HTTP/1.1 protocol handlers causing premature clearing of output interest
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/f5590e47
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/f5590e47
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/f5590e47
Branch: refs/heads/master
Commit: f5590e471f46892787df01fca2a6e8faf26fd454
Parents: c3fa8b8
Author: Oleg Kalnichevski <ol...@apache.org>
Authored: Thu Nov 15 15:32:01 2018 +0100
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Thu Nov 15 15:34:58 2018 +0100
----------------------------------------------------------------------
.../http/impl/nio/AbstractHttp1StreamDuplexer.java | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/f5590e47/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
index 077c40a..1ee2333 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/AbstractHttp1StreamDuplexer.java
@@ -378,18 +378,16 @@ abstract class AbstractHttp1StreamDuplexer<IncomingMessage extends HttpMessage,
produceOutput();
} else {
final int pendingOutputRequests = outputRequests.get();
- final boolean outputPending;
outputLock.lock();
try {
- outputPending = outbuf.hasData();
+ if (!outbuf.hasData() && outputRequests.compareAndSet(pendingOutputRequests, 0)) {
+ ioSession.clearEvent(SelectionKey.OP_WRITE);
+ } else {
+ outputRequests.addAndGet(-pendingOutputRequests);
+ }
} finally {
outputLock.unlock();
}
- if (!outputPending && outputRequests.compareAndSet(pendingOutputRequests, 0)) {
- ioSession.clearEvent(SelectionKey.OP_WRITE);
- } else {
- outputRequests.addAndGet(-pendingOutputRequests);
- }
}
outputLock.lock();
[2/4] httpcomponents-core git commit: Refactor separate int constants
into an enum.
Posted by ol...@apache.org.
Refactor separate int constants into an enum.
Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/ccf07fb3
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/ccf07fb3
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/ccf07fb3
Branch: refs/heads/master
Commit: ccf07fb367034f70ff462fbef9f7d88c9ebf1e23
Parents: 18a06ef
Author: Gary Gregory <ga...@gmail.com>
Authored: Sun Nov 11 18:40:24 2018 -0700
Committer: Oleg Kalnichevski <ol...@apache.org>
Committed: Thu Nov 15 15:34:58 2018 +0100
----------------------------------------------------------------------
.../core5/http/impl/nio/ExpandableBuffer.java | 33 +++++++++-----------
1 file changed, 15 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/ccf07fb3/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ExpandableBuffer.java
----------------------------------------------------------------------
diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ExpandableBuffer.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ExpandableBuffer.java
index 657dd92..10c7143 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ExpandableBuffer.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/nio/ExpandableBuffer.java
@@ -35,15 +35,16 @@ import java.nio.ByteBuffer;
* by an instance of {@link ByteBuffer}.
* <p>
* This class is not thread safe.
- *
+ * </p>
* @since 4.0
*/
public class ExpandableBuffer {
- public final static int INPUT_MODE = 0;
- public final static int OUTPUT_MODE = 1;
+ public enum Mode {
+ INPUT, OUTPUT
+ }
- private int mode;
+ private Mode mode;
private ByteBuffer buffer;
/**
@@ -57,19 +58,19 @@ public class ExpandableBuffer {
protected ExpandableBuffer(final int bufferSize) {
super();
this.buffer = ByteBuffer.allocate(bufferSize);
- this.mode = INPUT_MODE;
+ this.mode = Mode.INPUT;
}
/**
* Returns the current mode:
* <p>
- * {@link #INPUT_MODE}: the buffer is in the input mode.
+ * {@link Mode#INPUT}: the buffer is in the input mode.
* <p>
- * {@link #OUTPUT_MODE}: the buffer is in the output mode.
+ * {@link Mode#OUTPUT}: the buffer is in the output mode.
*
* @return current input/output mode.
*/
- public int mode() {
+ public Mode mode() {
return this.mode;
}
@@ -81,9 +82,9 @@ public class ExpandableBuffer {
* Sets the mode to output. The buffer can now be read from.
*/
protected void setOutputMode() {
- if (this.mode != OUTPUT_MODE) {
+ if (this.mode != Mode.OUTPUT) {
this.buffer.flip();
- this.mode = OUTPUT_MODE;
+ this.mode = Mode.OUTPUT;
}
}
@@ -91,13 +92,13 @@ public class ExpandableBuffer {
* Sets the mode to input. The buffer can now be written into.
*/
protected void setInputMode() {
- if (this.mode != INPUT_MODE) {
+ if (this.mode != Mode.INPUT) {
if (this.buffer.hasRemaining()) {
this.buffer.compact();
} else {
this.buffer.clear();
}
- this.mode = INPUT_MODE;
+ this.mode = Mode.INPUT;
}
}
@@ -193,18 +194,14 @@ public class ExpandableBuffer {
*/
protected void clear() {
this.buffer.clear();
- this.mode = INPUT_MODE;
+ this.mode = Mode.INPUT;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("[mode=");
- if (mode() == INPUT_MODE) {
- sb.append("in");
- } else {
- sb.append("out");
- }
+ sb.append(this.mode);
sb.append(" pos=");
sb.append(this.buffer.position());
sb.append(" lim=");