[GitHub] [tomcat] markt-asf merged pull request #162: Add support for same-site cookie attribute

2019-05-20 Thread GitBox
markt-asf merged pull request #162: Add support for same-site cookie attribute
URL: https://github.com/apache/tomcat/pull/162
 
 
   


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated (99e36dc -> 42d1df9)

2019-05-20 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 99e36dc  Silence false positive IDE warning
 add 52da9c4  Add support for same-site cookie attribute
 add 35776e6  Move configuration to CookieProcessor
 add 9d632cc  Update docs
 add 85990f7  Move attribute getter/setter into CookieProcessorBase
 add 0da5229  Make SameSiteCookies an enum
 add 0900048  Add changelog entry
 new 2193c15  Add support for same-site cookie-attribute
 new c2ae943  Polish
 new 42d1df9  Merge branch 'johnkdev-master' same-site cookie header

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../tomcat/util/http/CookieProcessorBase.java  | 10 +++
 .../tomcat/util/http/LegacyCookieProcessor.java|  9 +-
 .../tomcat/util/http/LocalStrings.properties   |  1 +
 .../tomcat/util/http/Rfc6265CookieProcessor.java   |  7 ++
 .../apache/tomcat/util/http/SameSiteCookies.java   | 59 +
 .../util/http/TestCookieProcessorGeneration.java   | 49 +++
 .../tomcat/util/http/TestSameSiteCookies.java  | 97 ++
 webapps/docs/changelog.xml |  4 +
 webapps/docs/config/cookie-processor.xml   | 13 +++
 9 files changed, 248 insertions(+), 1 deletion(-)
 create mode 100644 java/org/apache/tomcat/util/http/SameSiteCookies.java
 create mode 100644 test/org/apache/tomcat/util/http/TestSameSiteCookies.java


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/03: Merge branch 'johnkdev-master' same-site cookie header

2019-05-20 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 42d1df93c5060c2cf2a40ff270e6998ca5cbd719
Merge: 99e36dc c2ae943
Author: Mark Thomas 
AuthorDate: Mon May 20 08:56:48 2019 +0100

Merge branch 'johnkdev-master' same-site cookie header

 .../tomcat/util/http/CookieProcessorBase.java  | 10 +++
 .../tomcat/util/http/LegacyCookieProcessor.java|  9 +-
 .../tomcat/util/http/LocalStrings.properties   |  1 +
 .../tomcat/util/http/Rfc6265CookieProcessor.java   |  7 ++
 .../apache/tomcat/util/http/SameSiteCookies.java   | 59 +
 .../util/http/TestCookieProcessorGeneration.java   | 49 +++
 .../tomcat/util/http/TestSameSiteCookies.java  | 97 ++
 webapps/docs/changelog.xml |  4 +
 webapps/docs/config/cookie-processor.xml   | 13 +++
 9 files changed, 248 insertions(+), 1 deletion(-)


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/03: Polish

2019-05-20 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit c2ae943828bfe19179318d98701a140f0514a9ea
Author: Mark Thomas 
AuthorDate: Mon May 20 08:55:53 2019 +0100

Polish
---
 java/org/apache/tomcat/util/http/CookieProcessorBase.java | 12 ++--
 java/org/apache/tomcat/util/http/LocalStrings.properties  |  2 +-
 webapps/docs/config/cookie-processor.xml  |  9 ++---
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/java/org/apache/tomcat/util/http/CookieProcessorBase.java 
b/java/org/apache/tomcat/util/http/CookieProcessorBase.java
index aad3979..3cb5430 100644
--- a/java/org/apache/tomcat/util/http/CookieProcessorBase.java
+++ b/java/org/apache/tomcat/util/http/CookieProcessorBase.java
@@ -37,6 +37,12 @@ public abstract class CookieProcessorBase implements 
CookieProcessor {
 }
 };
 
