svn commit: r1479805 - in /tomcat/trunk: java/org/apache/catalina/ha/deploy/FarmWarDeployer.java java/org/apache/catalina/ha/deploy/FileMessageFactory.java java/org/apache/catalina/ha/deploy/mbeans-de

2013-05-07 Thread kfujino
Author: kfujino
Date: Tue May  7 08:26:30 2013
New Revision: 1479805

URL: http://svn.apache.org/r1479805
Log:
Avoid FileMessageFactory leak.
FileMessageFactory will be removed immediately after receiving the complete WAR 
file but when failing to receive a FileMessage which was sent dividing, 
FileMessageFactory will leak without being removed.
Add a newly maxValidTime attribute to prevent the leak of FileMessageFactory.
FileMessageFactory that is leaking will be automatically removed after 
maxValidTime.

Modified:
tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
tomcat/trunk/java/org/apache/catalina/ha/deploy/mbeans-descriptors.xml
tomcat/trunk/webapps/docs/config/cluster-deployer.xml

Modified: tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java?rev=1479805&r1=1479804&r2=1479805&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java Tue 
May  7 08:26:30 2013
@@ -126,6 +126,11 @@ public class FarmWarDeployer extends Clu
  */
 protected ObjectName oname = null;
 
+/**
+ * The maximum valid time(in seconds) for FileMessageFactory.
+ */
+protected int maxValidTime = 5 * 60;
+
 /*--Constructor-*/
 public FarmWarDeployer() {
 }
@@ -298,6 +303,7 @@ public class FarmWarDeployer extends Clu
 FileMessageFactory factory = fileFactories.get(msg.getFileName());
 if (factory == null) {
 factory = FileMessageFactory.getInstance(writeToFile, true);
+factory.setMaxValidTime(maxValidTime);
 fileFactories.put(msg.getFileName(), factory);
 }
 return factory;
