[Bug 43968] [patch] support ipv6 with mod_jk

2014-06-03 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=43968

Mladen Turk  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #12 from Mladen Turk  ---
Resolving the issue since it's been implemented

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



[Bug 43968] [patch] support ipv6 with mod_jk

2014-06-03 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=43968

Konstantin Kolinko  changed:

   What|Removed |Added

 Status|NEEDINFO|NEW

--- Comment #11 from Konstantin Kolinko  ---
IPv6 support in mod_jk has been added in 1.2.39.

Is there anything left here, or this can be closed as FIXED?

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



[Bug 47714] Reponse mixed between users

2014-06-03 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=47714

Konstantin Kolinko  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #17 from Konstantin Kolinko  ---
(In reply to Paul Hinds from comment #16)
Thank you for follow-up.

No reports of such issues for the current version of mod_jk.
Closing as WORKSFORME.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



Re: svn commit: r1599739 - /tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java

2014-06-03 Thread Konstantin Kolinko
2014-06-03 22:37 GMT+04:00  :
> Author: markt
> Date: Tue Jun  3 18:37:33 2014
> New Revision: 1599739
>
> URL: http://svn.apache.org/r1599739
> Log:
> Tiny bit of de-duplication.
> Add reference to RFC2616 for case insensitivity of transfer encoding
> names.
>
> Modified:
> tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
>
> Modified: 
> tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1599739&r1=1599738&r2=1599739&view=diff
> ==
> --- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
> (original)
> +++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
> Tue Jun  3 18:37:33 2014
> @@ -677,8 +677,12 @@ public abstract class AbstractHttp11Proc
>   * Add an input filter to the current request. If the encoding is not
>   * supported, a 501 response will be returned to the client.
>   */
> -private void addInputFilter(InputFilter[] inputFilters,
> - String encodingName) {
> +private void addInputFilter(InputFilter[] inputFilters, String 
> encodingName) {
> +
> +// Trim provided encoding name and convert to lower case since 
> transfer
> +// encoding names are case insensitive. (RFC2616, section 3.6)
> +encodingName = encodingName.trim().toLowerCase(Locale.ENGLISH);
> +
>  if (encodingName.equals("identity")) {
>  // Skip
>  } else if (encodingName.equals("chunked")) {


Good.

Possible idea for an additional improvement:
a few lines below in this method there is

> for (int i = pluggableFilterIndex; i < inputFilters.length; i++) {
> if (inputFilters[i].getEncodingName().toString().equals(encodingName)) {
>getInputBuffer().addActiveFilter(inputFilters[i]);
>return;
> }
> }

There is no need for getEncodingName() to return a ByteChunk. It can
return a String instead.  The above is the only place where it is
used.
I think the byte chunk was used there for sake of calling its
ByteChunk.equalsIgnoreCase(String) method.

Such a change means changing InputFilter interface.

Best regards,
Konstantin Kolinko.

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



[Bug 56580] el-api.jar memory leak

2014-06-03 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56580

--- Comment #5 from Konstantin Kolinko  ---
My look at javax.el.BeanELResolver#cache is that a BeanELResolver that it would
be bad to share such cache between web applications.

The cache keys BeanProperties instances by class name, and not by {class name,
class loader}. This creates an ambiguity that is resolved by comparing class
references in BeanELResolver#property(...)

> if (props == null || type != props.getType()) {

Sharing the same BeanELResolver among applications also means that its cache is
also shared, so you cache only 1000 classes globally, instead of 1000 per each.

I may suggest you to apply either one the following work-arounds:
a) Put mojarra into your own WEB-INF/lib directory, instead of sharing those
libs among web applications. This should provide you with better performance,
as your static copy of BeanELReolver will have cache scoped to your web
application.

Generally it is a bad idea to share libraries between web applications. (You
are tied to a specific version of the library. You are more likely to see
memory leak issues, such as this one.)

b) Set system property "org.apache.el.BeanELResolver.CACHE_SIZE" to the value
of "0". I think that would disable the cache.


Regarding a possible way to improve Tomcat's BeanELResolver, to both avoid a
leak and to reduce clash of same class name between class loaders:

- Use 2-level cache, with first level being WeakHashMap.
That is if you want to cache 1000 classes per class loader as opposed to 1000
classes globally.

I can say that it would have some negative effect on performance.
Is it a valid use case to share EL classes such as BeanELResolver between web
applications?

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



[Bug 56582] Use switch(enum) in implementations of ActionHook.action(ActionCode, ...)

2014-06-03 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56582

Konstantin Kolinko  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Konstantin Kolinko  ---
(In reply to Konstantin Kolinko from comment #1)

Implemented DISPATCH_EXECUTE action code for AJP connectors in Tomcat 8 by
r1599752, will be in 8.0.9.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



svn commit: r1599752 - in /tomcat/trunk: java/org/apache/coyote/ajp/AbstractAjpProcessor.java webapps/docs/changelog.xml

2014-06-03 Thread kkolinko
Author: kkolinko
Date: Tue Jun  3 18:52:14 2014
New Revision: 1599752

URL: http://svn.apache.org/r1599752
Log:
https://issues.apache.org/bugzilla/show_bug.cgi?id=56582#c1
Implement DISPATCH_EXECUTE action for AJP connector.

Modified:
tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1599752&r1=1599751&r2=1599752&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Tue Jun  
3 18:52:14 2014
@@ -644,7 +644,7 @@ public abstract class AbstractAjpProcess
 break;
 }
 case DISPATCH_EXECUTE: {
-// FIXME: Why this ActionCode is not implemented for AJP?
+getEndpoint().executeNonBlockingDispatches(socketWrapper);
 break;
 }
 }

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1599752&r1=1599751&r2=1599752&view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Jun  3 18:52:14 2014
@@ -137,6 +137,10 @@
 56582: Use switch(actionCode) in processors instead of a
 chain of "elseif"s. (kkolinko)
   
+  
+56582#c1: Implement DISPATCH_EXECUTE action for AJP
+connectors. (kkolinko)
+  
 
   
   



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



svn commit: r1599739 - /tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java

2014-06-03 Thread markt
Author: markt
Date: Tue Jun  3 18:37:33 2014
New Revision: 1599739

URL: http://svn.apache.org/r1599739
Log:
Tiny bit of de-duplication.
Add reference to RFC2616 for case insensitivity of transfer encoding
names.

Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1599739&r1=1599738&r2=1599739&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Tue 
Jun  3 18:37:33 2014
@@ -677,8 +677,12 @@ public abstract class AbstractHttp11Proc
  * Add an input filter to the current request. If the encoding is not
  * supported, a 501 response will be returned to the client.
  */
-private void addInputFilter(InputFilter[] inputFilters,
- String encodingName) {
+private void addInputFilter(InputFilter[] inputFilters, String 
encodingName) {
+
+// Trim provided encoding name and convert to lower case since transfer
+// encoding names are case insensitive. (RFC2616, section 3.6)
+encodingName = encodingName.trim().toLowerCase(Locale.ENGLISH);
+
 if (encodingName.equals("identity")) {
 // Skip
 } else if (encodingName.equals("chunked")) {
@@ -1320,14 +1324,12 @@ public abstract class AbstractHttp11Proc
 int commaPos = transferEncodingValue.indexOf(',');
 String encodingName = null;
 while (commaPos != -1) {
-encodingName = transferEncodingValue.substring(
-startPos, commaPos).toLowerCase(Locale.ENGLISH).trim();
+encodingName = transferEncodingValue.substring(startPos, 
commaPos);
 addInputFilter(inputFilters, encodingName);
 startPos = commaPos + 1;
 commaPos = transferEncodingValue.indexOf(',', startPos);
 }
-encodingName = transferEncodingValue.substring(
-startPos).toLowerCase(Locale.ENGLISH).trim();
+encodingName = transferEncodingValue.substring(startPos);
 addInputFilter(inputFilters, encodingName);
 }
 



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



svn commit: r1599738 - /tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java

2014-06-03 Thread markt
Author: markt
Date: Tue Jun  3 18:37:00 2014
New Revision: 1599738

URL: http://svn.apache.org/r1599738
Log:
Reduce duplicate by moving error handling into addInputFilter.
Also makes error handling consistent.
Reduce visibility of addInputFilter()

Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1599738&r1=1599737&r2=1599738&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Tue 
Jun  3 18:37:00 2014
@@ -674,12 +674,10 @@ public abstract class AbstractHttp11Proc
 
 
 /**
- * Add an input filter to the current request.
- *
- * @return false if the encoding was not found (which would mean it is
- * unsupported)
+ * Add an input filter to the current request. If the encoding is not
+ * supported, a 501 response will be returned to the client.
  */
-protected boolean addInputFilter(InputFilter[] inputFilters,
+private void addInputFilter(InputFilter[] inputFilters,
  String encodingName) {
 if (encodingName.equals("identity")) {
 // Skip
@@ -689,15 +687,20 @@ public abstract class AbstractHttp11Proc
 contentDelimitation = true;
 } else {
 for (int i = pluggableFilterIndex; i < inputFilters.length; i++) {
-if (inputFilters[i].getEncodingName()
-.toString().equals(encodingName)) {
+if 
(inputFilters[i].getEncodingName().toString().equals(encodingName)) {
 getInputBuffer().addActiveFilter(inputFilters[i]);
-return true;
+return;
 }
 }
-return false;
+// Unsupported transfer encoding
+// 501 - Unimplemented
+response.setStatus(501);
+error = true;
+if (getLog().isDebugEnabled()) {
+getLog().debug(sm.getString("http11processor.request.prepare") 
+
+  " Unsupported transfer encoding [" + encodingName + 
"]");
+}
 }
-return true;
 }
 
 
@@ -1317,29 +1320,15 @@ public abstract class AbstractHttp11Proc
 int commaPos = transferEncodingValue.indexOf(',');
 String encodingName = null;
 while (commaPos != -1) {
-encodingName = transferEncodingValue.substring
-(startPos, commaPos).toLowerCase(Locale.ENGLISH).trim();
-if (!addInputFilter(inputFilters, encodingName)) {
-// Unsupported transfer encoding
-error = true;
-// 501 - Unimplemented
-response.setStatus(501);
-}
+encodingName = transferEncodingValue.substring(
+startPos, commaPos).toLowerCase(Locale.ENGLISH).trim();
+addInputFilter(inputFilters, encodingName);
 startPos = commaPos + 1;
 commaPos = transferEncodingValue.indexOf(',', startPos);
 }
-encodingName = transferEncodingValue.substring(startPos)
-.toLowerCase(Locale.ENGLISH).trim();
-if (!addInputFilter(inputFilters, encodingName)) {
-// Unsupported transfer encoding
-error = true;
-// 501 - Unimplemented
-if (getLog().isDebugEnabled()) {
-
getLog().debug(sm.getString("http11processor.request.prepare")+
-  " Unsupported transfer encoding 
\""+encodingName+"\"");
-}
-response.setStatus(501);
-}
+encodingName = transferEncodingValue.substring(
+startPos).toLowerCase(Locale.ENGLISH).trim();
+addInputFilter(inputFilters, encodingName);
 }
 
 // Parse content-length header



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



[Bug 56582] Use switch(enum) in implementations of ActionHook.action(ActionCode, ...)

2014-06-03 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56582

--- Comment #2 from Konstantin Kolinko  ---
Done for Tomcat 7 (r1599505 r1599711) and will be in 7.0.55.

I am ready to close this issue, but  DISPATCH_EXECUTE + AJP question for Tomcat
8 from Comment 1 is pending.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



svn commit: r1599711 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/coyote/http11/ webapps/docs/

2014-06-03 Thread kkolinko
Author: kkolinko
Date: Tue Jun  3 18:05:02 2014
New Revision: 1599711

URL: http://svn.apache.org/r1599711
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56582
Convert implementations of ActionHook.action(..) to use switch(enum) operator.
Part 2/2: HTTP processors.

It is backport of r1599393 from tomcat/trunk.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11Processor.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1599393

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1599711&r1=1599710&r2=1599711&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
Tue Jun  3 18:05:02 2014
@@ -751,7 +751,8 @@ public abstract class AbstractHttp11Proc
 @SuppressWarnings("deprecation") // Inbound/Outbound based upgrade 
mechanism
 public final void action(ActionCode actionCode, Object param) {
 
-if (actionCode == ActionCode.CLOSE) {
+switch (actionCode) {
+case CLOSE: {
 // End the processing of the current request
 
 try {
@@ -760,8 +761,9 @@ public abstract class AbstractHttp11Proc
 // Set error flag
 error = true;
 }
-
-} else if (actionCode == ActionCode.COMMIT) {
+break;
+}
+case COMMIT: {
 // Commit current response
 
 if (response.isCommitted()) {
@@ -776,8 +778,9 @@ public abstract class AbstractHttp11Proc
 // Set error flag
 error = true;
 }
-
-} else if (actionCode == ActionCode.ACK) {
+break;
+}
+case ACK: {
 // Acknowledge request
 // Send a 100 status back if it makes sense (response not committed
 // yet, and client specified an expectation for 100-continue)
@@ -793,8 +796,9 @@ public abstract class AbstractHttp11Proc
 // Set error flag
 error = true;
 }
-} else if (actionCode == ActionCode.CLIENT_FLUSH) {
-
+break;
+}
+case CLIENT_FLUSH: {
 try {
 getOutputBuffer().flush();
 } catch (IOException e) {
@@ -802,27 +806,32 @@ public abstract class AbstractHttp11Proc
 error = true;
 response.setErrorException(e);
 }
-
-} else if (actionCode == ActionCode.IS_ERROR) {
+break;
+}
+case IS_ERROR: {
 ((AtomicBoolean) param).set(error);
-
-} else if (actionCode == ActionCode.DISABLE_SWALLOW_INPUT) {
+break;
+}
+case DISABLE_SWALLOW_INPUT: {
 // Do not swallow request input but
 // make sure we are closing the connection
 error = true;
 getInputBuffer().setSwallowInput(false);
-
-} else if (actionCode == ActionCode.RESET) {
+break;
+}
+case RESET: {
 // Reset response
 // Note: This must be called before the response is committed
 
 getOutputBuffer().reset();
-
-} else if (actionCode == ActionCode.CUSTOM) {
+break;
+}
+case CUSTOM: {
 // Do nothing
 // TODO Remove this action
-
-} else if (actionCode == ActionCode.REQ_SET_BODY_REPLAY) {
+break;
+}
+case REQ_SET_BODY_REPLAY: {
 ByteChunk body = (ByteChunk) param;
 
 InputFilter savedBody = new SavedRequestInputFilter(body);
@@ -832,39 +841,67 @@ public abstract class AbstractHttp11Proc
 AbstractInputBuffer internalBuffer = (AbstractInputBuffer)
 request.getInputBuffer();
 internalBuffer.addActiveFilter(savedBody);
-} else if (actionCode == ActionCode.ASYNC_START) {
+break;
+}
+case ASYNC_START: {
 asyncStateMachine.asyncStart((AsyncContextCallback) param);
 // Async time out is based on SocketWrapper access time
 getSocketWrapper().access();
-} else if (actionCode == ActionCode.ASYNC_DISPATCHED) {
+break;
+}
+case ASYNC_DISPATCHED: {
 

svn commit: r1599558 - /tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java

2014-06-03 Thread markt
Author: markt
Date: Tue Jun  3 14:16:10 2014
New Revision: 1599558

URL: http://svn.apache.org/r1599558
Log:
Align code with comment and use a 500 response (internal server error)
as per the comment rather than a 400 response.

Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1599558&r1=1599557&r2=1599558&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Tue 
Jun  3 14:16:10 2014
@@ -1055,8 +1055,8 @@ public abstract class AbstractHttp11Proc
 getLog().debug(sm.getString(
 "http11processor.request.prepare"), t);
 }
-// 400 - Internal Server Error
-response.setStatus(400);
+// 500 - Internal Server Error
+response.setStatus(500);
 getAdapter().log(request, response, 0);
 error = true;
 }



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



[Bug 56580] el-api.jar memory leak

2014-06-03 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56580

--- Comment #4 from cos...@prodinf.ro ---
If you need some help do not hesitate to contact me.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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



svn commit: r1599505 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/coyote/ajp/AbstractAjpProcessor.java java/org/apache/coyote/ajp/AjpAprProcessor.java java/org/apache/coyote/ajp/AjpNioProcessor.java

2014-06-03 Thread kkolinko
Author: kkolinko
Date: Tue Jun  3 12:18:17 2014
New Revision: 1599505

URL: http://svn.apache.org/r1599505
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56582
Convert implementations of ActionHook.action(..) to use switch(enum) operator.
Part 1/2: AJP processors.

It is backport of r1599395 from tomcat/trunk.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1599395

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1599505&r1=1599504&r2=1599505&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java 
Tue Jun  3 12:18:17 2014
@@ -319,8 +319,8 @@ public abstract class AbstractAjpProcess
 @Override
 public final void action(ActionCode actionCode, Object param) {
 
-if (actionCode == ActionCode.COMMIT) {
-
+switch (actionCode) {
+case COMMIT: {
 if (response.isCommitted())
 return;
 
@@ -338,9 +338,9 @@ public abstract class AbstractAjpProcess
 // Set error flag
 error = true;
 }
-
-} else if (actionCode == ActionCode.CLIENT_FLUSH) {
-
+break;
+}
+case CLIENT_FLUSH: {
 if (!response.isCommitted()) {
 // Validate and write response headers
 try {
@@ -358,16 +358,19 @@ public abstract class AbstractAjpProcess
 // Set error flag
 error = true;
 }
-
-} else if (actionCode == ActionCode.IS_ERROR) {
+break;
+}
+case IS_ERROR: {
 ((AtomicBoolean) param).set(error);
-
-} else if (actionCode == ActionCode.DISABLE_SWALLOW_INPUT) {
+break;
+}
+case DISABLE_SWALLOW_INPUT: {
 // TODO: Do not swallow request input but
 // make sure we are closing the connection
 error = true;
-
-} else if (actionCode == ActionCode.CLOSE) {
+break;
+}
+case CLOSE: {
 // Close
 // End the processing of the current request, and stop any further
 // transactions with the client
@@ -378,9 +381,9 @@ public abstract class AbstractAjpProcess
 // Set error flag
 error = true;
 }
-
-} else if (actionCode == ActionCode.REQ_SSL_ATTRIBUTE ) {
-
+break;
+}
+case REQ_SSL_ATTRIBUTE: {
 if (!certificates.isNull()) {
 ByteChunk certData = certificates.getByteChunk();
 X509Certificate jsseCerts[] = null;
@@ -419,9 +422,9 @@ public abstract class AbstractAjpProcess
 }
 request.setAttribute(SSLSupport.CERTIFICATE_KEY, jsseCerts);
 }
-
-} else if (actionCode == ActionCode.REQ_HOST_ATTRIBUTE) {
-
+break;
+}
+case REQ_HOST_ATTRIBUTE: {
 // Get remote host name using a DNS resolution
 if (request.remoteHost().isNull()) {
 try {
@@ -431,14 +434,14 @@ public abstract class AbstractAjpProcess
 // Ignore
 }
 }
-
-} else if (actionCode == ActionCode.REQ_LOCAL_ADDR_ATTRIBUTE) {
-
+break;
+}
+case REQ_LOCAL_ADDR_ATTRIBUTE: {
 // Copy from local name for now, which should simply be an address
 request.localAddr().setString(request.localName().toString());
-
-} else if (actionCode == ActionCode.REQ_SET_BODY_REPLAY) {
-
+break;
+}
+case REQ_SET_BODY_REPLAY: {
 // Set the given bytes as the content
 ByteChunk bc = (ByteChunk) param;
 int length = bc.getLength();
@@ -448,35 +451,60 @@ public abstract class AbstractAjpProcess
 empty = false;
 replay = true;
 endOfStream = false;
-
-} else if (actionCode == ActionCode.ASYNC_START) {
+break;
+}
+case ASYNC_START: {
 asyncStateMachine.asyncStart((AsyncContextCallback) param);
 // Async time out is based on SocketWrapper access time
 getSocketWrapper().access();
-} else if (actionCode == ActionCode.ASYNC_

svn commit: r1599500 - in /tomcat/trunk: java/org/apache/coyote/http11/AbstractHttp11Processor.java test/org/apache/catalina/startup/SimpleHttpClient.java test/org/apache/coyote/http11/TestAbstractHtt

2014-06-03 Thread markt
Author: markt
Date: Tue Jun  3 12:14:17 2014
New Revision: 1599500

URL: http://svn.apache.org/r1599500
Log:
As per RFC2616, an unknown expect header should result in a 417 response.

Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
tomcat/trunk/test/org/apache/catalina/startup/SimpleHttpClient.java
tomcat/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1599500&r1=1599499&r2=1599500&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Tue 
Jun  3 12:14:17 2014
@@ -1250,10 +1250,14 @@ public abstract class AbstractHttp11Proc
 if (http11) {
 expectMB = headers.getValue("expect");
 }
-if ((expectMB != null)
-&& (expectMB.indexOfIgnoreCase("100-continue", 0) != -1)) {
-getInputBuffer().setSwallowInput(false);
-expectation = true;
+if (expectMB != null) {
+if (expectMB.indexOfIgnoreCase("100-continue", 0) != -1) {
+getInputBuffer().setSwallowInput(false);
+expectation = true;
+} else {
+error = true;
+response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED);
+}
 }
 
 // Check user-agent header

Modified: tomcat/trunk/test/org/apache/catalina/startup/SimpleHttpClient.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/SimpleHttpClient.java?rev=1599500&r1=1599499&r2=1599500&view=diff
==
--- tomcat/trunk/test/org/apache/catalina/startup/SimpleHttpClient.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/startup/SimpleHttpClient.java Tue Jun 
 3 12:14:17 2014
@@ -54,6 +54,7 @@ public abstract class SimpleHttpClient {
 public static final String FAIL_404 = "HTTP/1.1 404";
 public static final String TIMEOUT_408 = "HTTP/1.1 408";
 public static final String FAIL_413 = "HTTP/1.1 413";
+public static final String FAIL_417 = "HTTP/1.1 417";
 public static final String FAIL_50X = "HTTP/1.1 50";
 public static final String FAIL_500 = "HTTP/1.1 500";
 public static final String FAIL_501 = "HTTP/1.1 501";
@@ -421,6 +422,10 @@ public abstract class SimpleHttpClient {
 return getResponseLine().startsWith(FAIL_413);
 }
 
+public boolean isResponse417() {
+return getResponseLine().startsWith(FAIL_417);
+}
+
 public boolean isResponse50x() {
 return getResponseLine().startsWith(FAIL_50X);
 }

Modified: 
tomcat/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java?rev=1599500&r1=1599499&r2=1599500&view=diff
==
--- tomcat/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java 
(original)
+++ tomcat/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java 
Tue Jun  3 12:14:17 2014
@@ -53,6 +53,31 @@ import org.apache.tomcat.util.buf.ByteCh
 public class TestAbstractHttp11Processor extends TomcatBaseTest {
 
 @Test
+public void testWithUnknownExpectation() throws Exception {
+Tomcat tomcat = getTomcatInstance();
+
+// Use the normal Tomcat ROOT context
+File root = new File("test/webapp");
+tomcat.addWebapp("", root.getAbsolutePath());
+
+tomcat.start();
+
+String request =
+"POST /echo-params.jsp HTTP/1.1" + SimpleHttpClient.CRLF +
+"Host: any" + SimpleHttpClient.CRLF +
+"Expect: unknoen" + SimpleHttpClient.CRLF +
+SimpleHttpClient.CRLF;
+
+Client client = new Client(tomcat.getConnector().getLocalPort());
+client.setRequest(new String[] {request});
+
+client.connect();
+client.processRequest();
+assertTrue(client.isResponse417());
+}
+
+
+@Test
 public void testWithTEVoid() throws Exception {
 Tomcat tomcat = getTomcatInstance();
 



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



svn commit: r1599479 - /tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java

2014-06-03 Thread markt
Author: markt
Date: Tue Jun  3 11:31:33 2014
New Revision: 1599479

URL: http://svn.apache.org/r1599479
Log:
Tweak comments

Modified:
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1599479&r1=1599478&r2=1599479&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Tue 
Jun  3 11:31:33 2014
@@ -1119,8 +1119,8 @@ public abstract class AbstractHttp11Proc
 } else if (expectation &&
 (response.getStatus() < 200 || response.getStatus() > 
299)) {
 // Client sent Expect: 100-continue but received a
-// non-2xx response. Disable keep-alive (if enabled) to
-// ensure the connection is closed. Some clients may
+// non-2xx final response. Disable keep-alive (if enabled)
+// to ensure that the connection is closed. Some clients 
may
 // still send the body, some may send the next request.
 // No way to differentiate, so close the connection to
 // force the client to send the next request.



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



svn commit: r1599460 - in /tomcat/trunk/java/org/apache/coyote: AbstractProcessor.java ajp/AbstractAjpProcessor.java http11/AbstractHttp11Processor.java spdy/SpdyProcessor.java

2014-06-03 Thread markt
Author: markt
Date: Tue Jun  3 09:39:12 2014
New Revision: 1599460

URL: http://svn.apache.org/r1599460
Log:
Pull up error flag

Modified:
tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java
tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java

Modified: tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java?rev=1599460&r1=1599459&r2=1599460&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/AbstractProcessor.java Tue Jun  3 
09:39:12 2014
@@ -39,6 +39,11 @@ public abstract class AbstractProcessor<
 protected final Response response;
 protected SocketWrapper socketWrapper = null;
 
+/**
+ * Error flag.
+ */
+protected boolean error;
+
 
 /**
  * Intended for use by the Upgrade sub-classes that have no need to

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1599460&r1=1599459&r2=1599460&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java Tue Jun  
3 09:39:12 2014
@@ -200,12 +200,6 @@ public abstract class AbstractAjpProcess
 
 
 /**
- * Error flag.
- */
-protected boolean error = false;
-
-
-/**
  * Host name (used to avoid useless B2C conversion on the host name).
  */
 protected char[] hostNameC = new char[0];

Modified: 
tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1599460&r1=1599459&r2=1599460&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Tue 
Jun  3 09:39:12 2014
@@ -89,12 +89,6 @@ public abstract class AbstractHttp11Proc
 
 
 /**
- * Error flag.
- */
-protected boolean error = false;
-
-
-/**
  * Keep-alive.
  */
 protected boolean keepAlive = true;

Modified: tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java?rev=1599460&r1=1599459&r2=1599460&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java Tue Jun  3 
09:39:12 2014
@@ -70,8 +70,6 @@ public class SpdyProcessor extends Ab
 
 private final ByteChunk keyBuffer = new ByteChunk();
 
-private boolean error = false;
-
 private boolean finished;
 
 private SpdyFrame inFrame = null;



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