+protected static final String ANCIENT_DATE;
+
+static {
+ANCIENT_DATE = COOKIE_DATE_FORMAT.get().format(new Date(1));
+}
+
 private SameSiteCookies sameSiteCookies = SameSiteCookies.NONE;
 
 public SameSiteCookies getSameSiteCookies() {
@@ -46,10 +52,4 @@ public abstract class CookieProcessorBase implements 
CookieProcessor {
 public void setSameSiteCookies(String sameSiteCookies) {
 this.sameSiteCookies = SameSiteCookies.fromString(sameSiteCookies);
 }
-
-protected static final String ANCIENT_DATE;
-
-static {
-ANCIENT_DATE = COOKIE_DATE_FORMAT.get().format(new Date(1));
-}
 }
diff --git a/java/org/apache/tomcat/util/http/LocalStrings.properties 
b/java/org/apache/tomcat/util/http/LocalStrings.properties
index e7d3a54..17211a3 100644
--- a/java/org/apache/tomcat/util/http/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/http/LocalStrings.properties
@@ -16,9 +16,9 @@
 cookies.fallToDebug=\n\
 \ Note: further occurrences of Cookie errors will be logged at DEBUG level.
 cookies.invalidCookieToken=Cookies: Invalid cookie. Value not a token or 
quoted value
+cookies.invalidSameSiteCookies=Unknown setting [{0}], must be one of: none, 
lax, strict. Default value is none.
 cookies.invalidSpecial=Cookies: Unknown Special Cookie
 cookies.maxCountFail=More than the maximum allowed number of cookies, [{0}], 
were detected.
-cookies.invalidSameSiteCookies=Unknown setting [{0}], must be one of: none, 
lax, strict. Default value is none.
 
 headers.maxCountFail=More than the maximum allowed number of headers, [{0}], 
were detected.
 
diff --git a/webapps/docs/config/cookie-processor.xml 
b/webapps/docs/config/cookie-processor.xml
index 29e4809..2d9f004 100644
--- a/webapps/docs/config/cookie-processor.xml
+++ b/webapps/docs/config/cookie-processor.xml
@@ -67,11 +67,14 @@
   
 Enables setting same-site cookie attribute.
 
-If value is none then the same-site cookie attribute 
won't be set. This is the default value.
+If value is none then the same-site cookie attribute
+won't be set. This is the default value.
 
-If value is lax then the browser only sends the cookie 
in same-site requests and cross-site top level GET requests. 
+If value is lax then the browser only sends the cookie
+in same-site requests and cross-site top level GET requests.
 
-If value is strict then the browser prevents sending 
the cookie in any cross-site request.
+If value is strict then the browser prevents sending 
the
+cookie in any cross-site request.
   
 
 


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/03: Add support for same-site cookie-attribute

2019-05-20 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 2193c156b832432dc2b398a1dc37b7aa82707f2c
Merge: 99e36dc 0900048
Author: Mark Thomas 
AuthorDate: Mon May 20 08:47:16 2019 +0100

Add support for same-site cookie-attribute

Patch provided by John Kelly

 .../tomcat/util/http/CookieProcessorBase.java  | 10 +++
 .../tomcat/util/http/LegacyCookieProcessor.java|  9 +-
 .../tomcat/util/http/LocalStrings.properties   |  1 +
 .../tomcat/util/http/Rfc6265CookieProcessor.java   |  7 ++
 .../apache/tomcat/util/http/SameSiteCookies.java   | 59 +
 .../util/http/TestCookieProcessorGeneration.java   | 49 +++
 .../tomcat/util/http/TestSameSiteCookies.java  | 97 ++
 webapps/docs/changelog.xml |  4 +
 webapps/docs/config/cookie-processor.xml   | 10 +++
 9 files changed, 245 insertions(+), 1 deletion(-)

diff --cc java/org/apache/tomcat/util/http/SameSiteCookies.java
index 000,f9eb7a5..c79fbc1
mode 00,100644..100644
--- a/java/org/apache/tomcat/util/http/SameSiteCookies.java
+++ b/java/org/apache/tomcat/util/http/SameSiteCookies.java
@@@ -1,0 -1,43 +1,59 @@@
++/*
++ *  Licensed to the Apache Software Foundation (ASF) under one or more
++ *  contributor license agreements.  See the NOTICE file distributed with
++ *  this work for additional information regarding copyright ownership.
++ *  The ASF licenses this file to You under the Apache License, Version 2.0
++ *  (the "License"); you may not use this file except in compliance with
++ *  the License.  You may obtain a copy of the License at
++ *
++ *  http://www.apache.org/licenses/LICENSE-2.0
++ *
++ *  Unless required by applicable law or agreed to in writing, software
++ *  distributed under the License is distributed on an "AS IS" BASIS,
++ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ *  See the License for the specific language governing permissions and
++ *  limitations under the License.
++ */
+ package org.apache.tomcat.util.http;
+ 
+ import org.apache.tomcat.util.res.StringManager;
+ 
+ public enum SameSiteCookies {
+ 
+ /**
+  * Don't set the SameSite cookie attribute. Cookie is always sent
+  */
+ NONE("None"),
+ 
+ /**
+  * Cookie is only sent on same-site requests and cross-site top level 
navigation GET requests
+  */
+ LAX("Lax"),
+ 
+ /**
+  * Prevents the cookie from being sent by the browser in all cross-site 
requests
+  */
+ STRICT("Strict");
+ 
+ private static final StringManager sm = 
StringManager.getManager(SameSiteCookies.class);
+ 
+ private final String value;
+ 
+ SameSiteCookies(String value) {
+ this.value = value;
+ }
+ 
+ public String getValue() {
+ return value;
+ }
+ 
+ public static SameSiteCookies fromString(String value) {
+ for (SameSiteCookies sameSiteCookies : SameSiteCookies.values()) {
+ if (sameSiteCookies.getValue().equalsIgnoreCase(value)) {
+ return sameSiteCookies;
+ }
+ }
+ 
+ throw new 
IllegalStateException(sm.getString("cookies.invalidSameSiteCookies", value));
+ }
+ }
diff --cc test/org/apache/tomcat/util/http/TestSameSiteCookies.java
index 000,74842c1..60cc3a8
mode 00,100644..100644
--- a/test/org/apache/tomcat/util/http/TestSameSiteCookies.java
+++ b/test/org/apache/tomcat/util/http/TestSameSiteCookies.java
@@@ -1,0 -1,81 +1,97 @@@
++/*
++ *  Licensed to the Apache Software Foundation (ASF) under one or more
++ *  contributor license agreements.  See the NOTICE file distributed with
++ *  this work for additional information regarding copyright ownership.
++ *  The ASF licenses this file to You under the Apache License, Version 2.0
++ *  (the "License"); you may not use this file except in compliance with
++ *  the License.  You may obtain a copy of the License at
++ *
++ *  http://www.apache.org/licenses/LICENSE-2.0
++ *
++ *  Unless required by applicable law or agreed to in writing, software
++ *  distributed under the License is distributed on an "AS IS" BASIS,
++ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ *  See the License for the specific language governing permissions and
++ *  limitations under the License.
++ */
+ package org.apache.tomcat.util.http;
+ 
++import org.junit.Assert;
+ import org.junit.Test;
+ 
 -import org.junit.Assert;
+ 
+ public class TestSameSiteCookies {
+ 
+ @Test
+ public void testNone() {
+ SameSiteCookies attribute = SameSiteCookies.NONE;
+ 
+ Assert.assertEquals("None", attribute.getValue());
+ Assert.assertEquals(SameSiteCookies.NONE, attribute);
+ 
+ Assert.assertNotEquals(SameSiteCookies.LAX, attribute);
+ Assert.assertNotEquals(SameSiteCookies.STRICT, attribute);

[GitHub] [tomcat] markt-asf commented on issue #162: Add support for same-site cookie attribute

2019-05-20 Thread GitBox
markt-asf commented on issue #162: Add support for same-site cookie attribute
URL: https://github.com/apache/tomcat/pull/162#issuecomment-493880726
 
 
   Thanks for the PR. It has been applied to master. I'll close this PR once I 
have completed back-porting it.


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Correct location of same-site docs

2019-05-20 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new 4473156  Correct location of same-site docs
4473156 is described below

commit 447315632652211827fe969a7f2cc29b52c952fe
Author: Mark Thomas 
AuthorDate: Mon May 20 09:11:19 2019 +0100

Correct location of same-site docs

Common attributes is for attributes defined on the interface - i.e.
attributes every implementation must provide.
---
 webapps/docs/config/cookie-processor.xml | 47 ++--
 1 file changed, 32 insertions(+), 15 deletions(-)

diff --git a/webapps/docs/config/cookie-processor.xml 
b/webapps/docs/config/cookie-processor.xml
index 2d9f004..f2d2e9c 100644
--- a/webapps/docs/config/cookie-processor.xml
+++ b/webapps/docs/config/cookie-processor.xml
@@ -64,19 +64,6 @@
 used.
   
 
-  
-Enables setting same-site cookie attribute.
-
-If value is none then the same-site cookie attribute
-won't be set. This is the default value.
-
-If value is lax then the browser only sends the cookie
-in same-site requests and cross-site top level GET requests.
-
-If value is strict then the browser prevents sending 
the
-cookie in any cross-site request.
-  
-
 
 
   
@@ -107,8 +94,25 @@
   The cookie header is always preserved.
 
 
-No additional attributes are supported by the RFC 6265 Cookie
-Processor.
+The RFC 6265 Cookie Processor supports the following
+additional attributes.
+
+
+
+  
+Enables setting same-site cookie attribute.
+
+If value is none then the same-site cookie attribute
+won't be set. This is the default value.
+
+If value is lax then the browser only sends the cookie
+in same-site requests and cross-site top level GET requests.
+
+If value is strict then the browser prevents sending 
the
+cookie in any cross-site request.
+  
+
+
 
   
 
@@ -167,6 +171,19 @@
 
   
 
+  
+Enables setting same-site cookie attribute.
+
+If value is none then the same-site cookie attribute
+won't be set. This is the default value.
+
+If value is lax then the browser only sends the cookie
+in same-site requests and cross-site top level GET requests.
+
+If value is strict then the browser prevents sending 
the
+cookie in any cross-site request.
+  
+
 
 
   


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Implement same-site cookie header. Patch provided by John Kelly.

2019-05-20 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new f02fe40  Implement same-site cookie header. Patch provided by John 
Kelly.
f02fe40 is described below

commit f02fe40ae481d73553d0d64d3e54f78d8cf8ad2c
Author: Mark Thomas 
AuthorDate: Mon May 20 09:15:08 2019 +0100

Implement same-site cookie header. Patch provided by John Kelly.
---
 .../tomcat/util/http/CookieProcessorBase.java  | 10 +++
 .../tomcat/util/http/LegacyCookieProcessor.java|  8 ++
 .../tomcat/util/http/LocalStrings.properties   |  1 +
 .../tomcat/util/http/Rfc6265CookieProcessor.java   |  7 ++
 .../apache/tomcat/util/http/SameSiteCookies.java   | 59 +
 .../util/http/TestCookieProcessorGeneration.java   | 49 +++
 .../tomcat/util/http/TestSameSiteCookies.java  | 97 ++
 webapps/docs/changelog.xml |  4 +
 webapps/docs/config/cookie-processor.xml   | 34 +++-
 9 files changed, 267 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/http/CookieProcessorBase.java 
b/java/org/apache/tomcat/util/http/CookieProcessorBase.java
index dceb573..3cb5430 100644
--- a/java/org/apache/tomcat/util/http/CookieProcessorBase.java
+++ b/java/org/apache/tomcat/util/http/CookieProcessorBase.java
@@ -42,4 +42,14 @@ public abstract class CookieProcessorBase implements 
CookieProcessor {
 static {
 ANCIENT_DATE = COOKIE_DATE_FORMAT.get().format(new Date(1));
 }
+
+private SameSiteCookies sameSiteCookies = SameSiteCookies.NONE;
+
+public SameSiteCookies getSameSiteCookies() {
+return sameSiteCookies;
+}
+
+public void setSameSiteCookies(String sameSiteCookies) {
+this.sameSiteCookies = SameSiteCookies.fromString(sameSiteCookies);
+}
 }
diff --git a/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java 
b/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java
index 16cee6c..e792875 100644
--- a/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java
+++ b/java/org/apache/tomcat/util/http/LegacyCookieProcessor.java
@@ -324,6 +324,14 @@ public final class LegacyCookieProcessor extends 
CookieProcessorBase {
 if (cookie.isHttpOnly()) {
 buf.append("; HttpOnly");
 }
+
+SameSiteCookies sameSiteCookiesValue = getSameSiteCookies();
+
+if (!sameSiteCookiesValue.equals(SameSiteCookies.NONE)) {
+buf.append("; SameSite=");
+buf.append(sameSiteCookiesValue.getValue());
+}
+
 return buf.toString();
 }
 
diff --git a/java/org/apache/tomcat/util/http/LocalStrings.properties 
b/java/org/apache/tomcat/util/http/LocalStrings.properties
index 4b91257..5eab413 100644
--- a/java/org/apache/tomcat/util/http/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/http/LocalStrings.properties
@@ -26,6 +26,7 @@ parameters.noequal=Parameter starting at position [{0}] and 
ending at position [
 parameters.fallToDebug=\n Note: further occurrences of Parameter errors will 
be logged at DEBUG level.
 
 cookies.invalidCookieToken=Cookies: Invalid cookie. Value not a token or 
quoted value
+cookies.invalidSameSiteCookies=Unknown setting [{0}], must be one of: none, 
lax, strict. Default value is none.
 cookies.invalidSpecial=Cookies: Unknown Special Cookie
 cookies.fallToDebug=\n Note: further occurrences of Cookie errors will be 
logged at DEBUG level.
 cookies.maxCountFail=More than the maximum allowed number of cookies, [{0}], 
were detected.
diff --git a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java 
b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
index a0e54f3..0d81a9b 100644
--- a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
+++ b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
@@ -162,6 +162,13 @@ public class Rfc6265CookieProcessor extends 
CookieProcessorBase {
 header.append("; HttpOnly");
 }
 
+SameSiteCookies sameSiteCookiesValue = getSameSiteCookies();
+
+if (!sameSiteCookiesValue.equals(SameSiteCookies.NONE)) {
+header.append("; SameSite=");
+header.append(sameSiteCookiesValue.getValue());
+}
+
 return header.toString();
 }
 
diff --git a/java/org/apache/tomcat/util/http/SameSiteCookies.java 
b/java/org/apache/tomcat/util/http/SameSiteCookies.java
new file mode 100644
index 000..c79fbc1
--- /dev/null
+++ b/java/org/apache/tomcat/util/http/SameSiteCookies.java
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "Lic

[GitHub] [tomcat] markt-asf commented on issue #162: Add support for same-site cookie attribute

2019-05-20 Thread GitBox
markt-asf commented on issue #162: Add support for same-site cookie attribute
URL: https://github.com/apache/tomcat/pull/162#issuecomment-493889783
 
 
   Back-ported to 8.5.x


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Improve NIO2 flush

2019-05-20 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
 new d2752e5  Improve NIO2 flush
d2752e5 is described below

commit d2752e595136a08f5c64908103fa274559ee78ca
Author: remm 
AuthorDate: Mon May 20 14:11:04 2019 +0200

Improve NIO2 flush

Although it probably will never happen, also use the additional write
buffers when flushing.
---
 java/org/apache/tomcat/util/net/Nio2Endpoint.java | 43 ++-
 1 file changed, 26 insertions(+), 17 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java 
b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index e1ab5d0..767253a 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -1032,25 +1032,34 @@ public class Nio2Endpoint extends 
AbstractJsseEndpoint() {
-@Override
-public void completed(Integer nBytes, Void 
attachment) {
-if (nBytes.intValue() < 0) {
-failed(new EOFException(), null);
-} else {
-// Continue until everything is written
-run();
-}
-}
-@Override
-public void failed(Throwable exc, Void attachment) 
{
-completion.failed(exc, 
Nio2OperationState.this);
+synchronized (writeCompletionHandler) {
+socketBufferHandler.configureWriteBufferForRead();
+ByteBuffer[] array = 
nonBlockingWriteBuffer.toArray(socketBufferHandler.getWriteBuffer());
+if (arrayHasData(array)) {
+getSocket().write(array, 0, array.length, 
timeout, unit,
+array, new CompletionHandler() {
+@Override
+public void completed(Long nBytes, 
ByteBuffer[] buffers) {
+if (nBytes.longValue() < 0) {
+failed(new EOFException(), 
null);
+} else if 
(arrayHasData(buffers)) {
+getSocket().write(array, 
0, array.length, toTimeout(getWriteTimeout()),
+
TimeUnit.MILLISECONDS, array, this);
+} else {
+// Continue until 
everything is written
+process();
+}
+}
+@Override
+public void failed(Throwable exc, 
ByteBuffer[] buffers) {
+completion.failed(exc, 
Nio2OperationState.this);
+}
+});
+return;
 }
-});
-} else {
-getSocket().write(buffers, offset, length, timeout, 
unit, this, completion);
+}
 }
+getSocket().write(buffers, offset, length, timeout, unit, 
this, completion);
 }
 }
 }


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Fwd: Travel Assistance for ApacheCon NA Las Vegas 2019 now open.