@@ -560,11 +566,14 @@ public class FarmWarDeployer extends Clu
  */
 @Override
 public void backgroundProcess() {
-if (started && watchEnabled) {
-count = (count + 1) % processDeployFrequency;
-if (count == 0) {
-watcher.check();
+if (started) {
+if (watchEnabled) {
+count = (count + 1) % processDeployFrequency;
+if (count == 0) {
+watcher.check();
+}
 }
+removeInvalidFileFactories();
 }
 
 }
@@ -703,6 +712,14 @@ public class FarmWarDeployer extends Clu
 this.processDeployFrequency = processExpiresFrequency;
 }
 
+public int getMaxValidTime() {
+return maxValidTime;
+}
+
+public void setMaxValidTime(int maxValidTime) {
+this.maxValidTime = maxValidTime;
+}
+
 /**
  * Copy a file to the specified temp directory.
  * @param from copy from temp
@@ -737,6 +754,16 @@ public class FarmWarDeployer extends Clu
 return true;
 }
 
+protected void removeInvalidFileFactories() {
+String[] fileNames = fileFactories.keySet().toArray(new String[0]);
+for (String fileName : fileNames) {
+FileMessageFactory factory = fileFactories.get(fileName);
+if (!factory.isValid()) {
+fileFactories.remove(fileName);
+}
+}
+}
+
 private File getAbsolutePath(String path) {
 File dir = new File(path);
 if (!dir.isAbsolute()) {

Modified: 
tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java?rev=1479805&r1=1479804&r2=1479805&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java Tue 
May  7 08:26:30 2013
@@ -121,6 +121,16 @@ public class FileMessageFactory {
 protected boolean isWriting = false;
 
 /**
+ * The time this instance was created. (in milliseconds)
+ */
+protected long creationTime = 0;
+
+/**
+ * The maximum valid time(in seconds) from creationTime.
+ */
+protected int maxValidTime = -1;
+
+/**
  * Private constructor, either instantiates a factory to read or write. 

  * When openForWrite==true, then a the file, f, will be created and an
  * output stream is opened to write to it. 
@@ -155,7 +165,7 @@ public class FileMessageFactory {
 totalNrOfMessages = (size / READ_SIZE) + 1;
 in = new FileInputStream(f);
 }//end if
-
+creationTime = System.currentTimeMillis();
 }
 
 /**
@@ -379,4 +389,24 @@ public class FileMessageFactory {
 return file;
 }
 
+p

svn commit: r1479807 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/ha/deploy/ webapps/docs/ webapps/docs/config/

2013-05-07 Thread kfujino
Author: kfujino
Date: Tue May  7 08:36:39 2013
New Revision: 1479807

URL: http://svn.apache.org/r1479807
Log:
Avoid FileMessageFactory leak.
FileMessageFactory will be removed immediately after receiving the complete WAR 
file but when failing to receive a FileMessage which was sent dividing, 
FileMessageFactory will leak without being removed.
Add a newly maxValidTime attribute to prevent the leak of FileMessageFactory.
FileMessageFactory that is leaking will be automatically removed after 
maxValidTime.

Modified:
tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java

tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java

tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/deploy/mbeans-descriptors.xml
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
tomcat/tc7.0.x/trunk/webapps/docs/config/cluster-deployer.xml

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java?rev=1479807&r1=1479806&r2=1479807&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java 
Tue May  7 08:36:39 2013
@@ -137,6 +137,11 @@ public class FarmWarDeployer extends Clu
  */
 protected ObjectName oname = null;
 
+/**
+ * The maximum valid time(in seconds) for FileMessageFactory.
+ */
+protected int maxValidTime = 5 * 60;
+
 /*--Constructor-*/
 public FarmWarDeployer() {
 }
@@ -334,6 +339,7 @@ public class FarmWarDeployer extends Clu
 FileMessageFactory factory = fileFactories.get(msg.getFileName());
 if (factory == null) {
 factory = FileMessageFactory.getInstance(writeToFile, true);
+factory.setMaxValidTime(maxValidTime);
 fileFactories.put(msg.getFileName(), factory);
 }
 return factory;
@@ -619,11 +625,14 @@ public class FarmWarDeployer extends Clu
  */
 @Override
 public void backgroundProcess() {
-if (started && watchEnabled) {
-count = (count + 1) % processDeployFrequency;
-if (count == 0) {
-watcher.check();
+if (started) {
+if (watchEnabled) {
+count = (count + 1) % processDeployFrequency;
+if (count == 0) {
+watcher.check();
+}
 }
+removeInvalidFileFactories();
 }
 
 }
@@ -762,6 +771,14 @@ public class FarmWarDeployer extends Clu
 this.processDeployFrequency = processExpiresFrequency;
 }
 
+public int getMaxValidTime() {
+return maxValidTime;
+}
+
+public void setMaxValidTime(int maxValidTime) {
+this.maxValidTime = maxValidTime;
+}
+
 /**
  * Copy a file to the specified temp directory.
  * @param from copy from temp
@@ -796,6 +813,16 @@ public class FarmWarDeployer extends Clu
 return true;
 }
 
+protected void removeInvalidFileFactories() {
+String[] fileNames = fileFactories.keySet().toArray(new String[0]);
+for (String fileName : fileNames) {
+FileMessageFactory factory = fileFactories.get(fileName);
+if (!factory.isValid()) {
+fileFactories.remove(fileName);
+}
+}
+}
+
 private File getAbsolutePath(String path) {
 File dir = new File(path);
 File base = new File(System.getProperty(Globals.CATALINA_BASE_PROP));

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java?rev=1479807&r1=1479806&r2=1479807&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java 
Tue May  7 08:36:39 2013
@@ -122,6 +122,16 @@ public class FileMessageFactory {
 protected boolean isWriting = false;
 
 /**
+ * The time this instance was created. (in milliseconds)
+ */
+protected long creationTime = 0;
+
+/**
+ * The maximum valid time(in seconds) from creationTime.
+ */
+protected int maxValidTime = -1;
+
+/**
  * Private constructor, either instantiates a factory to read or write. 

  * When openForWrite==true, then a the file, f, will be created and an
  * output stream is opened to write to it. 
@@ -156,7 +166,7 @@ public class FileMessageFactory {
 totalNrOfMessages = (size / READ_SIZE) + 1;
 in = new Fil

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

2013-05-07 Thread markt
Author: markt
Date: Tue May  7 10:02:49 2013
New Revision: 1479835

URL: http://svn.apache.org/r1479835
Log:
Fix copy/paste error - thanks kkolinko

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=1479835&r1=1479834&r2=1479835&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
(original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Tue 
May  7 10:02:49 2013
@@ -1584,7 +1584,7 @@ public abstract class AbstractHttp11Proc
 request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, x);
 }
 } catch (IllegalStateException x) {
-registerForEvent(false, true);
+registerForEvent(true, false);
 }
 }
 



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



Re: svn commit: r1478596 - /tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java

2013-05-07 Thread Mark Thomas
On 07/05/2013 07:19, Konstantin Kolinko wrote:
> 2013/5/3  :
>> Author: markt
>> Date: Thu May  2 22:52:36 2013
>> New Revision: 1478596
>>
>> URL: http://svn.apache.org/r1478596
>> Log:
>> A little more refactoring to make pulling code up easier
>>
>> Modified:
>> tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
>>
>> Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1478596&r1=1478595&r2=1478596&view=diff
>> ==
>> --- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java 
>> (original)
>> +++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Thu 
>> May  2 22:52:36 2013

>> @@ -203,7 +203,7 @@ public class Http11NioProcessor extends
>>  request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, 
>> x);
>>  }
>>  } catch (IllegalStateException x) {
>> -registerForEvent(SelectionKey.OP_READ);
>> +registerForEvent(false, true);
> 
> The above should be "(true, false)", unless this change was intended.

Fixed.

Thanks.

Mark


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



Re: [VOTE] Release Apache Tomcat 7.0.40

2013-05-07 Thread Violeta Georgieva
2013/5/5 Mark Thomas 
>
> The proposed Apache Tomcat 7.0.40 release is now available for voting.
>
> It can be obtained from:
> https://dist.apache.org/repos/dist/dev/tomcat/tomcat-7/v7.0.40/
> The Maven staging repo is:
> https://repository.apache.org/content/repositories/orgapachetomcat-001/
> The svn tag is:
> http://svn.apache.org/repos/asf/tomcat/tc7.0.x/tags/TOMCAT_7_0_40/
>
> The proposed 7.0.40 release is:
> [ ] Broken - do not release
> [X] Stable - go ahead and release as 7.0.40 Stable

Tested Tomcat in OSGi environment - successful
Basic performance tests - successful

Regards
Violeta


Re: [VOTE] Release Apache Tomcat 7.0.40

2013-05-07 Thread Ognjen Blagojevic

On 5.5.2013 12:44, Mark Thomas wrote:

The proposed Apache Tomcat 7.0.40 release is now available for voting.

It can be obtained from:
https://dist.apache.org/repos/dist/dev/tomcat/tomcat-7/v7.0.40/
The Maven staging repo is:
https://repository.apache.org/content/repositories/orgapachetomcat-001/
The svn tag is:
http://svn.apache.org/repos/asf/tomcat/tc7.0.x/tags/TOMCAT_7_0_40/

The proposed 7.0.40 release is:
[ ] Broken - do not release
[X] Stable - go ahead and release as 7.0.40 Stable


Tested with several webapps that are in active development.
Tested SSL/TLS connectivity for BIO and NIO.
Tested jsvc.

-Ognjen

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



Automatic deployment changes

2013-05-07 Thread Mark Thomas
There have been a few queries [1], [2] recently and there is a long
standard enhancement request [3] regarding automatic deployment.

What has made changes in this area difficult in the past is a) a lack of
a clear definition as to what the expected behaviour is and b) a lack of
test cases to validate that behaviour.

In an attempt to improve the situation, I have tried to document a
proposed expected behaviour [4]. There may be some deviations from the
current behaviour and support for fixing BZ 51294 is new. I hope to
start implementing some test cases for [4] soon. Before I do, any
feedback on the proposed expected behaviour?

I haven't looked in detail at the existing code yet. The proposal may
need tweaking to minimise the deviation from the current behaviour.

Mark


[1] http://markmail.org/thread/pdxtvapqsr7mw7ju
[2] http://tomcat.markmail.org/thread/pf4wbgr7d7zwptcl
[3] https://issues.apache.org/bugzilla/show_bug.cgi?id=51294
[4] http://people.apache.org/~markt/dev/auto-deployment-proposed.txt

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



svn commit: r1479951 - in /tomcat/trunk: java/org/apache/tomcat/util/http/parser/HttpParser.java test/org/apache/tomcat/util/http/parser/TestMediaType.java

2013-05-07 Thread markt
Author: markt
Date: Tue May  7 15:51:22 2013
New Revision: 1479951

URL: http://svn.apache.org/r1479951
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54703
Be tolerant of applications that pass CR or LF in setHeader() values.
Fix some whitespace parsing issues idnetifed by the extended test cases in 
readTokenOrQuotedString()

Modified:
tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java
tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java?rev=1479951&r1=1479950&r2=1479951&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java Tue 
May  7 15:51:22 2013
@@ -260,17 +260,34 @@ public class HttpParser {
 }
 }
 
-private static SkipConstantResult skipConstant(StringReader input,
-String constant) throws IOException {
-int len = constant.length();
+// Skip any LWS and return the next char
+private static int skipLws(StringReader input, boolean withReset)
+throws IOException {
 
+if (withReset) {
+input.mark(1);
+}
 int c = input.read();
 
-// Skip lws
-while (c == 32 || c == 9) {
+while (c == 32 || c == 9 || c == 10 || c == 13) {
+if (withReset) {
+input.mark(1);
+}
 c = input.read();
 }
 
+if (withReset) {
+input.reset();
+}
+return c;
+}
+
+private static SkipConstantResult skipConstant(StringReader input,
+String constant) throws IOException {
+int len = constant.length();
+
+int c = skipLws(input, false);
+
 for (int i = 0; i < len; i++) {
 if (i == 0 && c == -1) {
 return SkipConstantResult.EOF;
@@ -294,12 +311,7 @@ public class HttpParser {
 private static String readToken(StringReader input) throws IOException {
 StringBuilder result = new StringBuilder();
 
-int c = input.read();
-
-// Skip lws
-while (c == 32 || c == 9) {
-c = input.read();
-}
+int c = skipLws(input, false);
 
 while (c != -1 && isToken(c)) {
 result.append((char) c);
@@ -323,12 +335,7 @@ public class HttpParser {
 private static String readQuotedString(StringReader input,
 boolean returnQuoted) throws IOException {
 
-int c = input.read();
-
-// Skip lws
-while (c == 32 || c == 9) {
-c = input.read();
-}
+int c = skipLws(input, false);
 
 if (c != '"') {
 return null;
@@ -364,12 +371,8 @@ public class HttpParser {
 private static String readTokenOrQuotedString(StringReader input,
 boolean returnQuoted) throws IOException {
 
-// Use mark/reset as skip(-1) fails when reading the last character of
-// the input
-input.mark(1);
-int c = input.read();
-// Go back so first character is available to be read again
-input.reset();
+// Go back so first non-LWS character is available to be read again
+int c = skipLws(input, true);
 
 if (c == '"') {
 return readQuotedString(input, returnQuoted);
@@ -396,12 +399,7 @@ public class HttpParser {
 StringBuilder result = new StringBuilder();
 boolean quoted = false;
 
-int c = input.read();
-
-// Skip lws
-while (c == 32 || c == 9) {
-c = input.read();
-}
+int c = skipLws(input, false);
 
 if (c == '"') {
 quoted = true;
@@ -453,12 +451,7 @@ public class HttpParser {
 StringBuilder result = new StringBuilder();
 boolean quoted = false;
 
-int c = input.read();
-
-// Skip lws
-while (c == 32 || c == 9) {
-c = input.read();
-}
+int c = skipLws(input, false);
 
 if (c == '"') {
 quoted = true;

Modified: 
tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java?rev=1479951&r1=1479950&r2=1479951&view=diff
==
--- tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java 
(original)
+++ tomcat/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java Tue 
May  7 15:51:22 2013
@@ -46,6 +46,7 @@ public class TestMediaType {
 new Parameter("z", "\"\"");
 private static final Parameter PARAM_COMPLEX_QUOTED =
 new Parameter("w

svn commit: r1479953 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/http/parser/HttpParser.java test/org/apache/tomcat/util/http/parser/TestMediaType.java webapps/docs/changelog.xml

2013-05-07 Thread markt
Author: markt
Date: Tue May  7 15:54:36 2013
New Revision: 1479953

URL: http://svn.apache.org/r1479953
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54703
Be tolerant of applications that pass CR or LF in setHeader() values.
Fix some whitespace parsing issues idnetifed by the extended test cases in 
readTokenOrQuotedString()

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java

tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1479248,1479951

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java?rev=1479953&r1=1479952&r2=1479953&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/parser/HttpParser.java 
Tue May  7 15:54:36 2013
@@ -262,17 +262,34 @@ public class HttpParser {
 }
 }
 
-private static SkipConstantResult skipConstant(StringReader input,
-String constant) throws IOException {
-int len = constant.length();
+// Skip any LWS and return the next char
+private static int skipLws(StringReader input, boolean withReset)
+throws IOException {
 
+if (withReset) {
+input.mark(1);
+}
 int c = input.read();
 
-// Skip lws
-while (c == 32 || c == 9) {
+while (c == 32 || c == 9 || c == 10 || c == 13) {
+if (withReset) {
+input.mark(1);
+}
 c = input.read();
 }
 
+if (withReset) {
+input.reset();
+}
+return c;
+}
+
+private static SkipConstantResult skipConstant(StringReader input,
+String constant) throws IOException {
+int len = constant.length();
+
+int c = skipLws(input, false);
+
 for (int i = 0; i < len; i++) {
 if (i == 0 && c == -1) {
 return SkipConstantResult.EOF;
@@ -296,12 +313,7 @@ public class HttpParser {
 private static String readToken(StringReader input) throws IOException {
 StringBuilder result = new StringBuilder();
 
-int c = input.read();
-
-// Skip lws
-while (c == 32 || c == 9) {
-c = input.read();
-}
+int c = skipLws(input, false);
 
 while (c != -1 && isToken(c)) {
 result.append((char) c);
@@ -325,12 +337,7 @@ public class HttpParser {
 private static String readQuotedString(StringReader input,
 boolean returnQuoted) throws IOException {
 
-int c = input.read();
-
-// Skip lws
-while (c == 32 || c == 9) {
-c = input.read();
-}
+int c = skipLws(input, false);
 
 if (c != '"') {
 return null;
@@ -366,12 +373,8 @@ public class HttpParser {
 private static String readTokenOrQuotedString(StringReader input,
 boolean returnQuoted) throws IOException {
 
-// Use mark/reset as skip(-1) fails when reading the last character of
-// the input
-input.mark(1);
-int c = input.read();
-// Go back so first character is available to be read again
-input.reset();
+// Go back so first non-LWS character is available to be read again
+int c = skipLws(input, true);
 
 if (c == '"') {
 return readQuotedString(input, returnQuoted);
@@ -398,12 +401,7 @@ public class HttpParser {
 StringBuilder result = new StringBuilder();
 boolean quoted = false;
 
-int c = input.read();
-
-// Skip lws
-while (c == 32 || c == 9) {
-c = input.read();
-}
+int c = skipLws(input, false);
 
 if (c == '"') {
 quoted = true;
@@ -455,12 +453,7 @@ public class HttpParser {
 StringBuilder result = new StringBuilder();
 boolean quoted = false;
 
-int c = input.read();
-
-// Skip lws
-while (c == 32 || c == 9) {
-c = input.read();
-}
+int c = skipLws(input, false);
 
 if (c == '"') {
 quoted = true;

Modified: 
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java?rev=1479953&r1=1479952&r2=1479953&view=diff
==
--- 
tomcat/tc7.0.x/trunk/test/org/apache/tomcat

[Bug 54703] Nullpointer exception in HttpParser.parseMediaType

2013-05-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=54703

Mark Thomas  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Mark Thomas  ---
Fixed in trunk and 7.0.x and will be included in 7.0.41 onwards.

As an added bonus the extra test cases identified some errors in the existing
white space parsing that have also been 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



Re: Automatic deployment changes

2013-05-07 Thread Remy Maucherat
On Tue, 2013-05-07 at 13:54 +0100, Mark Thomas wrote:
> What has made changes in this area difficult in the past is a) a lack of
> a clear definition as to what the expected behaviour is and b) a lack of
> test cases to validate that behaviour.

a) is very true ...
Anyway, I think it's very good to specify it.

OTOH, the application server I know about uses marker files to expose
the deployment state, allow the user to manage them, and also (perhaps
more importantly) copies the said deployments to an internal location
(something which I obviously chose to avoid at all costs in Tomcat when
I did the deployer hacks). That sort of behavior is a possible option,
but I'm not sure it fits Tomcat well.

Rémy



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



Re: [VOTE] Release Apache Tomcat 7.0.40

2013-05-07 Thread Jeanfrancois Arcand




The proposed 7.0.40 release is:
[ ] Broken - do not release
[X] Stable - go ahead and release as 7.0.40 Stable


Tested with Atmosphere Framework both Comet and WebSocket.

-- Jeanfrancois

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



svn commit: r1480016 - /tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java

2013-05-07 Thread markt
Author: markt
Date: Tue May  7 18:46:06 2013
New Revision: 1480016

URL: http://svn.apache.org/r1480016
Log:
Typo

Modified:
tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java

Modified: 
tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java?rev=1480016&r1=1480015&r2=1480016&view=diff
==
--- tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java 
Tue May  7 18:46:06 2013
@@ -135,14 +135,14 @@ public class TestNonBlockingAPI extends 
 Tomcat tomcat = getTomcatInstance();
 
 // Not applicable to BIO. This test does not start a new thread for the
-// write so with BIO all the writes happen in the service() mehtod just
+// write so with BIO all the writes happen in the service() method just
 // like blocking IO.
 if (tomcat.getConnector().getProtocolHandlerClassName().equals(
 "org.apache.coyote.http11.Http11Protocol")) {
 return;
 }
 
-// TODO Non-blocking reads are not yet implemented for APR so this test
+// TODO Non-blocking writes are not yet implemented for APR so this 
test
 // will not pass.
 if (tomcat.getConnector().getProtocolHandlerClassName().equals(
 "org.apache.coyote.http11.Http11AprProtocol")) {



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



Re: [VOTE] Release Apache Tomcat 7.0.40

2013-05-07 Thread Christopher Schultz
Mark,

On 5/5/13 6:44 AM, Mark Thomas wrote:
> The proposed Apache Tomcat 7.0.40 release is now available for voting.
> 
> It can be obtained from:
> https://dist.apache.org/repos/dist/dev/tomcat/tomcat-7/v7.0.40/
> The Maven staging repo is:
> https://repository.apache.org/content/repositories/orgapachetomcat-001/
> The svn tag is:
> http://svn.apache.org/repos/asf/tomcat/tc7.0.x/tags/TOMCAT_7_0_40/
> 
> The proposed 7.0.40 release is:
> [ ] Broken - do not release
> [+] Stable - go ahead and release as 7.0.40 Stable

Tested successfully with development webapps. Also:

- ZIP and tarball are the same
- GPG sigs check-out
- Java code builds
- tcnative builds cleanly (a few warnings, see below)
- Unit tests build
- "Validate" target shows no warnings (though checkstyle is not run for
some reason -- I'll investigate)
- Tribes unit tests do not pass for me (additional setup needed? This is
not unusual for me to have these tests fail)
- Other unit tests pass (BIO, NIO, APR).

For those curious about such things, the whole automated build-and-test
process took about 30 minutes on my "m1.large" EC2 instance that is
under light use during the whole process.

Thanks,
-chris

tcnative compiler warnings (note: compiler is "gcc (Debian 4.7.2-5)
4.7.2" on Debian Linux x86-64, OpenSSL is "OpenSSL 1.0.1e 11 Feb 2013"
and APR is 1.4.6):

src/sslcontext.c: In function 'Java_org_apache_tomcat_jni_SSLContext_make':
src/sslcontext.c:77:17: warning: implicit declaration of function
'SSLv2_client_method' [-Wimplicit-function-declaration]
src/sslcontext.c:77:17: warning: passing argument 1 of 'SSL_CTX_new'
makes pointer from integer without a cast [enabled by default]
In file included from
/home/cschultz/projects/apache-tomcat/tarball/apache-tomcat-7.0.40-src/output/build/bin/native/tomcat-native-1.1.27-src/jni/native/include/ssl_private.h:43:0,
 from src/sslcontext.c:30:
/usr/include/openssl/ssl.h:1664:10: note: expected 'const struct
SSL_METHOD *' but argument is of type 'int'
src/sslcontext.c:79:17: warning: implicit declaration of function
'SSLv2_server_method' [-Wimplicit-function-declaration]
src/sslcontext.c:79:17: warning: passing argument 1 of 'SSL_CTX_new'
makes pointer from integer without a cast [enabled by default]
In file included from
/home/cschultz/projects/apache-tomcat/tarball/apache-tomcat-7.0.40-src/output/build/bin/native/tomcat-native-1.1.27-src/jni/native/include/ssl_private.h:43:0,
 from src/sslcontext.c:30:
/usr/include/openssl/ssl.h:1664:10: note: expected 'const struct
SSL_METHOD *' but argument is of type 'int'
src/sslcontext.c:81:17: warning: implicit declaration of function
'SSLv2_method' [-Wimplicit-function-declaration]
src/sslcontext.c:81:17: warning: passing argument 1 of 'SSL_CTX_new'
makes pointer from integer without a cast [enabled by default]
In file included from
/home/cschultz/projects/apache-tomcat/tarball/apache-tomcat-7.0.40-src/output/build/bin/native/tomcat-native-1.1.27-src/jni/native/include/ssl_private.h:43:0,
 from src/sslcontext.c:30:
/usr/include/openssl/ssl.h:1664:10: note: expected 'const struct
SSL_METHOD *' but argument is of type 'int'



signature.asc
Description: OpenPGP digital signature


Re: [VOTE] Release Apache Tomcat 7.0.40

2013-05-07 Thread Christopher Schultz
Mark,

On 5/7/13 3:43 PM, Christopher Schultz wrote:
> - "Validate" target shows no warnings (though checkstyle is not run for
> some reason -- I'll investigate)

Okay, checkstyle runs, now nary a warning.

-chris



signature.asc
Description: OpenPGP digital signature


Re: Automatic deployment changes

2013-05-07 Thread Christopher Schultz
Mark,

On 5/7/13 8:54 AM, Mark Thomas wrote:
> In an attempt to improve the situation, I have tried to document a
> proposed expected behaviour [4].

Cool. Two question:

1. What is the difference between "Y/N" and "-" in a column? Y/N seems
to mean "does not matter". Does "-" mean "does not apply"? If both WAR=Y
and DIR=Y (column headers, not row headers) which takes precedence?


2. Does the order of your table indicate precedence -- for example, we
"prefer" XML to, say, WAR or DIR, right? If so, that indicates that we
prefer "WAR" to "DIR" but above the table you say "If both a WAR and a
DIR are available for a web application, Tomcat will serve content from
the DIR." which indicates the opposite. Perhaps the rows in the table
could be re-ordered to indicate the order in which Tomcat checks for
those artifacts -- stopping at the first one found and processing
according to the rules you are trying to express.

Thanks,
-chris



signature.asc
Description: OpenPGP digital signature


Re: Automatic deployment changes

2013-05-07 Thread Mark Thomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 07/05/2013 21:13, Christopher Schultz wrote:
> Mark,
> 
> On 5/7/13 8:54 AM, Mark Thomas wrote:
>> In an attempt to improve the situation, I have tried to document
>> a proposed expected behaviour [4].
> 
> Cool. Two question:
> 
> 1. What is the difference between "Y/N" and "-" in a column? Y/N
> seems to mean "does not matter". Does "-" mean "does not apply"? If
> both WAR=Y and DIR=Y (column headers, not row headers) which takes
> precedence?

Y/N means the behaviour is the same regardless of how the option is
configured.

The meaning of '-' varied a little between the tables. I've removed
them from the first table.

In the second and third tables '-' means "unchanged from not present".
I could have used N but I wanted to make it clearer what was changing.

> 2. Does the order of your table indicate precedence -- for example,
> we "prefer" XML to, say, WAR or DIR, right? If so, that indicates
> that we prefer "WAR" to "DIR"

Yes. The order is always XML, WAR, DIR.

> but above the table you say "If both a WAR and a DIR are available
> for a web application, Tomcat will serve content from the DIR."
> which indicates the opposite.

That is strictly for performance reasons when serving content and
doesn't affect deployment.

> Perhaps the rows in the table could be re-ordered to indicate the
> order in which Tomcat checks for those artifacts -- stopping at the
> first one found and processing according to the rules you are
> trying to express.

The columns are already in that order.

I've updated the doc to try and clarify these points.

Mark

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRiWyZAAoJEBDAHFovYFnn5hUP/2zVopqI1lEa35UHiqZQ2/wW
6gpXNM+Run4lImt1MH7EVz0GMPzKUsrR94E0j5I9hL8rxHPBKChLNNE3ZS061VHr
ozjXsepDeBhpJLSDFk61OAsNd8vaqbfR/GfN0g59Fsntd9Ex/qMu0dScXyvnajmD
E7xh8mDbDKaPP83PajXQKYvhUanIzP6aFyCoU1kCZlzzcA7KIA14xkWpca3SbZv7
opkjBN97WtNEQX68vNEYtngyZmcIxlN78/YWctjUvNHFFlTxax2hOHQwuJ3YTfHj
DOKVmxktWZlLL4cRFIXfuRnMDzDjUxeE/UxRbQw7aLfVBb75Xk9HFgtpGy+r7D7q
6fkyAI/JshCONNdzfqXGNgdeUlCXD4LMNVomHfJuz0If6D6HJWqXfogAIsZqSjTu
VxLPUwKkNWDiSiGDKIeNJCvqL+thim/CPE2rwzX19/TxdPcE/+kw0n7vWju9su4w
5mh27OJtatAuhpp7Ww+SKpylGG9DdXugAMJ8YBiy9ePCCqZzjB9acn0T7bU0q25y
KNsDHscoZrRfxFPZ0eUm2fx+/KVcQykXaYyberqGsSy62D6Zlc2VNxGRHWf/59EZ
06nFYBBczz5rLhjTiv9nBPbzhSbEOUDY/WN5bz45NfHAVshpWCqT4v6oLwxMYxNX
cdfqWUNM8405gKZXkdU+
=9vTM
-END PGP SIGNATURE-

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



[Bug 54882] HttpServletRequest.getRequestURI() returns also fragment

2013-05-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=54882

--- Comment #8 from Konstantin Preißer  ---
To follow-up on this report:

I tested with current IE 10 and old IE 8 and cannot reproduce the behavior
described in this report.

When I submit a URL like "test.html#fragment" to a XMLHttpRequest in
Javascript, IE will send the following request to the server:

GET /test.html%23fragment HTTP/1.1
... [other headers]

which should be a valid URL (it would request a file called
"test.html#fragment").

HttpServletRequest.getRequestURI() on Tomcat 7.0.40 correctly returns
"/test.html%23fragment" in such a case.


So I don't think there is a IE bug here - maybe it could be called a "feature"
as it seems that IE's XMLHttpRequest treats a "#" as a character that was
forgotten to be encoded, since a fragment would not make sense for the
XMLHttpRequest, and therefore encodes it. This, however, does not match
behavior of other browsers like Firefox and Chrome, where the XMLHttpRequest
remove the "#"-part of the URL.

-- 
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 54882] HttpServletRequest.getRequestURI() returns also fragment

2013-05-07 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=54882

--- Comment #9 from Konstantin Preißer  ---
Sorry - there is a bug in IE, as the W3C working draft for XMLHttpRequest [1]
says that the "open() method" must run the following step when resolving the
URL:

  9. Drop  from url.

which IE doesn't follow, as it encodes the "#" character as "%23" instead of
removing the fragment part. However, I think the workaround in this case still
should be that the Javascript should not pass a URL with a fragment to the
XMLHttpRequest.


[1] http://www.w3.org/TR/XMLHttpRequest/#the-open%28%29-method

-- 
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