Re: svn commit: r1292127 - /tomcat/native/trunk/native/src/sslext.c

2012-02-22 Thread Mladen Turk

On 02/22/2012 05:52 AM, cos...@apache.org wrote:

Author: costin

+   if (len>  TCN_BUFFER_SZ) {
+   return -1;
+   }


Suppose that the len is presumed to always be shorter then 8K.



char * requestedTicket = apr_pcalloc(tcssl->pool, len);


suppose this can be be just
jbyte *requestedTicket = apr_pcalloc(tcssl->pool, len);
so that you don't need to cast later to jbyte*.



+   if (len>  TCN_BUFFER_SZ) {
+   return -1;
+   }


should be 'if (len >  TCN_BUFFER_SZ)'

Could you arrange the code style of this file.
I mean it uses tabs instead spaces, doesn't have spaces between operators,
C++ comments and so on.


Regards
--
^TM

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



DO NOT REPLY [Bug 51177] javax.el.MapELResolver getType returns class of kept object instead of Object.class

2012-02-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=51177

Michael Heinen  changed:

   What|Removed |Added

 CC||mhn4...@googlemail.com

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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



DO NOT REPLY [Bug 52735] Request.getRemoteAddr() throw NullPointerException

2012-02-22 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=52735

Konstantin Kolinko  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||INVALID