2019-05-20 Thread Mark Thomas
 Forwarded Message 

The Travel Assistance Committee (TAC) are pleased to announce that
travel assistance applications for ApacheCon NA 2019 are now open!

We will be supporting ApacheCon NA Las Vegas, Nevada on 9th - 12th
September 2019

 TAC exists to help those that would like to attend ApacheCon events,
but are unable to do so for financial reasons.
For more info on this years applications and qualifying criteria, please
visit the TAC website at
< http://www.apache.org/travel/  >.
Applications opened today and will close around the 21st June.

Important: Applications close on June 21st, 2019. Applicants have until
the closing date above to submit their applications (which should
contain as much supporting material as required to efficiently and
accurately process their request), this will enable TAC to announce
successful awards shortly afterwards.

As usual, TAC expects to deal with a range of applications from a
diverse range of backgrounds. We therefore encourage (as always) anyone
thinking about sending in an application to do so ASAP.
We look forward to greeting many of you in Las Vegas!

Kind Regards,
Gavin - (On behalf of the Travel Assistance Committee)

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Help needed with Commons Daemon issues

2019-05-20 Thread Mark Thomas
Hi,

I think this is going to be one for Mladen but if you have some insight
please do speak up.

I have been looking at:
https://issues.apache.org/jira/projects/DAEMON/issues/DAEMON-398

I'll try and keep the explanation short.

One of the first things Tomcat9.exe (prunsrv.exe) does is to redirect
stdout and stderr to files.

Tomcat9.exe (in jvm mode) then calls into jvm.dll to create a Java
runtime environment in process. As part of this it provides the command
line arguments. If these are invalid, an error is written to stderr and
the Java runtime fails to initialise.

Generally, all is good.

If you use Windows Server 2012 R2 or earlier with any Java version, the
redirection works.

If you use AdoptOpenJDK 11.0.2+9 on earlier on any current Windows
version, the redirection works.

However, if you try the above with AdoptOpenJDK 11.0.3.7 or later on
Windows Server 2016 the redirection fails.

This appears to be related to AdoptOpenJDK 11.0.3.7 being built with
Visual Studio 2017 (11.0.2+9 was build with VS 2013).

I have tried to recreate the problem with a simple DLL and EXE without
success.

I have tried various tweaks to the redirection code without success.

Avoiding issues like this is exactly why we build Commons Daemon and
Tomcat Native against MSCVRT.DLL using the build environment Mladen
designed. It looks like VS2017 might finally have broken that.

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org