--- Comment #5 from Konstantin Kolinko  2012-02-22 
10:34:39 UTC ---
(In reply to comment #3)
> I am not sure what that means? One thing I can guarantee is that we handle the
> request/responses within the same thread, we don't create a new thread for
> this.

According to your stack trace you use a Future. It is executed asynchronously
in a different thread.

Subscribe to the users mailing list and ask there if you want to discuss it.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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: Release Tomcat Native 1.1.23

2012-02-22 Thread Costin Manolache
On Tue, Feb 21, 2012 at 11:11 PM, Mladen Turk  wrote:

> On 02/22/2012 06:17 AM, Costin Manolache wrote:
>
>> Mladen: please let me know if you want to further review the change or
>> should I merge it to the branch.
>>
>>
> Well I personally would not merge that into 1.1.x branch.
> It would be a bit weird to have 1.1.22 as is, and 1.1.23 with
> whole bunch of new features and API's.
> That's not why we introduced branches at the first place.
>
>
That's right, I agree.


>
>  I also noticed there are few other diffs - in particular the 'interrupt'
>> stuff in poll, few others.
>> Any plans to merge them too ?
>>
>
> Nope. Not to the 1.1.x branch
>
>
>  What's the plan with the trunk ?
>>
>>
> We can release 1.2.0 from trunk.
>

That was my question - I didn't see any releases out of trunk, I assumed
it's used
for development and after some 'soak' merged back into 1.1.x




> I see no problem with that.
> It requires apr-1.4.x so this might be a solution for
> that sslext code instead porting that back to 1.1.x
>

sslext works best with openssl 1.0.1 beta 2 ( i.e. latest ) - to get npn
working with older ssl it needs a patch ( nodejs, chrome do this ).
But it compiles and just lacks the npn feature without the patch.

So for me a 1.2.x with recent apr and openssl would be best.


> We can require 1.2.x for tomcat8 and actually use that
> new API's without worrying on backward compatibility.


I'm also interested in using the jni code 'standalone', so a native release
without tomcat8 would also be nice.

But no hurry - I was confused on the trunk->release branch policy.
The main problem with jni is getting it compiled and installed on users
machines.


Costin


>
>
>
>
> Regards
> --
> ^TM
>
> --**--**-
> To unsubscribe, e-mail: 
> dev-unsubscribe@tomcat.apache.**org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


svn commit: r1292334 - in /tomcat/trunk: java/org/apache/catalina/loader/VirtualWebappLoader.java webapps/docs/config/context.xml webapps/docs/config/loader.xml

2012-02-22 Thread kkolinko
Author: kkolinko
Date: Wed Feb 22 15:03:46 2012
New Revision: 1292334

URL: http://svn.apache.org/viewvc?rev=1292334&view=rev
Log:
Document that VirtualWebappLoader#virtualClasspath trims spaces from the values.
Use this feature to make documentation examples more readable.

Modified:
tomcat/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java
tomcat/trunk/webapps/docs/config/context.xml
tomcat/trunk/webapps/docs/config/loader.xml

Modified: tomcat/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java?rev=1292334&r1=1292333&r2=1292334&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java Wed 
Feb 22 15:03:46 2012
@@ -35,7 +35,8 @@ import org.apache.catalina.LifecycleExce
  * 
  * 
  *   
+ *  virtualClasspath="/dir/classes;/somedir/somejar.jar;
+ */somedir/*.jar"/>
  * 
  * 
  *

Modified: tomcat/trunk/webapps/docs/config/context.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/context.xml?rev=1292334&r1=1292333&r2=1292334&view=diff
==
--- tomcat/trunk/webapps/docs/config/context.xml (original)
+++ tomcat/trunk/webapps/docs/config/context.xml Wed Feb 22 15:03:46 2012
@@ -1283,9 +1283,10 @@ mywebapp/
 
 
   
+
extraResourcePaths="/WEB-INF/classes=/Users/theuser/mywebapp/target/classes" />
   
+virtualClasspath="/Users/theuser/mywebapp/target/classes;
+  /Users/theuser/.m2/repository/log4j/log4j/1.2.15/log4j-1.2.15.jar" />
   
 
 
@@ -1320,14 +1321,16 @@ mywebapp/
 
 
   
+
extraResourcePaths="/WEB-INF/classes=/Users/theuser/mywebapp/target/classes,/pictures=/Users/theuser/mypictures,/movies=/Users/theuser/mymovies"
 />
   
+virtualClasspath="/Users/theuser/mywebapp/target/classes;
+  /Users/theuser/mylib/target/classes;
+  /Users/theuser/.m2/repository/log4j/log4j/1.2.15/log4j-1.2.15.jar" />
   
 
 
 Note that resources in mylib/target/classes/META-INF/resources/ are 
mapped to / as
-required by servlet 3 specifications.
+required by servlet 3 specification.
   
 
 

Modified: tomcat/trunk/webapps/docs/config/loader.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/loader.xml?rev=1292334&r1=1292333&r2=1292334&view=diff
==
--- tomcat/trunk/webapps/docs/config/loader.xml (original)
+++ tomcat/trunk/webapps/docs/config/loader.xml Wed Feb 22 15:03:46 2012
@@ -151,8 +151,14 @@
 
   
 Additional repositories to search for resources.
-Multiple elements can be joined using ;
+Multiple values can be joined using ;
 as a separator.
+Leading and trailing whitespaces in values are ignored.
+If a value does not point to an existing directory or
+*.jar file, it is silently skipped.
+Diagnostic messages can be seen if you enable debug logging for
+the VirtualWebappLoader class.
+
 Example: 
virtualClasspath="${catalina.base}/myapp_config"
   
 



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



svn commit: r1292337 - /tomcat/native/trunk/native/src/sslext.c

2012-02-22 Thread costin
Author: costin
Date: Wed Feb 22 15:06:05 2012
New Revision: 1292337

URL: http://svn.apache.org/viewvc?rev=1292337&view=rev
Log:
Fix indentation, comments.

Modified:
tomcat/native/trunk/native/src/sslext.c

Modified: tomcat/native/trunk/native/src/sslext.c
URL: 
http://svn.apache.org/viewvc/tomcat/native/trunk/native/src/sslext.c?rev=1292337&r1=1292336&r2=1292337&view=diff
==
--- tomcat/native/trunk/native/src/sslext.c (original)
+++ tomcat/native/trunk/native/src/sslext.c Wed Feb 22 15:06:05 2012
@@ -31,579 +31,576 @@
 
 TCN_IMPLEMENT_CALL(jint, SSLExt, setSessionData)(TCN_STDARGS, jlong tcsock, 
jbyteArray buf, jint len)
 {
-   tcn_socket_t *s = J2P(tcsock, tcn_socket_t *);
-   tcn_ssl_conn_t *tcssl = (tcn_ssl_conn_t *)s->opaque;
-   jbyte bytes[TCN_BUFFER_SZ];
-   const jbyte *bytesp = &bytes[0];
-
-   if (len > TCN_BUFFER_SZ) {
-   return -1;
-   }
-   (*e)->GetByteArrayRegion(e, buf, 0, len, bytes);
-   SSL_SESSION* ssl_session = d2i_SSL_SESSION(NULL, (const unsigned char 
**)&bytesp, len);
+tcn_socket_t *s = J2P(tcsock, tcn_socket_t *);
+tcn_ssl_conn_t *tcssl = (tcn_ssl_conn_t *)s->opaque;
+jbyte bytes[TCN_BUFFER_SZ];
+const jbyte *bytesp = &bytes[0];
+
+if (len > TCN_BUFFER_SZ) {
+return -1;
+}
+(*e)->GetByteArrayRegion(e, buf, 0, len, bytes);
+SSL_SESSION* ssl_session = d2i_SSL_SESSION(NULL, (const unsigned char 
**)&bytesp, len);
 
-   SSL_set_session(tcssl->ssl, ssl_session);
-   return 0;
+SSL_set_session(tcssl->ssl, ssl_session);
+return 0;
 }
 
 TCN_IMPLEMENT_CALL(jbyteArray, SSLExt, getSessionData)(TCN_STDARGS, jlong 
tcsock)
 {
-   tcn_socket_t *s = J2P(tcsock, tcn_socket_t *);
-   tcn_ssl_conn_t *tcssl = (tcn_ssl_conn_t *)s->opaque;
-   SSL_SESSION *sess = SSL_get_session(tcssl->ssl);
-
-   int size = i2d_SSL_SESSION(sess, NULL);
-   if (size == 0 || size > TCN_BUFFER_SZ) {
-   return NULL;
-   }
-
-   jbyteArray javaBytes = (*e)->NewByteArray(e, size);
-   if (javaBytes != NULL) {
-   jbyte bytes[TCN_BUFFER_SZ];
-   unsigned char *bytesp = (unsigned char *)&bytes[0];
-
-   i2d_SSL_SESSION(sess, &bytesp);
-   (*e)->SetByteArrayRegion(e, javaBytes, 0, size, bytes);
-   }
+tcn_socket_t *s = J2P(tcsock, tcn_socket_t *);
+tcn_ssl_conn_t *tcssl = (tcn_ssl_conn_t *)s->opaque;
+SSL_SESSION *sess = SSL_get_session(tcssl->ssl);
+
+int size = i2d_SSL_SESSION(sess, NULL);
+if (size == 0 || size > TCN_BUFFER_SZ) {
+return NULL;
+}
+
+jbyteArray javaBytes = (*e)->NewByteArray(e, size);
+if (javaBytes != NULL) {
+jbyte bytes[TCN_BUFFER_SZ];
+unsigned char *bytesp = (unsigned char *)&bytes[0];
+
+i2d_SSL_SESSION(sess, &bytesp);
+(*e)->SetByteArrayRegion(e, javaBytes, 0, size, bytes);
+}
 
-   return javaBytes;
+return javaBytes;
 }
 
 TCN_IMPLEMENT_CALL(jint, SSLExt, getTicket)(TCN_STDARGS, jlong tcsock, 
jbyteArray buf)
 {
-   tcn_socket_t *s = J2P(tcsock, tcn_socket_t *);
-   tcn_ssl_conn_t *tcssl = (tcn_ssl_conn_t *)s->opaque;
-   int bufLen = (*e)->GetArrayLength(e, buf);
-
-   SSL_SESSION *x = SSL_get_session(tcssl->ssl);
-
-   if (!x->tlsext_tick || x->tlsext_ticklen > bufLen) {
-   return 0;
-   }
-   (*e)->SetByteArrayRegion(e, buf, 0, x->tlsext_ticklen, (jbyte *) 
&x->tlsext_tick[0]);
+tcn_socket_t *s = J2P(tcsock, tcn_socket_t *);
+tcn_ssl_conn_t *tcssl = (tcn_ssl_conn_t *)s->opaque;
+int bufLen = (*e)->GetArrayLength(e, buf);
+
+SSL_SESSION *x = SSL_get_session(tcssl->ssl);
+
+if (!x->tlsext_tick || x->tlsext_ticklen > bufLen) {
+return 0;
+}
+(*e)->SetByteArrayRegion(e, buf, 0, x->tlsext_ticklen, (jbyte *) 
&x->tlsext_tick[0]);
 
-   return x->tlsext_ticklen;
+return x->tlsext_ticklen;
 }
 
 TCN_IMPLEMENT_CALL(jint, SSLExt, setTicket)(TCN_STDARGS, jlong tcsock, 
jbyteArray buf,
-   jint len)
+jint len)
 {
-   tcn_socket_t *s = J2P(tcsock, tcn_socket_t *);
-   tcn_ssl_conn_t *tcssl = (tcn_ssl_conn_t *)s->opaque;
+tcn_socket_t *s = J2P(tcsock, tcn_socket_t *);
+tcn_ssl_conn_t *tcssl = (tcn_ssl_conn_t *)s->opaque;
 
-   char * requestedTicket = apr_pcalloc(tcssl->pool, len);
-   (*e)->GetByteArrayRegion(e, buf, 0, len, (jbyte *) requestedTicket);
-   SSL_set_session_ticket_ext(tcssl->ssl, requestedTicket, len);
-   return 0;
+jbyte * requestedTicket = apr_pcalloc(tcssl->pool, len);
+(*e)->GetByteArrayRegion(e, buf, 0, len, (jbyte *) requestedTicket);
+SSL_set_session_ticket_ext(tcssl->ssl, requestedTicket, len);
+return 0;
 }
 
 TCN_IMPLEMENT_CALL(jint, SSLExt, setTicketKeys)(TCN_STDARGS, jlong tc_ssl_ctx, 
jbyteArray buf, jint len)
 {
-   tcn_ssl_ctxt_t *sslctx = J2P(tc_ssl_ctx, tcn_ssl_c

svn commit: r1292338 - /tomcat/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java

2012-02-22 Thread kkolinko
Author: kkolinko
Date: Wed Feb 22 15:10:06 2012
New Revision: 1292338

URL: http://svn.apache.org/viewvc?rev=1292338&view=rev
Log:
Explicitly ignore empty tokens in the value of 
VirtualWebappLoader#virtualClasspath

Modified:
tomcat/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java

Modified: tomcat/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java?rev=1292338&r1=1292337&r2=1292338&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java Wed 
Feb 22 15:10:06 2012
@@ -118,6 +118,10 @@ public class VirtualWebappLoader extends
 while (tkn.hasMoreTokens()) {
 String token = tkn.nextToken().trim();
 
+if (token.isEmpty()) {
+continue;
+}
+
 if (log.isDebugEnabled())
 log.debug(sm.getString("virtualWebappLoader.token", token));
 



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



[ANN] Apache Tomcat 7.0.26 released

2012-02-22 Thread Mark Thomas
The Apache Tomcat team announces the immediate availability of Apache
Tomcat 7.0.26

This release is primarily a bug fix release and includes numerous
bug fixes compared to version 7.0.25. The notable bug fixes include:
* Improved @HandlesTypes processing which no longer loads
  all classes on web application start.
* Ensure that POST bodies are available for reply after FORM
  authentication when using the AJP connectors
* Corrected a regression that broke annotation scanning for many use
  cases including web applications packaged as WARs and many embedded
  scenarios.

Please refer to the change log for the complete list of changes:
http://tomcat.apache.org/tomcat-7.0-doc/changelog.html

Note that this version has 4 zip binaries: a generic one and three
bundled with Tomcat native binaries for Windows operating systems
running on different CPU architectures.

Downloads:
http://tomcat.apache.org/download-70.cgi

Migration guides from Apache Tomcat 5.5.x and 6.0.x:
http://tomcat.apache.org/migration.html

Thank you,

-- The Apache Tomcat Team

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



svn commit: r1292342 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/loader/VirtualWebappLoader.java webapps/docs/changelog.xml webapps/docs/config/context.xml webapps/docs/config/loader.xml

2012-02-22 Thread kkolinko
Author: kkolinko
Date: Wed Feb 22 15:24:25 2012
New Revision: 1292342

URL: http://svn.apache.org/viewvc?rev=1292342&view=rev
Log:
Merged revisions r1292334 r1292338 from tomcat/trunk:
Explicitly ignore empty tokens in the value of 
VirtualWebappLoader#virtualClasspath
Document that VirtualWebappLoader#virtualClasspath trims spaces from the values.
Use this feature to make documentation examples more readable.

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

tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
tomcat/tc7.0.x/trunk/webapps/docs/config/context.xml
tomcat/tc7.0.x/trunk/webapps/docs/config/loader.xml

Propchange: tomcat/tc7.0.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 22 15:24:25 2012
@@ -1 +1 @@
-/tomcat/trunk:1156115,1156171,1156276,1156304,1156519,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1158426,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721,1160772,1160774,1160776,1161303,1161310,1161322,1161339,1161486,1161540,1161549,1161584,1162082,1162149,1162169,1162721,1162769,1162836,1162932,1163630,1164419,1164438,1164469,1164480,1164567,1165234,1165247-1165248,1165253,1165273,1165282,1165309,1165331,1165338,1165347,1165360-1165361,1165367-1165368,1165602,1165608,1165677,1165693,1165721,1165723,1165728,1165730,1165738,1165746,1165765,1165777,1165918,1165921,1166077,1166150-1166151,1166290,1166366,1166620,1166686,1166693,1166752,1166757,1167368,1167394,1169447,1170647,1171692,1172233-1172234,1172236,1172269,1172278,1172282,1172556,1172610,1172664,1172689,1172711,1173020-1173021,1173082,1173088,1173090,1173096
 
,1173241,1173256,1173288,117,1173342,1173461,1173614,1173630,1173659,1173722,1174061,1174239,1174322,1174325,1174329-1174330,1174337-1174339,1174343,1174353,1174799,1174882,1174884,1174975,1174983,1175155,1175158,1175167,1175182,1175190,1175201,1175272,1175275,1175283,1175582,1175589-1175590,1175594,1175602,1175613,1175633,1175690,1175713,1175798,1175889,1175896,1175907,1176584,1176590,1176799,1177050,1177060,1177125,1177152,1177160,1177245,1177850,1177862,1177978,1178209,1178228,1178233,1178449,1178542,1178681,1178684,1178721,1179268,1179274,1180261,1180865,1180891,1180894,1180907,1181028,1181123,1181125,1181136,1181291,1181743,1182796,1183078,1183105,1183142,1183328,1183339-1183340,1183492-1183494,1183605,1184917,1184919,1185018,1185020,1185200,1185588,1185626,1185756,1185758,1186011,1186042-1186045,1186104,1186123,1186137,1186153,1186254,1186257,1186377-1186379,1186479-1186480,1186712,1186743,1186750,1186763,1186890-1186892,1186894,1186949,1187018,1187027-1187028,1187
 
381,1187753,1187755,1187775,1187801,1187806,1187809,1187827,1188301,1188303-1188305,1188399,1188822,1188930-1188931,1189116,1189129,1189183,1189240,1189256,1189386,1189413-1189414,1189477,1189685,1189805,1189857,1189864,1189882,1190034,1190185,1190279,1190339,1190371,1190388-1190389,1190474,1190481,1194915,1195222-1195223,1195531,1195899,1195905,1195943,1195949,1195953,1195955,1195965,1195968,1196175,1196212,1196223,1196304-1196305,1196735,1196825,1196827,1197158,1197261,1197263,1197299-1197300,1197305,1197339-1197340,1197343,1197382,1197386-1197387,1197480,1197578,1198497,1198528,1198552,1198602,1198604,1198607,1198622,1198640,1198696,1198707,1199418,1199432,1199436,1199513,1199529,1199980,116,1200056,1200089,1200106-1200107,1200263,1200316,1200320,1200398-1200399,1200445-1200446,1200555,1200627,1200696,1200725,1200937,1200941,1201069,1201087,1201180,1201235-1201237,1201508,1201521,1201542,1201545-1201546,1201548,1201555-1201556,1201568,1201576,1201608,1201921-1201922,1
 
201931,1202035,1202039,1202271,1202565,1202578,1202705,1202828,1202860,1203047-1203052,1203078,1203091,1203253,1203278,1204182,1204856,1204867,1204936,1204938,1204982,1205033,1205065,1205082,1205097,1205112,1206200,1207692,1208046,1208073,1208096,1208114,1208145,1208772,1209194,1209277-1209278,1209686-1209731,1210894,1212091,1212095,1212099,1212118,1213469,1213906,1214853,1214855,1214864,1215115,1215118-1215119,1215121,1220293,1220295,1221038,1221842,1222189,101,176,1222300,1222690,1222850,1222852,1222855,1224607,1224617,1224648-1224652,1224657,1224662-1224663,1224682,1224801,1224910,1225000,1225219,1225343,1225465,1225627,1225629,1225634,1226069,1226158-1226159,1226177,1226196,1226214-1226215,1226385,1226394,1226500,1226537-1226538,1226546,1226551,1226975,1228196,1228360,1228376,1228724,1228908,1228918,1228920,1228922,1228929,1228969,1229307,1229536,1229549,1229724,1229726-1229731,1229997,1230539,1230711,1230729,1230762-1230763,1230765,1230955,1230957,1231285,123129
 
0,1231308,1231310,1231337,1231460-1231461,1231542-1231543,1231546-1231547,1231620-1231621,1231624-1231625,1231630,1

svn commit: r1292345 - /tomcat/trunk/webapps/docs/config/context.xml

2012-02-22 Thread kkolinko
Author: kkolinko
Date: Wed Feb 22 15:32:03 2012
New Revision: 1292345

URL: http://svn.apache.org/viewvc?rev=1292345&view=rev
Log:
Fix nesting of  and  elements.
Wrap long line.

Modified:
tomcat/trunk/webapps/docs/config/context.xml

Modified: tomcat/trunk/webapps/docs/config/context.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/context.xml?rev=1292345&r1=1292344&r2=1292345&view=diff
==
--- tomcat/trunk/webapps/docs/config/context.xml (original)
+++ tomcat/trunk/webapps/docs/config/context.xml Wed Feb 22 15:32:03 2012
@@ -72,6 +72,7 @@
   You may deploy multiple versions of a web application with the same
   context path at the same time. The rules used to match requests to a
   context version are as follows:
+  
   
   If no session information is present in the request, use the latest
   version.
@@ -81,7 +82,6 @@
   If session information is present in the request but no matching session
   can be found, use the latest version.
   
-  
   
 
   
@@ -128,12 +128,13 @@
   If you want to deploy a WAR file or a directory using a context path that
   is not related to the base file name then one of the following options must
   be used to prevent double-deployment:
+  
   
   Disable autoDeploy and deployOnStartup and define all
   Contexts in server.xml
   Locate the WAR and/or directory outside of the Host's appBase and 
use
   a context.xml file with a docBase attribute to define it.
-  
+  
   
 
   
@@ -144,6 +145,7 @@
   Tomcat.
 
   Individual Context elements may be explicitly defined:
+  
   
   In an individual file at /META-INF/context.xml inside the
   application files. Optionally (based on the Host's copyXML attribute)
@@ -159,7 +161,6 @@
   Inside a Host element in the main
   conf/server.xml.
   
-  
 
   Default Context elements may be defined that apply to
   multiple web applications. Configuration for an individual web application
@@ -168,6 +169,7 @@
   Context will be created once for each
   Context to which the default applies. They will not 
be
   shared between Context elements.
+  
   
   In the $CATALINA_BASE/conf/context.xml file:
   the Context element information will be loaded by all webapps.
@@ -176,7 +178,6 @@
   file: the Context element information will be loaded by all webapps of that
   host.
   
-  
 
   With the exception of server.xml, files that define Context
elements may only define a single Context element.
@@ -415,6 +416,7 @@
 Set to false if Tomcat should not read any additional request
 body data for aborted uploads and instead abort the client connection.
 This setting is used in the following situations:
+
 
 the size of the request body is larger than the
 maxPostSize configured in the connector
@@ -422,6 +424,7 @@
 the servlet sets the response status to 413 (Request Entity Too
 Large) 
 
+
 Not reading the additional data will free the request processing thread
 more quickly. Unfortunately most HTTP clients will not read the 
response
 if they can not write the full request.
@@ -1227,8 +1230,10 @@
   ...
 
 
-When a request for getConnection() is made in the 
/foo context, the request is translated into
-   getConnection("foo","foopass"), while 
a request in the /bar gets passed straight through.
+When a request for getConnection() is made in the
+   /foo context, the request is translated into
+   getConnection("foo","foopass"),
+   while a request in the /bar gets passed straight 
through.
   
 
   



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



svn commit: r1292347 - /tomcat/trunk/webapps/docs/config/context.xml

2012-02-22 Thread kkolinko
Author: kkolinko
Date: Wed Feb 22 15:35:46 2012
New Revision: 1292347

URL: http://svn.apache.org/viewvc?rev=1292347&view=rev
Log:
Split long lines

Modified:
tomcat/trunk/webapps/docs/config/context.xml

Modified: tomcat/trunk/webapps/docs/config/context.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/context.xml?rev=1292347&r1=1292346&r2=1292347&view=diff
==
--- tomcat/trunk/webapps/docs/config/context.xml (original)
+++ tomcat/trunk/webapps/docs/config/context.xml Wed Feb 22 15:35:46 2012
@@ -1288,7 +1288,8 @@ mywebapp/
 
 
   
+extraResourcePaths=
+  "/WEB-INF/classes=/Users/theuser/mywebapp/target/classes" />
   
@@ -1326,7 +1327,8 @@ mywebapp/
 
 
   
+extraResourcePaths=
+
"/WEB-INF/classes=/Users/theuser/mywebapp/target/classes,/pictures=/Users/theuser/mypictures,/movies=/Users/theuser/mymovies"
 />
   svn commit: r1292349 - in /tomcat/tc7.0.x/trunk: ./ webapps/docs/config/context.xml

Author: kkolinko
Date: Wed Feb 22 15:37:47 2012
New Revision: 1292349

URL: http://svn.apache.org/viewvc?rev=1292349&view=rev
Log:
Merged revisions 1292345-1292347 from tomcat/trunk:
Fix nesting of  and  elements.
Wrap long lines.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/webapps/docs/config/context.xml

Propchange: tomcat/tc7.0.x/trunk/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 22 15:37:47 2012
@@ -1 +1 @@
-/tomcat/trunk:1156115,1156171,1156276,1156304,1156519,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1158426,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721,1160772,1160774,1160776,1161303,1161310,1161322,1161339,1161486,1161540,1161549,1161584,1162082,1162149,1162169,1162721,1162769,1162836,1162932,1163630,1164419,1164438,1164469,1164480,1164567,1165234,1165247-1165248,1165253,1165273,1165282,1165309,1165331,1165338,1165347,1165360-1165361,1165367-1165368,1165602,1165608,1165677,1165693,1165721,1165723,1165728,1165730,1165738,1165746,1165765,1165777,1165918,1165921,1166077,1166150-1166151,1166290,1166366,1166620,1166686,1166693,1166752,1166757,1167368,1167394,1169447,1170647,1171692,1172233-1172234,1172236,1172269,1172278,1172282,1172556,1172610,1172664,1172689,1172711,1173020-1173021,1173082,1173088,1173090,1173096
 
,1173241,1173256,1173288,117,1173342,1173461,1173614,1173630,1173659,1173722,1174061,1174239,1174322,1174325,1174329-1174330,1174337-1174339,1174343,1174353,1174799,1174882,1174884,1174975,1174983,1175155,1175158,1175167,1175182,1175190,1175201,1175272,1175275,1175283,1175582,1175589-1175590,1175594,1175602,1175613,1175633,1175690,1175713,1175798,1175889,1175896,1175907,1176584,1176590,1176799,1177050,1177060,1177125,1177152,1177160,1177245,1177850,1177862,1177978,1178209,1178228,1178233,1178449,1178542,1178681,1178684,1178721,1179268,1179274,1180261,1180865,1180891,1180894,1180907,1181028,1181123,1181125,1181136,1181291,1181743,1182796,1183078,1183105,1183142,1183328,1183339-1183340,1183492-1183494,1183605,1184917,1184919,1185018,1185020,1185200,1185588,1185626,1185756,1185758,1186011,1186042-1186045,1186104,1186123,1186137,1186153,1186254,1186257,1186377-1186379,1186479-1186480,1186712,1186743,1186750,1186763,1186890-1186892,1186894,1186949,1187018,1187027-1187028,1187
 
381,1187753,1187755,1187775,1187801,1187806,1187809,1187827,1188301,1188303-1188305,1188399,1188822,1188930-1188931,1189116,1189129,1189183,1189240,1189256,1189386,1189413-1189414,1189477,1189685,1189805,1189857,1189864,1189882,1190034,1190185,1190279,1190339,1190371,1190388-1190389,1190474,1190481,1194915,1195222-1195223,1195531,1195899,1195905,1195943,1195949,1195953,1195955,1195965,1195968,1196175,1196212,1196223,1196304-1196305,1196735,1196825,1196827,1197158,1197261,1197263,1197299-1197300,1197305,1197339-1197340,1197343,1197382,1197386-1197387,1197480,1197578,1198497,1198528,1198552,1198602,1198604,1198607,1198622,1198640,1198696,1198707,1199418,1199432,1199436,1199513,1199529,1199980,116,1200056,1200089,1200106-1200107,1200263,1200316,1200320,1200398-1200399,1200445-1200446,1200555,1200627,1200696,1200725,1200937,1200941,1201069,1201087,1201180,1201235-1201237,1201508,1201521,1201542,1201545-1201546,1201548,1201555-1201556,1201568,1201576,1201608,1201921-1201922,1
 
201931,1202035,1202039,1202271,1202565,1202578,1202705,1202828,1202860,1203047-1203052,1203078,1203091,1203253,1203278,1204182,1204856,1204867,1204936,1204938,1204982,1205033,1205065,1205082,1205097,1205112,1206200,1207692,1208046,1208073,1208096,1208114,1208145,1208772,1209194,1209277-1209278,1209686-1209731,1210894,1212091,1212095,1212099,1212118,1213469,1213906,1214853,1214855,1214864,1215115,1215118-1215119,1215121,1220293,1220295,1221038,1221842,1222189,101,176,1222300,1222690,1222850,1222852,1222855,1224607,1224617,1224648-1224652,1224657,1224662-1224663,1224682,1224801,1224910,1225000,1225219,1225343,1225465,1225627,1225629,1225634,1226069,1226158-1226159,1226177,1226196,1226214-1226215,1226385,1226394,1226500,1226537-1226538,1226546,1226551,1226975,1228196,1228360,1228376,1228724,1228908,1228918,1228920,1228922,1228929,1228969,1229307,1229536,1229549,1229724,1229726-1229731,1229997,1230539,1230711,1230729,1230762-1230763,1230765,1230955,1230957,1231285,123129
 
0,1231308,1231310,1231337,1231460-1231461,1231542-1231543,1231546-1231547,1231620-1231621,1231624-1231625,1231630,1231654-1231655,1231738,1231740,1231762-1231763,1231856,1231886,1231923,1231947,1232345,1232368,1232380,1232447,1232760,1232813,1232842-1232843,1232869,1233413,1233423,1233426,1234143,1234567,1235207,1236906-1236907,1236914,1237146,1237154-1237156,1237332,1237334,1237425,1237427,1237604,1237975,1237981,1237985,1238070,1238073,1239024,1239048,1239050,1239060,1239135,1239483

Re: Release Tomcat Native 1.1.23


On 02/22/2012 03:54 PM, Costin Manolache wrote:

On Tue, Feb 21, 2012 at 11:11 PM, Mladen Turk  wrote:



Well I personally would not merge that into 1.1.x branch.
It would be a bit weird to have 1.1.22 as is, and 1.1.23 with
whole bunch of new features and API's.
That's not why we introduced branches at the first place.



That's right, I agree.



OK, so 1.1.x stays as is.




I see no problem with that.
It requires apr-1.4.x so this might be a solution for
that sslext code instead porting that back to 1.1.x



sslext works best with openssl 1.0.1 beta 2 ( i.e. latest ) - to get npn
working with older ssl it needs a patch ( nodejs, chrome do this ).
But it compiles and just lacks the npn feature without the patch.

So for me a 1.2.x with recent apr and openssl would be best.



Cool, lets then cleanup the code in trunk and go for 1.2.x
release after we cut 1.1.23. OK?
1.1.x would be in feature freeze state after we release 1.2.x.

I'd like we make 1.2.x mandatory for tomcat8 together with removing
all the code that checks for missing API.

And finally after APR-2.0 gets released we can create 1.2.x branch
and make trunk as 2.0.x since with APR-2 abi will change.


Regards
--
^TM

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



Re: Release Tomcat Native 1.1.23

On Wed, Feb 22, 2012 at 8:13 AM, Mladen Turk  wrote:

> On 02/22/2012 03:54 PM, Costin Manolache wrote:
>
>> On Tue, Feb 21, 2012 at 11:11 PM, Mladen Turk  wrote:
>>
>>>
  Well I personally would not merge that into 1.1.x branch.
>>> It would be a bit weird to have 1.1.22 as is, and 1.1.23 with
>>> whole bunch of new features and API's.
>>> That's not why we introduced branches at the first place.
>>>
>>>
>>>  That's right, I agree.
>>
>>
> OK, so 1.1.x stays as is.
>
>
>
>>  I see no problem with that.
>>> It requires apr-1.4.x so this might be a solution for
>>> that sslext code instead porting that back to 1.1.x
>>>
>>>
>> sslext works best with openssl 1.0.1 beta 2 ( i.e. latest ) - to get npn
>> working with older ssl it needs a patch ( nodejs, chrome do this ).
>> But it compiles and just lacks the npn feature without the patch.
>>
>> So for me a 1.2.x with recent apr and openssl would be best.
>>
>>
> Cool, lets then cleanup the code in trunk and go for 1.2.x
> release after we cut 1.1.23. OK?
> 1.1.x would be in feature freeze state after we release 1.2.x.
>
> I'd like we make 1.2.x mandatory for tomcat8 together with removing
> all the code that checks for missing API.
>
> And finally after APR-2.0 gets released we can create 1.2.x branch
> and make trunk as 2.0.x since with APR-2 abi will change.
>
>
+1

One thing I would appreciate help with: I would like to have an option to
statically link
openssl and apr into the tc-native .so - I mean use openssl.a, apr.a.

The reason is to avoid the system libraries which will probably have the
wrong version.

Right now there is the 'cmake' file in trunk that does this for linux64 -
I'm sure it's not the
right way :-), but couldn't figure how to do it with libtool.

openssl/apr needs to be compiled with 'shared' option - otherwise they
won't have pic/etc -
and libtool seems to pick the .so over .a with all flags I tried ( it did
work if I manually removed the .so).

( or if cmake or any of the other build tools is acceptable - will need to
be made portable. I guess gyp would be easiest since there is already an
openssl build file, but not for apr ).


Costin


>
> Regards
> --
> ^TM
>
> --**--**-
> To unsubscribe, e-mail: 
> dev-unsubscribe@tomcat.apache.**org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


Re: SPDY support

First part submitted. For the second: what is the process for adding a
dependency ?

jzlib is BSD - I added it to 'download' and build.properties.
I can make it optional (i.e. skip building the code that depend on it if
jzlib is missing ), but it doesn't seem to be worth it.
Do automatic builders run 'ant download' ?

Any concerns with it ?

Costin

On Thu, Feb 16, 2012 at 2:11 PM, Mark Thomas  wrote:

> On 16/02/2012 01:44, Costin Manolache wrote:
> > That doesn't mean the application must receive the entire message as one
> > byte[]
> > or as a Stream.
> > You can have a very large fragment but still read it in smaller buffers
> and
> > notify
> > the user of message start and for each fragment ( I guess like xml
> parsing
> > ).
>
> I see where you are coming from now. A purely message based API would be
> possible in that case. The downside is increased complexity in the
> applications as they would have to maintain additional state across
> messages. I'm not completely against the approach, just not yet
> convinced that the trade is worth it. I'd prefer to have some hard
> evidence to work with but that is unlikely to be forthcoming until folks
> start using this API. With that in mind, I'm going to focus on the
> various contributions folks have made and move the implementation closer
> to something that is usable.
>
> Mark
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


Re: SPDY support

On 22/02/2012 16:51, Costin Manolache wrote:
> First part submitted. For the second: what is the process for adding a
> dependency ?

Why do you need the dependency?

> jzlib is BSD - I added it to 'download' and build.properties.

LICENSE and NOTICE need updating as well (multiple locations). So will
the pom files.

> I can make it optional (i.e. skip building the code that depend on it if
> jzlib is missing ), but it doesn't seem to be worth it.
> Do automatic builders run 'ant download' ?

They handle dependencies. Some additional configuration may be required.

> Any concerns with it ?

Depends on why it is required.

Mark


> 
> Costin
> 
> On Thu, Feb 16, 2012 at 2:11 PM, Mark Thomas  wrote:
> 
>> On 16/02/2012 01:44, Costin Manolache wrote:
>>> That doesn't mean the application must receive the entire message as one
>>> byte[]
>>> or as a Stream.
>>> You can have a very large fragment but still read it in smaller buffers
>> and
>>> notify
>>> the user of message start and for each fragment ( I guess like xml
>> parsing
>>> ).
>>
>> I see where you are coming from now. A purely message based API would be
>> possible in that case. The downside is increased complexity in the
>> applications as they would have to maintain additional state across
>> messages. I'm not completely against the approach, just not yet
>> convinced that the trade is worth it. I'd prefer to have some hard
>> evidence to work with but that is unlikely to be forthcoming until folks
>> start using this API. With that in mind, I'm going to focus on the
>> various contributions folks have made and move the implementation closer
>> to something that is usable.
>>
>> Mark
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: dev-h...@tomcat.apache.org
>>
>>
> 


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



Re: SPDY support

On Wed, Feb 22, 2012 at 8:57 AM, Mark Thomas  wrote:

> On 22/02/2012 16:51, Costin Manolache wrote:
> > First part submitted. For the second: what is the process for adding a
> > dependency ?
>
> Why do you need the dependency?
>

Spdy requires header compression - with a pre-defined dictionary (
containing header names and common values ). It also requires 'flush' - a
single compression context is used for all headers in the stream. AFAIK
this is not possible with the jdk compress library.

That's one of the ways spdy gets its speed - it is not optional in
chrome/firefox.

Costin


>
> > jzlib is BSD - I added it to 'download' and build.properties.
>
> LICENSE and NOTICE need updating as well (multiple locations). So will
> the pom files.
>
> > I can make it optional (i.e. skip building the code that depend on it if
> > jzlib is missing ), but it doesn't seem to be worth it.
> > Do automatic builders run 'ant download' ?
>
> They handle dependencies. Some additional configuration may be required.
>
> > Any concerns with it ?
>
> Depends on why it is required.
>
> Mark
>
>
> >
> > Costin
> >
> > On Thu, Feb 16, 2012 at 2:11 PM, Mark Thomas  wrote:
> >
> >> On 16/02/2012 01:44, Costin Manolache wrote:
> >>> That doesn't mean the application must receive the entire message as
> one
> >>> byte[]
> >>> or as a Stream.
> >>> You can have a very large fragment but still read it in smaller buffers
> >> and
> >>> notify
> >>> the user of message start and for each fragment ( I guess like xml
> >> parsing
> >>> ).
> >>
> >> I see where you are coming from now. A purely message based API would be
> >> possible in that case. The downside is increased complexity in the
> >> applications as they would have to maintain additional state across
> >> messages. I'm not completely against the approach, just not yet
> >> convinced that the trade is worth it. I'd prefer to have some hard
> >> evidence to work with but that is unlikely to be forthcoming until folks
> >> start using this API. With that in mind, I'm going to focus on the
> >> various contributions folks have made and move the implementation closer
> >> to something that is usable.
> >>
> >> Mark
> >>
> >> -
> >> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> >> For additional commands, e-mail: dev-h...@tomcat.apache.org
> >>
> >>
> >
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


Re: Release Tomcat Native 1.1.23


On 02/22/2012 05:47 PM, Costin Manolache wrote:

On Wed, Feb 22, 2012 at 8:13 AM, Mladen Turk  wrote:

One thing I would appreciate help with: I would like to have an option to
statically link
openssl and apr into the tc-native .so - I mean use openssl.a, apr.a.



You mean for unixes?
The solution would be to create stub libssl.so and libcrypto.so
so that libtcnative don't carry their SONAME and link to system so.x...

Static linkage is not a good idea I'm afraid.


The reason is to avoid the system libraries which will probably have the
wrong version.



Right. Having stubs, libtcnative will always link to libssl.so which
is usually symlink on any system.
At runtime we can check for SSL_version and fail in case it has wrong ABI.

However, not sure why you wish to do that. Many distros already provide
tomcat-native so there's no real point for doing that, especially since
we should not distribute unix binaries.


Regards.
--
^TM

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



Re: Release Tomcat Native 1.1.23

On Wed, Feb 22, 2012 at 9:12 AM, Mladen Turk  wrote:

> On 02/22/2012 05:47 PM, Costin Manolache wrote:
>
>> On Wed, Feb 22, 2012 at 8:13 AM, Mladen Turk  wrote:
>>
>> One thing I would appreciate help with: I would like to have an option to
>> statically link
>> openssl and apr into the tc-native .so - I mean use openssl.a, apr.a.
>>
>>
> You mean for unixes?
> The solution would be to create stub libssl.so and libcrypto.so
> so that libtcnative don't carry their SONAME and link to system so.x...
>
> Static linkage is not a good idea I'm afraid.
>
>
>  The reason is to avoid the system libraries which will probably have the
>> wrong version.
>>
>>
> Right. Having stubs, libtcnative will always link to libssl.so which
> is usually symlink on any system.
> At runtime we can check for SSL_version and fail in case it has wrong ABI.
>
> However, not sure why you wish to do that. Many distros already provide
> tomcat-native so there's no real point for doing that, especially since
> we should not distribute unix binaries.
>

Yes, distros provide tomcat-native, apr and openssl - with the 'stable'
releases.

I'm trying to provide a way for people to build "libtcnative-2.so" so it
can be installed on
those systems along with the existing apr, openssl and libtcnative-1,
without requiring the installation of 2 versions of openssl, apr.

It seems to work for me on linux ( using cmake ) - I get a tcnative.so with
all the openssl/apr
code linked in, without dependencies to libapr.so ( no SONAME ).

So basically someone ( distros, users ) could build and deploy the new
library along with the stable ones. I don't think we can require to upgrade
the platform openssl or apr. The alternative would be to have the new
openssl/apr .so in some /usr/local/ location.

Costin


>
>
> Regards.
>
> --
> ^TM
>
> --**--**-
> To unsubscribe, e-mail: 
> dev-unsubscribe@tomcat.apache.**org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


Re: SPDY support

2012/2/22 Costin Manolache :
> On Wed, Feb 22, 2012 at 8:57 AM, Mark Thomas  wrote:
>
>> On 22/02/2012 16:51, Costin Manolache wrote:
>> > First part submitted. For the second: what is the process for adding a
>> > dependency ?
>>
>> Why do you need the dependency?
>>
>
> Spdy requires header compression - with a pre-defined dictionary (
> containing header names and common values ). It also requires 'flush' - a
> single compression context is used for all headers in the stream. AFAIK
> this is not possible with the jdk compress library.
>
> That's one of the ways spdy gets its speed - it is not optional in
> chrome/firefox.
>

1. AJP/1.3 protocol has dictionary for header names.
2. In Deflater class explicit flush operation was added in Java 1.7.

That is without knowing specifics of SPDY protocol. I'll like to hear
more details.

Best regards,
Konstantin Kolinko

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



Re: SPDY support

On Wed, Feb 22, 2012 at 10:27 AM, Konstantin Kolinko  wrote:

> 2012/2/22 Costin Manolache :
> > On Wed, Feb 22, 2012 at 8:57 AM, Mark Thomas  wrote:
> >
> >> On 22/02/2012 16:51, Costin Manolache wrote:
> >> > First part submitted. For the second: what is the process for adding a
> >> > dependency ?
> >>
> >> Why do you need the dependency?
> >>
> >
> > Spdy requires header compression - with a pre-defined dictionary (
> > containing header names and common values ). It also requires 'flush' - a
> > single compression context is used for all headers in the stream. AFAIK
> > this is not possible with the jdk compress library.
> >
> > That's one of the ways spdy gets its speed - it is not optional in
> > chrome/firefox.
> >
>
> 1. AJP/1.3 protocol has dictionary for header names.
> 2. In Deflater class explicit flush operation was added in Java 1.7.
>

I think requiring Java1.7 is too much. Most prod servers are on 1.6.

Would making it an 'optional' dependency work ( i.e. skip compiling the
required
classes / use class for name ) ? I can add an option to use 1.7 Deflater if
available.

Costin




> That is without knowing specifics of SPDY protocol. I'll like to hear
> more details.
>
> Best regards,
> Konstantin Kolinko
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


Re: SPDY support

On 22/02/2012 18:41, Costin Manolache wrote:
> On Wed, Feb 22, 2012 at 10:27 AM, Konstantin Kolinko > wrote:
> 
>> 2012/2/22 Costin Manolache :
>>> On Wed, Feb 22, 2012 at 8:57 AM, Mark Thomas  wrote:
>>>
 On 22/02/2012 16:51, Costin Manolache wrote:
> First part submitted. For the second: what is the process for adding a
> dependency ?

 Why do you need the dependency?

>>>
>>> Spdy requires header compression - with a pre-defined dictionary (
>>> containing header names and common values ). It also requires 'flush' - a
>>> single compression context is used for all headers in the stream. AFAIK
>>> this is not possible with the jdk compress library.
>>>
>>> That's one of the ways spdy gets its speed - it is not optional in
>>> chrome/firefox.
>>>
>>
>> 1. AJP/1.3 protocol has dictionary for header names.
>> 2. In Deflater class explicit flush operation was added in Java 1.7.
>>
> 
> I think requiring Java1.7 is too much. Most prod servers are on 1.6.
> 
> Would making it an 'optional' dependency work ( i.e. skip compiling the
> required
> classes / use class for name ) ? I can add an option to use 1.7 Deflater if
> available.

If we are talking about Tomcat 8 then that is very likely to require
Java 1.7 anyway. 1.6 is close to EOL.

Are you considering back-porting this to 7.0.x?

There is also a workaround already in 7.0.x for flushing compressed streams.

Mark

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



Tomcat with mod_jk becomes irresponsive after working for awhile

All,

I have a deployment on Windows 2003 Server using Apache 2.2.16, Tomcat 5.5.30 
and mod_jk 1.2.31.  Apache and Tomcat reside on the same machine.  The 
communication is fine for days / weeks, but at some point all requests to the 
server (to Apache) that use mod_jk return HTTP 503.

The error that shows up in mod_jk.log is:
[Mon Feb 20 12:07:01.464 2012] [7280:6912] [error] 
ajp_send_request::jk_ajp_common.c (1610): (all) failed sending request on a 
fresh connection (recoverable), socket -1 (errno=54)
[Mon Feb 20 12:07:01.464 2012] [7280:6912] [error] ajp_service::jk_ajp_common.c 
(2562): (all) connecting to tomcat failed.

I've done a packet capture and I see that Apache initiates the 3-way handshake 
with Tomcat which looks fine and immediately after the connection is 
established, Tomcat sends a FIN packet to Apache whereby both sides gracefully 
close the connection.

Have any of you encountered this before?

Do you have any idea what debug logs I can turn on to get further information 
without bringing down the server so that we don't loose this situation?


Many thanks,
Ofer


Re: Release Tomcat Native 1.1.23


On 02/22/2012 07:22 PM, Costin Manolache wrote:

On Wed, Feb 22, 2012 at 9:12 AM, Mladen Turk  wrote:


However, not sure why you wish to do that. Many distros already provide
tomcat-native so there's no real point for doing that, especially since
we should not distribute unix binaries.



Yes, distros provide tomcat-native, apr and openssl - with the 'stable'
releases.

I'm trying to provide a way for people to build "libtcnative-2.so" so it
can be installed on
those systems along with the existing apr, openssl and libtcnative-1,
without requiring the installation of 2 versions of openssl, apr.



Right if its --with-apr-static --with-openssl-static it could be
a valid solution for someone that needs such specific deployments.


It seems to work for me on linux ( using cmake ) - I get a tcnative.so with
all the openssl/apr
code linked in, without dependencies to libapr.so ( no SONAME ).



No need for cmake. This can be done with gnu tools.
I'll enable that when I catch some time.


Regards
--
^TM

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



svn commit: r1292453 - in /tomcat/trunk/java/org/apache/catalina/websocket: StreamInbound.java WsInputStream.java

Author: markt
Date: Wed Feb 22 19:19:07 2012
New Revision: 1292453

URL: http://svn.apache.org/viewvc?rev=1292453&view=rev
Log:
Review of r1291507
Fix one issue and add some comments to clarify why some odd looking
things are indeed safe.

Modified:
tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java

Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1292453&r1=1292452&r2=1292453&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Wed Feb 
22 19:19:07 2012
@@ -98,17 +98,27 @@ public abstract class StreamInbound impl
 
 private void doClose(InputStream is) throws IOException {
 // Control messages have a max size of 125 bytes. Need to try and read
-// one more so we reach end of stream (less 2 for the status)
+// one more so we reach end of stream (less 2 for the status). Note 
that
+// the 125 byte limit is enforced in #onData() before this method is
+// ever called.
 ByteBuffer data = ByteBuffer.allocate(124);
 
 int status = is.read();
 if (status != -1) {
 status = status << 8;
-status = status + is.read();
-int read = 0;
-while (read > -1) {
-data.position(data.position() + read);
-read = is.read(data.array(), data.position(), 
data.remaining());
+int i = is.read();
+if (i == -1) {
+// EOF during middle of close message. Closing anyway but set
+// close code to protocol error
+status = 1002;
+} else {
+status = status + i;
+int read = 0;
+while (read > -1) {
+data.position(data.position() + read);
+read = is.read(data.array(), data.position(),
+data.remaining());
+}
 }
 } else {
 status = 0;
@@ -119,7 +129,8 @@ public abstract class StreamInbound impl
 
 private void doPing(InputStream is) throws IOException {
 // Control messages have a max size of 125 bytes. Need to try and read
-// one more so we reach end of stream
+// one more so we reach end of stream. Note that the 125 byte limit is
+// enforced in #onData() before this method is ever called.
 ByteBuffer data = ByteBuffer.allocate(126);
 
 int read = 0;
@@ -134,6 +145,9 @@ public abstract class StreamInbound impl
 
 private void doPong(InputStream is) throws IOException {
 // Unsolicited pong - swallow it
+// Control messages have a max size of 125 bytes. Note that the 125 
byte
+// limit is enforced in #onData() before this method is ever called so
+// the loop below is not unbounded.
 int read = 0;
 while (read > -1) {
 read = is.read();

Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java?rev=1292453&r1=1292452&r2=1292453&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java Wed Feb 
22 19:19:07 2012
@@ -21,6 +21,12 @@ import java.io.IOException;
 import org.apache.catalina.util.Conversions;
 import org.apache.coyote.http11.upgrade.UpgradeProcessor;
 
+/**
+ * This class is used to read WebSocket frames from the underlying socket and
+ * makes the payload available for reading as an {@link InputStream}. It only
+ * makes the number of bytes declared in the payload length available for
+ * reading even if more bytes are available from the socket.
+ */
 public class WsInputStream extends java.io.InputStream {
 
 private UpgradeProcessor processor;



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



svn commit: r1292454 - in /tomcat/trunk/java/org/apache/catalina/websocket: StreamInbound.java WsOutbound.java

Author: markt
Date: Wed Feb 22 19:19:48 2012
New Revision: 1292454

URL: http://svn.apache.org/viewvc?rev=1292454&view=rev
Log:
Further review of r1291507.
Pass WsInputStream instead of InputStream and use actual payload
lengths.

Modified:
tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java

Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1292454&r1=1292453&r2=1292454&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Wed Feb 
22 19:19:48 2012
@@ -96,12 +96,12 @@ public abstract class StreamInbound impl
 return SocketState.CLOSED;
 }
 
-private void doClose(InputStream is) throws IOException {
+private void doClose(WsInputStream is) throws IOException {
 // Control messages have a max size of 125 bytes. Need to try and read
 // one more so we reach end of stream (less 2 for the status). Note 
that
 // the 125 byte limit is enforced in #onData() before this method is
 // ever called.
-ByteBuffer data = ByteBuffer.allocate(124);
+ByteBuffer data = null;
 
 int status = is.read();
 if (status != -1) {
@@ -113,37 +113,45 @@ public abstract class StreamInbound impl
 status = 1002;
 } else {
 status = status + i;
-int read = 0;
-while (read > -1) {
-data.position(data.position() + read);
-read = is.read(data.array(), data.position(),
-data.remaining());
+if (is.getPayloadLength() > 2) {
+data = ByteBuffer.allocate((int) is.getPayloadLength() - 
1);
+int read = 0;
+while (read > -1) {
+data.position(data.position() + read);
+read = is.read(data.array(), data.position(),
+data.remaining());
+}
+data.flip();
 }
 }
 } else {
 status = 0;
 }
-data.flip();
 getOutbound().close(status, data);
 }
 
-private void doPing(InputStream is) throws IOException {
+private void doPing(WsInputStream is) throws IOException {
 // Control messages have a max size of 125 bytes. Need to try and read
 // one more so we reach end of stream. Note that the 125 byte limit is
 // enforced in #onData() before this method is ever called.
-ByteBuffer data = ByteBuffer.allocate(126);
+ByteBuffer data = null;
 
-int read = 0;
-while (read > -1) {
-data.position(data.position() + read);
-read = is.read(data.array(), data.position(), data.remaining());
+if (is.getPayloadLength() > 0) {
+data = ByteBuffer.allocate((int) is.getPayloadLength() + 1);
+
+int read = 0;
+while (read > -1) {
+data.position(data.position() + read);
+read = is.read(data.array(), data.position(), 
data.remaining());
+}
+
+data.flip();
 }
 
-data.flip();
 getOutbound().pong(data);
 }
 
-private void doPong(InputStream is) throws IOException {
+private void doPong(WsInputStream is) throws IOException {
 // Unsolicited pong - swallow it
 // Control messages have a max size of 125 bytes. Note that the 125 
byte
 // limit is enforced in #onData() before this method is ever called so

Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java?rev=1292454&r1=1292453&r2=1292454&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java (original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java Wed Feb 22 
19:19:48 2012
@@ -153,8 +153,12 @@ public class WsOutbound {
 doFlush(true);
 
 upgradeOutbound.write(0x8A);
-upgradeOutbound.write(data.limit());
-upgradeOutbound.write(data.array(), 0, data.limit());
+if (data == null) {
+upgradeOutbound.write(0);
+} else {
+upgradeOutbound.write(data.limit());
+upgradeOutbound.write(data.array(), 0, data.limit());
+}
 
 upgradeOutbound.flush();
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org

Re: Tomcat with mod_jk becomes irresponsive after working for awhile

On 22/02/2012 19:02, Ofer Israeli wrote:
> All,

This is the dev list, not the users list. This question does not belong
on this list. Further, I see you already posted to the users list.
Please do not cross post.

Mark

> 
> I have a deployment on Windows 2003 Server using Apache 2.2.16,
> Tomcat 5.5.30 and mod_jk 1.2.31.  Apache and Tomcat reside on the
> same machine.  The communication is fine for days / weeks, but at
> some point all requests to the server (to Apache) that use mod_jk
> return HTTP 503.
> 
> The error that shows up in mod_jk.log is: [Mon Feb 20 12:07:01.464
> 2012] [7280:6912] [error] ajp_send_request::jk_ajp_common.c (1610):
> (all) failed sending request on a fresh connection (recoverable),
> socket -1 (errno=54) [Mon Feb 20 12:07:01.464 2012] [7280:6912]
> [error] ajp_service::jk_ajp_common.c (2562): (all) connecting to
> tomcat failed.
> 
> I've done a packet capture and I see that Apache initiates the 3-way
> handshake with Tomcat which looks fine and immediately after the
> connection is established, Tomcat sends a FIN packet to Apache
> whereby both sides gracefully close the connection.
> 
> Have any of you encountered this before?
> 
> Do you have any idea what debug logs I can turn on to get further
> information without bringing down the server so that we don't loose
> this situation?
> 
> 
> Many thanks, Ofer
> 


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



svn commit: r1292456 - in /tomcat/trunk/java/org/apache: catalina/websocket/ coyote/http11/upgrade/

Author: markt
Date: Wed Feb 22 19:20:46 2012
New Revision: 1292456

URL: http://svn.apache.org/viewvc?rev=1292456&view=rev
Log:
Check for unexpected EOS. Close the connection if one is seen.

Modified:
tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeAprProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeBioProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/upgrade/UpgradeProcessor.java

Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1292456&r1=1292455&r2=1292456&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Wed Feb 
22 19:20:46 2012
@@ -51,49 +51,58 @@ public abstract class StreamInbound impl
 @Override
 public SocketState onData() throws IOException {
 // Must be start the start of a frame or series of frames
-WsInputStream wsIs = new WsInputStream(processor);
 
-WsFrameHeader header = wsIs.getFrameHeader();
+try {
+WsInputStream wsIs = new WsInputStream(processor);
 
-// TODO User defined extensions may define values for rsv
-if (header.getRsv() > 0) {
-getOutbound().close(1002, null);
-return SocketState.CLOSED;
-}
+WsFrameHeader header = wsIs.getFrameHeader();
+
+// TODO User defined extensions may define values for rsv
+if (header.getRsv() > 0) {
+getOutbound().close(1002, null);
+return SocketState.CLOSED;
+}
 
-byte opCode = header.getOpCode();
+byte opCode = header.getOpCode();
 
-if (opCode == Constants.OPCODE_BINARY) {
-onBinaryData(wsIs);
-return SocketState.UPGRADED;
-} else if (opCode == Constants.OPCODE_TEXT) {
-InputStreamReader r =
-new InputStreamReader(wsIs, B2CConverter.UTF_8);
-onTextData(r);
-return SocketState.UPGRADED;
-}
+if (opCode == Constants.OPCODE_BINARY) {
+onBinaryData(wsIs);
+return SocketState.UPGRADED;
+} else if (opCode == Constants.OPCODE_TEXT) {
+InputStreamReader r =
+new InputStreamReader(wsIs, B2CConverter.UTF_8);
+onTextData(r);
+return SocketState.UPGRADED;
+}
 
-// Must be a control frame and control frames:
-// - have a limited payload length
-// - must not be fragmented
-if (wsIs.getPayloadLength() > 125 || !wsIs.getFrameHeader().getFin()) {
+// Must be a control frame and control frames:
+// - have a limited payload length
+// - must not be fragmented
+if (wsIs.getPayloadLength() > 125 || 
!wsIs.getFrameHeader().getFin()) {
+getOutbound().close(1002, null);
+return SocketState.CLOSED;
+}
+
+if (opCode == Constants.OPCODE_CLOSE){
+doClose(wsIs);
+return SocketState.CLOSED;
+} else if (opCode == Constants.OPCODE_PING) {
+doPing(wsIs);
+return SocketState.UPGRADED;
+} else if (opCode == Constants.OPCODE_PONG) {
+doPong(wsIs);
+return SocketState.UPGRADED;
+}
+
+// Unknown OpCode
 getOutbound().close(1002, null);
 return SocketState.CLOSED;
-}
-
-if (opCode == Constants.OPCODE_CLOSE){
-doClose(wsIs);
+} catch (IOException ioe) {
+// Given something must have gone to reach this point, this might
+// not work but try it anyway.
+getOutbound().close(1002, null);
 return SocketState.CLOSED;
-} else if (opCode == Constants.OPCODE_PING) {
-doPing(wsIs);
-return SocketState.UPGRADED;
-} else if (opCode == Constants.OPCODE_PONG) {
-doPong(wsIs);
-return SocketState.UPGRADED;
 }
-
-getOutbound().close(1002, null);
-return SocketState.CLOSED;
 }
 
 private void doClose(WsInputStream is) throws IOException {

Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java?rev=1292456&r1=1292455&r2=1292456&view=diff
=

svn commit: r1292457 - in /tomcat/trunk: java/org/apache/catalina/websocket/MessageInbound.java java/org/apache/catalina/websocket/WsOutbound.java test/org/apache/catalina/websocket/TestWebSocket.java

Author: markt
Date: Wed Feb 22 19:21:43 2012
New Revision: 1292457

URL: http://svn.apache.org/viewvc?rev=1292457&view=rev
Log:
Reduce visibility

Modified:
tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java
tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java
tomcat/trunk/test/org/apache/catalina/websocket/TestWebSocket.java

Modified: tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java?rev=1292457&r1=1292456&r2=1292457&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java Wed Feb 
22 19:21:43 2012
@@ -28,8 +28,8 @@ public abstract class MessageInbound ext
 private int byteBufferMaxSize = 2097152;
 private int charBufferMaxSize = 2097152;
 
-ByteBuffer bb = ByteBuffer.allocate(8192);
-CharBuffer cb = CharBuffer.allocate(8192);
+private ByteBuffer bb = ByteBuffer.allocate(8192);
+private CharBuffer cb = CharBuffer.allocate(8192);
 
 @Override
 protected void onBinaryData(InputStream is) throws IOException {

Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java?rev=1292457&r1=1292456&r2=1292457&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java (original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java Wed Feb 22 
19:21:43 2012
@@ -31,8 +31,8 @@ public class WsOutbound {
 private ByteBuffer bb;
 private CharBuffer cb;
 private boolean closed = false;
-protected Boolean text = null;
-protected boolean firstFrame = true;
+private Boolean text = null;
+private boolean firstFrame = true;
 
 
 public WsOutbound(UpgradeOutbound upgradeOutbound) {

Modified: tomcat/trunk/test/org/apache/catalina/websocket/TestWebSocket.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/websocket/TestWebSocket.java?rev=1292457&r1=1292456&r2=1292457&view=diff
==
--- tomcat/trunk/test/org/apache/catalina/websocket/TestWebSocket.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/websocket/TestWebSocket.java Wed Feb 
22 19:21:43 2012
@@ -46,7 +46,7 @@ public class TestWebSocket extends Tomca
 
 private OutputStream os;
 private InputStream is;
-boolean isContinuation = false;
+private boolean isContinuation = false;
 
 @Test
 public void testSimple() throws Exception {



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



svn commit: r1292459 - in /tomcat/trunk/java/org/apache: coyote/http11/ coyote/spdy/ tomcat/spdy/ tomcat/util/net/

Author: markt
Date: Wed Feb 22 19:22:51 2012
New Revision: 1292459

URL: http://svn.apache.org/viewvc?rev=1292459&view=rev
Log:
Fix trailing whitespace and import order

Modified:
tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java
tomcat/trunk/java/org/apache/coyote/spdy/SpdyProxyProtocol.java
tomcat/trunk/java/org/apache/tomcat/spdy/SpdyConnection.java
tomcat/trunk/java/org/apache/tomcat/spdy/SpdyContext.java
tomcat/trunk/java/org/apache/tomcat/spdy/SpdyContextProxy.java
tomcat/trunk/java/org/apache/tomcat/spdy/SpdyStream.java
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=1292459&r1=1292458&r2=1292459&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java Wed Feb 
22 19:22:51 2012
@@ -26,10 +26,10 @@ import org.apache.coyote.http11.upgrade.
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.net.AbstractEndpoint;
-import org.apache.tomcat.util.net.AprEndpoint;
-import org.apache.tomcat.util.net.SocketStatus;
 import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
+import org.apache.tomcat.util.net.AprEndpoint;
 import org.apache.tomcat.util.net.AprEndpoint.Handler;
+import org.apache.tomcat.util.net.SocketStatus;
 import org.apache.tomcat.util.net.SocketWrapper;
 
 
@@ -45,8 +45,8 @@ public class Http11AprProtocol extends A
 
 private static final Log log = LogFactory.getLog(Http11AprProtocol.class);
 
-/** 
- * Interface specific for protocols that negotiate at NPN level, like 
+/**
+ * Interface specific for protocols that negotiate at NPN level, like
  * SPDY. This is only available for APR, will replace the HTTP framing.
  */
 public static interface NpnHandler {
@@ -193,7 +193,7 @@ public class Http11AprProtocol extends A
 getLog().warn("Failed to init light protocol " + impl, ex);
 }
 }
-
+
 // - JMX related 
methods
 
 @Override
@@ -201,7 +201,7 @@ public class Http11AprProtocol extends A
 return ("http-apr");
 }
 
-
+
 @Override
 public void start() throws Exception {
 super.start();
@@ -210,7 +210,7 @@ public class Http11AprProtocol extends A
 npnHandler.init(endpoint, sslCtx, adapter);
 }
 }
-
+
 //   Connection handler 
 
 protected static class Http11ConnectionHandler
@@ -257,7 +257,7 @@ public class Http11AprProtocol extends A
 socket.getSocket().longValue(), true);
 }
 }
-
+
 @Override
 public SocketState process(SocketWrapper socket,
 SocketStatus status) {
@@ -265,7 +265,7 @@ public class Http11AprProtocol extends A
 Processor processor = null;
 if (status == SocketStatus.OPEN) {
 processor = connections.get(socket.getSocket());
-   
+
 }
 if (processor == null) {
 // if not null - this is a former comet request, handled 
by http11

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=1292459&r1=1292458&r2=1292459&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java Wed Feb 22 
19:22:51 2012
@@ -31,8 +31,8 @@ import org.apache.coyote.Request;
 import org.apache.coyote.RequestInfo;
 import org.apache.coyote.Response;
 import org.apache.coyote.http11.upgrade.UpgradeInbound;
-import org.apache.tomcat.spdy.SpdyFrame;
 import org.apache.tomcat.spdy.SpdyConnection;
+import org.apache.tomcat.spdy.SpdyFrame;
 import org.apache.tomcat.spdy.SpdyStream;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.buf.Ascii;
@@ -49,9 +49,9 @@ import org.apache.tomcat.util.net.Socket
 /**
  * A spdy stream ( multiplexed over a spdy tcp connection ) processed by a
  * tomcat servlet.
- * 
+ *
  * Based on the AJP processor.
- * 
+ *
  */
 public class SpdyProcessor extends AbstractProcessor implements
 Runnable {

Modified: tomcat/trunk/java/org/apache/coyote/spdy/SpdyProxyProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/spdy/SpdyProxyProtocol.java?rev=1292459&r1=1292458&r2=1292

svn commit: r1292461 - /tomcat/trunk/java/org/apache/tomcat/spdy/SpdyContextProxy.java

Author: markt
Date: Wed Feb 22 19:23:31 2012
New Revision: 1292461

URL: http://svn.apache.org/viewvc?rev=1292461&view=rev
Log:
Add missing license header

Modified:
tomcat/trunk/java/org/apache/tomcat/spdy/SpdyContextProxy.java

Modified: tomcat/trunk/java/org/apache/tomcat/spdy/SpdyContextProxy.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/spdy/SpdyContextProxy.java?rev=1292461&r1=1292460&r2=1292461&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/spdy/SpdyContextProxy.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/spdy/SpdyContextProxy.java Wed Feb 22 
19:23:31 2012
@@ -1,4 +1,18 @@
 /*
+ *  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.spdy;
 



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



DO NOT REPLY [Bug 52735] Request.getRemoteAddr() throw NullPointerException

https://issues.apache.org/bugzilla/show_bug.cgi?id=52735

minde sun  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|INVALID |

--- Comment #6 from minde sun  2012-02-22 19:25:12 UTC ---
Hi Konstantin,

---
According to your stack trace you use a Future. It is executed asynchronously
in a different thread.
---

The class DataCabinetServlet is just a sub-class of  HttpServlet, its
definition list below
public class DataCabinetServlet  extends HttpServlet{

}

We do not create a new thread to handle the incoming request!

Since we don't use 'single thread model', I believe this Future is created and
maintained by tomcat servlet container. Even this is an tomcat servlet bug, it
is not a reason to ignore the bug from class Http11AprProcessor. You/your team
need to change the following logic in method actionInternal for sure:
@Override
public void actionInternal(ActionCode actionCode, Object param) {

long socketRef = socket.getSocket().longValue();
.

}

It is not good practice for above use, you need to do change the code to the
following:
long socketRef = socket.getSocket() == null? 0L:
socket.getSocket().longValue();

Please don't close this bug without carefully investigation!

Thanks,
Minde

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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: r1292463 - /tomcat/trunk/res/checkstyle/org-import-control.xml

Author: markt
Date: Wed Feb 22 19:26:43 2012
New Revision: 1292463

URL: http://svn.apache.org/viewvc?rev=1292463&view=rev
Log:
Keep checkstyle happy w.r.t. spdy

Modified:
tomcat/trunk/res/checkstyle/org-import-control.xml

Modified: tomcat/trunk/res/checkstyle/org-import-control.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/res/checkstyle/org-import-control.xml?rev=1292463&r1=1292462&r2=1292463&view=diff
==
--- tomcat/trunk/res/checkstyle/org-import-control.xml (original)
+++ tomcat/trunk/res/checkstyle/org-import-control.xml Wed Feb 22 19:26:43 2012
@@ -82,6 +82,7 @@
 
 
 
+
 
   
   



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



DO NOT REPLY [Bug 52735] Request.getRemoteAddr() throw NullPointerException

https://issues.apache.org/bugzilla/show_bug.cgi?id=52735

Mark Thomas  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||INVALID

--- Comment #7 from Mark Thomas  2012-02-22 19:27:52 UTC ---
Please stop wasting your time and ours by re-opening this issue when the bug is
in your own application code and/or a library it uses.

You have been told repeatedly where to seek further assistance. Please follow
that advice.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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



DO NOT REPLY [Bug 52735] Request.getRemoteAddr() throw NullPointerException

https://issues.apache.org/bugzilla/show_bug.cgi?id=52735

--- Comment #8 from minde sun  2012-02-22 20:16:30 UTC ---
I actually just found a bug from
org.apache.coyote.http11.Http11AprProcessor.actionInternal(Http11AprProcessor.java:272)
as the following statement
long socketRef = socket.getSocket().longValue();
If you guys don't think it is a bug, or don't want to fix, I am fine. 

Anyway, I am not going to reopen this bug. Since tomcat is an open source, I
can't request more, but I want you guys know that I really appreciate you guys
hard work. 

Btw, just want you know that our codes work for many years without any issue,
and this issue is not happened for any other computers/servers except my
computer. I have some special protocol setting for my local machine. That may
be the reason I hit this issue.

You guys have a wonderful day,

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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: r1292498 - /tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java

Author: markt
Date: Wed Feb 22 20:41:00 2012
New Revision: 1292498

URL: http://svn.apache.org/viewvc?rev=1292498&view=rev
Log:
Fix silly error

Modified:
tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java

Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java?rev=1292498&r1=1292497&r2=1292498&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java Wed Feb 
22 20:41:00 2012
@@ -109,6 +109,7 @@ public class WsInputStream extends java.
 // TODO i18n
 throw new IOException("End of stream before end of frame");
 }
+read += last;
 }
 }
 



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



RE: Tomcat with mod_jk becomes irresponsive after working for awhile

Mark Thomas wrote:
> On 22/02/2012 19:02, Ofer Israeli wrote:
>> All,
> 
> This is the dev list, not the users list. This question does not
> belong on this list. Further, I see you already posted to the users
> list. Please do not cross post. 
> 
> Mark

Hi Mark,

The reason I posted here as well as the users list is that I think there may be 
a bug in the Tomcat connector.  Should I procede in a different manner?


Cheers,
Ofer

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



RE: Tomcat with mod_jk becomes irresponsive after working for awhile

> From: Ofer Israeli [mailto:of...@checkpoint.com] 
> Subject: RE: Tomcat with mod_jk becomes irresponsive after working for awhile

> The reason I posted here as well as the users list is that I 
> think there may be a bug in the Tomcat connector.  Should I 
> procede in a different manner?

Yes, the users' list, as you've already been told.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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



svn commit: r1292598 - in /tomcat/trunk/java/org/apache/catalina/websocket: StreamInbound.java WsFrame.java WsFrameHeader.java WsInputStream.java WsOutbound.java

Author: markt
Date: Thu Feb 23 00:40:02 2012
New Revision: 1292598

URL: http://svn.apache.org/viewvc?rev=1292598&view=rev
Log:
Refactor

Added:
tomcat/trunk/java/org/apache/catalina/websocket/WsFrame.java
  - copied, changed from r1292498, 
tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java
Removed:
tomcat/trunk/java/org/apache/catalina/websocket/WsFrameHeader.java
Modified:
tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java
tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java

Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1292598&r1=1292597&r2=1292598&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Thu Feb 
23 00:40:02 2012
@@ -20,7 +20,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
-import java.nio.ByteBuffer;
 
 import org.apache.coyote.http11.upgrade.UpgradeInbound;
 import org.apache.coyote.http11.upgrade.UpgradeOutbound;
@@ -55,15 +54,15 @@ public abstract class StreamInbound impl
 try {
 WsInputStream wsIs = new WsInputStream(processor);
 
-WsFrameHeader header = wsIs.getFrameHeader();
+WsFrame frame = wsIs.getFrame();
 
 // TODO User defined extensions may define values for rsv
-if (header.getRsv() > 0) {
+if (frame.getRsv() > 0) {
 getOutbound().close(1002, null);
 return SocketState.CLOSED;
 }
 
-byte opCode = header.getOpCode();
+byte opCode = frame.getOpCode();
 
 if (opCode == Constants.OPCODE_BINARY) {
 onBinaryData(wsIs);
@@ -75,22 +74,14 @@ public abstract class StreamInbound impl
 return SocketState.UPGRADED;
 }
 
-// Must be a control frame and control frames:
-// - have a limited payload length
-// - must not be fragmented
-if (wsIs.getPayloadLength() > 125 || 
!wsIs.getFrameHeader().getFin()) {
-getOutbound().close(1002, null);
-return SocketState.CLOSED;
-}
-
 if (opCode == Constants.OPCODE_CLOSE){
-doClose(wsIs);
+doClose(frame);
 return SocketState.CLOSED;
 } else if (opCode == Constants.OPCODE_PING) {
-doPing(wsIs);
+doPing(frame);
 return SocketState.UPGRADED;
 } else if (opCode == Constants.OPCODE_PONG) {
-doPong(wsIs);
+// NO-OP
 return SocketState.UPGRADED;
 }
 
@@ -105,70 +96,23 @@ public abstract class StreamInbound impl
 }
 }
 
-private void doClose(WsInputStream is) throws IOException {
-// Control messages have a max size of 125 bytes. Need to try and read
-// one more so we reach end of stream (less 2 for the status). Note 
that
-// the 125 byte limit is enforced in #onData() before this method is
-// ever called.
-ByteBuffer data = null;
-
-int status = is.read();
-if (status != -1) {
-status = status << 8;
-int i = is.read();
-if (i == -1) {
-// EOF during middle of close message. Closing anyway but set
-// close code to protocol error
-status = 1002;
-} else {
-status = status + i;
-if (is.getPayloadLength() > 2) {
-data = ByteBuffer.allocate((int) is.getPayloadLength() - 
1);
-int read = 0;
-while (read > -1) {
-data.position(data.position() + read);
-read = is.read(data.array(), data.position(),
-data.remaining());
-}
-data.flip();
-}
-}
+private void doClose(WsFrame frame) throws IOException {
+if (frame.getPayLoadLength() > 0) {
+// Must be status (2 bytes) plus optional message
+if (frame.getPayLoadLength() == 1) {
+throw new IOException();
+}
+int status = (frame.getPayLoad().get() & 0xFF) << 8;
+status += frame.getPayLoad().get() & 0xFF;
+getOutbound().close(status, frame.getPayLoad());
 } else {
-status = 0;
-}
-getOutbound().close(status, data);
-}
-
-private void doPing(WsInputStream is) throws IOException {
-

svn commit: r1292600 - /tomcat/trunk/java/org/apache/catalina/websocket/WsFrame.java

Author: markt
Date: Thu Feb 23 00:40:42 2012
New Revision: 1292600

URL: http://svn.apache.org/viewvc?rev=1292600&view=rev
Log:
Refactor

Modified:
tomcat/trunk/java/org/apache/catalina/websocket/WsFrame.java

Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsFrame.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsFrame.java?rev=1292600&r1=1292599&r2=1292600&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/WsFrame.java (original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/WsFrame.java Thu Feb 23 
00:40:42 2012
@@ -60,9 +60,7 @@ public class WsFrame {
 payloadLength = Conversions.byteArrayToLong(extended);
 }
 
-boolean isControl = (opCode & 0x08) > 0;
-
-if (isControl) {
+if (isControl()) {
 if (payloadLength > 125) {
 throw new IOException();
 }
@@ -75,7 +73,7 @@ public class WsFrame {
 mask[j] = processorRead(processor) & 0xFF;
 }
 
-if (isControl) {
+if (isControl()) {
 // Note: Payload limited to <= 125 bytes by test above
 payload = ByteBuffer.allocate((int) payloadLength);
 processorRead(processor, payload);
@@ -96,6 +94,10 @@ public class WsFrame {
 return opCode;
 }
 
+public boolean isControl() {
+return (opCode & 0x08) > 0;
+}
+
 public int[] getMask() {
 return mask;
 }



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



svn commit: r1292601 - in /tomcat/trunk/java/org/apache/catalina/websocket: StreamInbound.java WsInputStream.java

Author: markt
Date: Thu Feb 23 00:41:22 2012
New Revision: 1292601

URL: http://svn.apache.org/viewvc?rev=1292601&view=rev
Log:
Handle ping frames in the middle of fragmented messages

Modified:
tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java

Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1292601&r1=1292600&r2=1292601&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Thu Feb 
23 00:41:22 2012
@@ -52,7 +52,7 @@ public abstract class StreamInbound impl
 // Must be start the start of a frame or series of frames
 
 try {
-WsInputStream wsIs = new WsInputStream(processor);
+WsInputStream wsIs = new WsInputStream(processor, outbound);
 
 WsFrame frame = wsIs.getFrame();
 

Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java?rev=1292601&r1=1292600&r2=1292601&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/WsInputStream.java Thu Feb 
23 00:41:22 2012
@@ -29,13 +29,18 @@ import org.apache.coyote.http11.upgrade.
 public class WsInputStream extends java.io.InputStream {
 
 private UpgradeProcessor processor;
-private WsFrame frame;
+private WsOutbound outbound;
 
+private WsFrame frame;
 private long remaining;
 private long readThisFragment;
 
-public WsInputStream(UpgradeProcessor processor) throws IOException {
+private String error = null;
+
+public WsInputStream(UpgradeProcessor processor, WsOutbound outbound)
+throws IOException {
 this.processor = processor;
+this.outbound = outbound;
 processFrame();
 }
 
@@ -54,13 +59,25 @@ public class WsInputStream extends java.
 
 @Override
 public int read() throws IOException {
+if (error != null) {
+throw new IOException(error);
+}
 while (remaining == 0 && !getFrame().getFin()) {
 // Need more data - process next frame
 processFrame();
-
+while (frame.isControl()) {
+if (getFrame().getOpCode() == Constants.OPCODE_PING) {
+outbound.pong(frame.getPayLoad());
+} else {
+// TODO
+throw new IOException("TODO");
+}
+processFrame();
+}
 if (getFrame().getOpCode() != Constants.OPCODE_CONTINUATION) {
 // TODO i18n
-throw new IOException("Not a continuation frame");
+error = "Not a continuation frame";
+throw new IOException(error);
 }
 }
 



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



svn commit: r1292602 - in /tomcat/trunk/java/org/apache/catalina/websocket: MessageInbound.java StreamInbound.java WsOutbound.java

Author: markt
Date: Thu Feb 23 00:42:05 2012
New Revision: 1292602

URL: http://svn.apache.org/viewvc?rev=1292602&view=rev
Log:
Tighten up UTF-8 handling

Modified:
tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java
tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java

Modified: tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java?rev=1292602&r1=1292601&r2=1292602&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/MessageInbound.java Thu Feb 
23 00:42:05 2012
@@ -54,6 +54,7 @@ public abstract class MessageInbound ext
 if (cb.remaining() == 0) {
 resizeCharBuffer();
 }
+// TODO This should fail on invalid UTF-8 input but doesn't
 read = r.read(cb.array(), cb.position(), cb.remaining());
 }
 cb.flip();

Modified: tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java?rev=1292602&r1=1292601&r2=1292602&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/StreamInbound.java Thu Feb 
23 00:42:05 2012
@@ -20,6 +20,9 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
+import java.nio.charset.CodingErrorAction;
+import java.nio.charset.MalformedInputException;
+import java.nio.charset.UnmappableCharacterException;
 
 import org.apache.coyote.http11.upgrade.UpgradeInbound;
 import org.apache.coyote.http11.upgrade.UpgradeOutbound;
@@ -68,8 +71,10 @@ public abstract class StreamInbound impl
 onBinaryData(wsIs);
 return SocketState.UPGRADED;
 } else if (opCode == Constants.OPCODE_TEXT) {
-InputStreamReader r =
-new InputStreamReader(wsIs, B2CConverter.UTF_8);
+InputStreamReader r = new InputStreamReader(wsIs,
+B2CConverter.UTF_8.newDecoder()
+.onMalformedInput(CodingErrorAction.REPORT)
+.onUnmappableCharacter(CodingErrorAction.REPORT));
 onTextData(r);
 return SocketState.UPGRADED;
 }
@@ -88,6 +93,14 @@ public abstract class StreamInbound impl
 // Unknown OpCode
 getOutbound().close(1002, null);
 return SocketState.CLOSED;
+} catch (MalformedInputException mie) {
+// Invalid UTF-8
+getOutbound().close(1007, null);
+return SocketState.CLOSED;
+} catch (UnmappableCharacterException uce) {
+// Invalid UTF-8
+getOutbound().close(1007, null);
+return SocketState.CLOSED;
 } catch (IOException ioe) {
 // Given something must have gone to reach this point, this might
 // not work but try it anyway.

Modified: tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java?rev=1292602&r1=1292601&r2=1292602&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java (original)
+++ tomcat/trunk/java/org/apache/catalina/websocket/WsOutbound.java Thu Feb 23 
00:42:05 2012
@@ -19,6 +19,8 @@ package org.apache.catalina.websocket;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
 
 import org.apache.coyote.http11.upgrade.UpgradeOutbound;
 import org.apache.tomcat.util.buf.B2CConverter;
@@ -121,8 +123,6 @@ public class WsOutbound {
 }
 closed = true;
 
-doFlush(true);
-
 upgradeOutbound.write(0x88);
 if (status == 0) {
 upgradeOutbound.write(0);
@@ -174,6 +174,10 @@ public class WsOutbound {
 private void doWriteBytes(ByteBuffer buffer, boolean finalFragment)
 throws IOException {
 
+if (closed) {
+throw new IOException("Closed");
+}
+
 // Work out the first byte
 int first = 0x00;
 if (finalFragment) {
@@ -226,8 +230,12 @@ public class WsOutbound {
 
 private void doWriteText(CharBuffer buffer, boolean finalFragment)
 throws IOException {
+CharsetEncoder encoder = B2CConverter.UTF_8.newEncoder();
 

Re: WebSocket progress report

On Mon, Feb 20, 2012 at 16:19, Mark Thomas  wrote:

> On 20/02/2012 21:28, Petr Praus wrote:
> > I'm glad to hear that.
> >
> > BTW, Jonathan quite significantly overhauled our implementation over the
> > weekend. The WebSocketFrame no longer buffers data but just stores a
> > reference to inputstream from which the data can be read by the client
> code
> > receiving the frame. This is not exactly what you originally implemented
> > but I think it's conceptually the same.
>
> That sounds much better (I haven't looked at the code in detail).
>
> > In the future it would desirable to
> > shield client code from the WebSocketFrame itself and just provide
> streams.
>
> Indeed. That is how the current implementation in trunk works.
>
> > I personally think of WebSocketFrame as being more useful to internal
> > protocol logic than client code which very often does not care about most
> > of the stuff captured in the frame, just the data.
>
> Agree completely.
>
> > I added some fixes yesterday and the code now passes all Autobahn tests
> > including proper closes and close status codes.
>
> Very nice. That is better than the current trunk can manage.
>
> > The only exception are
> > UTF-8-related tests which require reading whole payload and checking that
> > its valid UTF-8.
>
> Haven't looked too hard at those yet. Assuming Java can tell the UTF-8
> is invalid then handling that should be easy.
>
Yes, except that the java CharsetDecoder didn't seem to think that UTF-8
sent by Autobahn as invalid was indeed invalid. At least was my impression,
but I might very well be wrong.


> > Unfortunately it's no longer easily mergeable with current trunk because
> of
> > your fragmentation changes on Friday, but if you would be willing to look
> > at it anyway, it's available in our GitHub repository:
> > https://github.com/praus/tomcat (the repository is a fork of the
> official
> > github apache/tomcat mirror).
>
> That is pretty much inevitable when you have a large patch and one of
> the main reasons I am trying to keep to small incremental changes in trunk.
>
> There are some of those trunk changes (I am thinking of
> AbstractProcessor) that you'll need to pull into your fork.
>
I'll try to pull these during the weekend, maybe it'll still be useful.


> I am borrowing from your fork where I can and am providing credit in the
> commit message so you can see what I have used. You'll also get credit
> in the changelog along with the other folks that have contributed code
> to the WebSocket impl.
>
Thanks!


>
> Based on progress today, things should move along pretty quickly.
> Next step is to get ping/pong working.
>
> Mark
>
> >
> > Petr
> >
> > On Mon, Feb 20, 2012 at 14:35, Mark Thomas  wrote:
> >
> >> On 20/02/2012 10:04, Mark Thomas wrote:
> >>> On 20/02/2012 02:55, Petr Praus wrote:
>  but I wanted to ask - have you considered using Autobahn for
>  testing? It's rather extensive opensource websocket testing suite.
> >>>
> >>> I haven't. I just took a quick look. Looks like a nice tool. My test
> >>> client is intended to be something we can run in the unit tests to look
> >>> at very specific issues. It isn't intended to be a general WebSocket
> >>> client, nor to test the full range of functionality. I think Autobhan
> is
> >>> something we would run separately - a bit like we do with the WebDAV
> >>> test suite and the TCKs.
> >>
> >> I've been looking at this today and so far, my experience has been very
> >> good. Thanks for the tip. It has been really useful.
> >>
> >> I now have all the framing tests passing but the message close is
> >> currently unclean. Next step will be to fix that by adding support for
> >> close.
> >>
> >> Mark
> >>
> >> -
> >> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> >> For additional commands, e-mail: dev-h...@tomcat.apache.org
> >>
> >>
> >
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>
>


svn commit: r1292671 - in /tomcat/trunk/java/org/apache: coyote/spdy/SpdyAprNpnHandler.java tomcat/jni/SSLExt.java tomcat/spdy/CompressDeflater6.java

Author: costin
Date: Thu Feb 23 07:03:52 2012
New Revision: 1292671

URL: http://svn.apache.org/viewvc?rev=1292671&view=rev
Log:
Add decompress support and the npn handler. 

Assuming you compile the right jni library it should (basicaly) work with 
chrome and firefox.
Lots of missing features: async/comet/websocket, recycle of various objects, 
etc.


Added:
tomcat/trunk/java/org/apache/coyote/spdy/SpdyAprNpnHandler.java
tomcat/trunk/java/org/apache/tomcat/spdy/CompressDeflater6.java
Modified:
tomcat/trunk/java/org/apache/tomcat/jni/SSLExt.java

Added: tomcat/trunk/java/org/apache/coyote/spdy/SpdyAprNpnHandler.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/spdy/SpdyAprNpnHandler.java?rev=1292671&view=auto
==
--- tomcat/trunk/java/org/apache/coyote/spdy/SpdyAprNpnHandler.java (added)
+++ tomcat/trunk/java/org/apache/coyote/spdy/SpdyAprNpnHandler.java Thu Feb 23 
07:03:52 2012
@@ -0,0 +1,247 @@
+/*
+ *  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.coyote.spdy;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.coyote.Adapter;
+import org.apache.coyote.http11.Http11AprProtocol;
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
+import org.apache.tomcat.jni.Error;
+import org.apache.tomcat.jni.SSLExt;
+import org.apache.tomcat.jni.Status;
+import org.apache.tomcat.spdy.CompressDeflater6;
+import org.apache.tomcat.spdy.SpdyConnection;
+import org.apache.tomcat.spdy.SpdyContext;
+import org.apache.tomcat.spdy.SpdyStream;
+import org.apache.tomcat.util.net.AbstractEndpoint;
+import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
+import org.apache.tomcat.util.net.AprEndpoint;
+import org.apache.tomcat.util.net.SocketStatus;
+import org.apache.tomcat.util.net.SocketWrapper;
+
+/**
+ * Plugin for APR connector providing SPDY support via NPN negotiation.
+ * 
+ * Example:
+ * 
+ * 
+ * This requires APR library ( libtcnative-1 ) to be present and compiled
+ * with a recent openssl or a openssl patched with npn support.
+ * 
+ * Because we need to auto-detect SPDY and fallback to HTTP ( based on SSL next
+ * proto ) this is implemented in tomcat a special way:
+ * Http11AprProtocol will delegate to Spdy.process if spdy is
+ * negotiated by TLS.
+ * 
+ */
+public class SpdyAprNpnHandler implements Http11AprProtocol.NpnHandler {
+
+private static final Log log = LogFactory.getLog(AprEndpoint.class);
+
+private SpdyContext spdyContext;
+
+boolean ssl = true;
+
+@Override
+public void init(final AbstractEndpoint ep, long sslContext, 
+final Adapter adapter) {
+if (sslContext == 0) {
+// Apr endpoint without SSL.
+ssl = false;
+spdyContext = new SpdyContextApr(ep, adapter);
+spdyContext.setExecutor(ep.getExecutor());
+return;
+}
+if (0 == SSLExt.setNPN(sslContext, SpdyContext.SPDY_NPN_OUT)) {
+spdyContext = new SpdyContextApr(ep, adapter);
+spdyContext.setExecutor(ep.getExecutor());
+} else {
+log.warn("SPDY/NPN not supported");
+}
+}
+
+
+private final class SpdyContextApr extends SpdyContext {
+private final AbstractEndpoint ep;
+
+private final Adapter adapter;
+
+private SpdyContextApr(AbstractEndpoint ep, Adapter adapter) {
+this.ep = ep;
+this.adapter = adapter;
+}
+
+@Override
+protected void onSynStream(SpdyConnection con, SpdyStream ch) throws 
IOException {
+SpdyProcessor sp = new SpdyProcessor(con, ep);
+sp.setAdapter(adapter);
+sp.onSynStream(ch);
+}
+}
+
+public static class SpdyConnectionApr extends SpdyConnection {
+long socket;
+
+public SpdyConnectionApr(SocketWrapper socketW,
+SpdyContext spdyContext, boolean ssl) {
+super(spdyContext);
+this.socket = socketW.getSocket().longValue();
+if (ssl) {
+setCompressSupport(new Compres

Re: SPDY support

On Wed, Feb 22, 2012 at 10:47 AM, Mark Thomas  wrote:

> On 22/02/2012 18:41, Costin Manolache wrote:
> > On Wed, Feb 22, 2012 at 10:27 AM, Konstantin Kolinko <
> knst.koli...@gmail.com
> >> wrote:
> >
> >> 2012/2/22 Costin Manolache :
> >>> On Wed, Feb 22, 2012 at 8:57 AM, Mark Thomas  wrote:
> >>>
>  On 22/02/2012 16:51, Costin Manolache wrote:
> > First part submitted. For the second: what is the process for adding
> a
> > dependency ?
> 
>  Why do you need the dependency?
> 
> >>>
> >>> Spdy requires header compression - with a pre-defined dictionary (
> >>> containing header names and common values ). It also requires 'flush'
> - a
> >>> single compression context is used for all headers in the stream. AFAIK
> >>> this is not possible with the jdk compress library.
> >>>
> >>> That's one of the ways spdy gets its speed - it is not optional in
> >>> chrome/firefox.
> >>>
> >>
> >> 1. AJP/1.3 protocol has dictionary for header names.
> >> 2. In Deflater class explicit flush operation was added in Java 1.7.
> >>
> >
> > I think requiring Java1.7 is too much. Most prod servers are on 1.6.
> >
> > Would making it an 'optional' dependency work ( i.e. skip compiling the
> > required
> > classes / use class for name ) ? I can add an option to use 1.7 Deflater
> if
> > available.
>
> If we are talking about Tomcat 8 then that is very likely to require
> Java 1.7 anyway. 1.6 is close to EOL.
>
> Are you considering back-porting this to 7.0.x?
>
> There is also a workaround already in 7.0.x for flushing compressed
> streams.
>

Cool, that's something I didn't expect... Whoever found this workaround - I
owe you a beer.

I will try to compare the perf and mem use of the 2 for my curiosity - but
for now I'm using the java deflater.

I still have to submit the tests and some client code, but with the last
commit ( assuming I didn't break something ), with the right version of
tcnative and openssl it should work.

What's the test env. for the automated tests ? Are APR tests run - and with
what library ?

Costin