Re: [jetty-users] Problems on 100-continue + HTTPS

2016-09-07 Thread John Jiang
2016-09-07 16:39 GMT+08:00 Simone Bordet :

> Hi,
>
> On Wed, Sep 7, 2016 at 7:56 AM, John Jiang 
> wrote:
> > But I still found something interesting.
> > In my webapp, /body is a pretty simple Servlet, which just print
> something.
>
> Your servlet does one important thing: it calls
> request.getInputStream(), which triggers the send of the 100 Continue
> response.
>
> > If using a static file, like https://localhost:9021/index, namely,
> > curl -k --http2 -H "Expect: 100-continue" -d "body"
> > https://localhost:9021/index
> > it looks no error.
> > But if add -v option for curl, namley
> > curl -vk --http2 -H "Expect: 100-continue" -d "body"
> > https://localhost:9021/index
> > I met: curl: (92) HTTP/2 stream 1 was not closed cleanly: CANCEL (err 8)
> >
> > I tried several times.
> > 1. If accessing a Servlet, there is no error.
> > 2. If accessing a static page, the following error raised: curl: (92)
> HTTP/2
> > stream 1 was not closed cleanly: CANCEL (err 8)
> >
> > Is it a problem?
>
> What happens is that Jetty's DefaultServlet, which serves static
> content, does not read the request body (because it does not expect
> one).
> Because it does not read the request body, it does not send the 100
> Continue response to the client.
> DefaultServlet generates a 200 OK response with the static file
> content as the response body.
> Jetty then sees that the request is not finished, but nobody will ever
> read the request body, so it generates a reset with code CANCEL to
> tell the client to not send the content.
> In HTTP/1.1 the server would have closed the connection.
>
> What you see is the right behavior.
>
Tested the same cases with Apache 2.4.17, but no such message found.
It looks Apache uses NO_ERROR.
And for HTTP/1.1, Apache doesn't send "Connection: close"

I didn't try other server implementations.


> --
> Simone Bordet
> 
> http://cometd.org
> http://webtide.com
> Developer advice, training, services and support
> from the Jetty & CometD experts.
> ___
> jetty-users mailing list
> jetty-users@eclipse.org
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
___
jetty-users mailing list
jetty-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Re: [jetty-users] Problems on 100-continue + HTTPS

2016-09-07 Thread John Jiang
Java Environment:
-
 java.home = C:\Programs\Java\jdk1.8.0\jre
 java.vm.vendor = Oracle Corporation
 java.vm.version = 25.60-b23
 java.vm.name = Java HotSpot(TM) 64-Bit Server VM
 java.vm.info = mixed mode
 java.runtime.name = Java(TM) SE Runtime Environment
 java.runtime.version = 1.8.0_60-b60
 java.io.tmpdir = C:\Programs\cygwin64\tmp\
 user.dir = D:\http2\jetty\jetty-9.3.12\test-h1-base
 user.language = zh
 user.country = CN

Jetty Environment:
-
 jetty.version = 9.3.12-SNAPSHOT
 jetty.tag.version = master
 jetty.home = D:\http2\jetty\jetty-9.3.12
 jetty.base = D:\http2\jetty\jetty-9.3.12\test-h1-base

Config Search Order:

 
 ${jetty.base} -> D:\http2\jetty\jetty-9.3.12\test-h1-base
 ${jetty.home} -> D:\http2\jetty\jetty-9.3.12


JVM Arguments:
--
 (no jvm args specified)

System Properties:
--
 (no system properties specified)

Properties:
---
 java.version = 1.8.0_60
 java.version.major = 1
 java.version.minor = 8
 java.version.revision = 0
 java.version.update = 60

Jetty Server Classpath:
---
Version Information on 27 entries in the classpath.
Note: order presented here is how they would appear on the classpath.
  changes to the --module=name command line options will be reflected
here.
 0:3.1.0 | ${jetty.home}\lib\servlet-api-3.1.jar
 1: 3.1.0.M0 | ${jetty.home}\lib\jetty-schemas-3.1.jar
 2:  9.3.12-SNAPSHOT |
${jetty.home}\lib\jetty-http-9.3.12-SNAPSHOT.jar
 3:  9.3.12-SNAPSHOT |
${jetty.home}\lib\jetty-server-9.3.12-SNAPSHOT.jar
 4:  9.3.12-SNAPSHOT |
${jetty.home}\lib\jetty-xml-9.3.12-SNAPSHOT.jar
 5:  9.3.12-SNAPSHOT |
${jetty.home}\lib\jetty-util-9.3.12-SNAPSHOT.jar
 6:  9.3.12-SNAPSHOT |
${jetty.home}\lib\jetty-io-9.3.12-SNAPSHOT.jar
 7:  9.3.12-SNAPSHOT |
${jetty.home}\lib\jetty-jndi-9.3.12-SNAPSHOT.jar
 8:  1.4.1.v201005082020 |
${jetty.home}\lib\jndi\javax.mail.glassfish-1.4.1.v201005082020.jar
 9:  1.2 |
${jetty.home}\lib\jndi\javax.transaction-api-1.2.jar
10:  9.3.12-SNAPSHOT |
${jetty.home}\lib\jetty-security-9.3.12-SNAPSHOT.jar
11:  9.3.12-SNAPSHOT |
${jetty.home}\lib\jetty-servlet-9.3.12-SNAPSHOT.jar
12:  9.3.12-SNAPSHOT |
${jetty.home}\lib\jetty-webapp-9.3.12-SNAPSHOT.jar
13:  9.3.12-SNAPSHOT |
${jetty.home}\lib\jetty-deploy-9.3.12-SNAPSHOT.jar
14:  9.3.12-SNAPSHOT |
${jetty.home}\lib\jetty-plus-9.3.12-SNAPSHOT.jar
15:  9.3.12-SNAPSHOT |
${jetty.home}\lib\jetty-annotations-9.3.12-SNAPSHOT.jar
16:5.0.1 | ${jetty.home}\lib\annotations\asm-5.0.1.jar
17:5.0.1 |
${jetty.home}\lib\annotations\asm-commons-5.0.1.jar
18:  1.2 |
${jetty.home}\lib\annotations\javax.annotation-api-1.2.jar
19:  1.0 |
${jetty.home}\lib\websocket\javax.websocket-api-1.0.jar
20:  9.3.12-SNAPSHOT |
${jetty.home}\lib\websocket\javax-websocket-client-impl-9.3.12-SNAPSHOT.jar
21:  9.3.12-SNAPSHOT |
${jetty.home}\lib\websocket\javax-websocket-server-impl-9.3.12-SNAPSHOT.jar
22:  9.3.12-SNAPSHOT |
${jetty.home}\lib\websocket\websocket-api-9.3.12-SNAPSHOT.jar
23:  9.3.12-SNAPSHOT |
${jetty.home}\lib\websocket\websocket-client-9.3.12-SNAPSHOT.jar
24:  9.3.12-SNAPSHOT |
${jetty.home}\lib\websocket\websocket-common-9.3.12-SNAPSHOT.jar
25:  9.3.12-SNAPSHOT |
${jetty.home}\lib\websocket\websocket-server-9.3.12-SNAPSHOT.jar
26:  9.3.12-SNAPSHOT |
${jetty.home}\lib\websocket\websocket-servlet-9.3.12-SNAPSHOT.jar

Jetty Active XMLs:
--
 ${jetty.home}\etc\jetty.xml
 ${jetty.home}\etc\jetty-http.xml
 ${jetty.home}\etc\jetty-ssl.xml
 ${jetty.home}\etc\jetty-ssl-context.xml
 ${jetty.home}\etc\jetty-https.xml
 ${jetty.home}\etc\jetty-deploy.xml
 ${jetty.home}\etc\jetty-plus.xml
 ${jetty.home}\etc\jetty-annotations.xml


2016-09-08 6:15 GMT+08:00 Joakim Erdfelt :

> Run this and report back ...
>
> $ cd /path/to/mybase
> $ java -jar /path/to/jetty-dist/start.jar --list-config
>
>
>
> Joakim Erdfelt / joa...@webtide.com
>
> On Wed, Sep 7, 2016 at 2:51 PM, John Jiang 
> wrote:
>
>> Hi,
>> BTW, I suffered from another problem when migrated my base to the new
>> built Jetty.
>>
>> My application setups a Basic Authentication, like the below,
>> web.xml
>> 
>> BASIC
>> Test Realm
>> 
>> 
>> 
>> Authentication
>> /auth/*
>> 
>>
>> 
>> admin
>> user
>> moderator
>> 
>> 
>>
>> mybase/etc/test-realm.xml
>> 
>> http://www.eclipse.org/jetty/
>> configure_9_3.dtd">
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>   
>> 
>>   Test Realm
>>   > default="etc/realm.properties"/>
>>   0
>> 
>>   
>> 
>>
>> 
>>   demo test-realm is deployed. DO NOT USE IN
>> PRODUCTION!
>> 
>> 
>>
>> But the 

Re: [jetty-users] Problems on 100-continue + HTTPS

2016-09-07 Thread Joakim Erdfelt
Run this and report back ...

$ cd /path/to/mybase
$ java -jar /path/to/jetty-dist/start.jar --list-config



Joakim Erdfelt / joa...@webtide.com

On Wed, Sep 7, 2016 at 2:51 PM, John Jiang  wrote:

> Hi,
> BTW, I suffered from another problem when migrated my base to the new
> built Jetty.
>
> My application setups a Basic Authentication, like the below,
> web.xml
> 
> BASIC
> Test Realm
> 
> 
> 
> Authentication
> /auth/*
> 
>
> 
> admin
> user
> moderator
> 
> 
>
> mybase/etc/test-realm.xml
> 
> http://www.eclipse.org/jetty/
> configure_9_3.dtd">
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
> 
>   Test Realm
>default="etc/realm.properties"/>
>   0
> 
>   
> 
>
> 
>   demo test-realm is deployed. DO NOT USE IN
> PRODUCTION!
> 
> 
>
> But the server startup threw the following exception,
> java.lang.IllegalStateException: No LoginService for
> org.eclipse.jetty.security.authentication.BasicAuthenticator@24a35978 in
> org.eclipse.jetty.security.ConstraintSecurityHandler@16f7c8c1
> at org.eclipse.jetty.security.authentication.LoginAuthenticator.
> setConfiguration(LoginAuthenticator.java:76)
> at org.eclipse.jetty.security.SecurityHandler.doStart(
> SecurityHandler.java:354)
> at org.eclipse.jetty.security.ConstraintSecurityHandler.doStart(
> ConstraintSecurityHandler.java:448)
> at org.eclipse.jetty.util.component.AbstractLifeCycle.
> start(AbstractLifeCycle.java:68)
> at org.eclipse.jetty.util.component.ContainerLifeCycle.
> start(ContainerLifeCycle.java:131)
> at org.eclipse.jetty.util.component.ContainerLifeCycle.
> doStart(ContainerLifeCycle.java:105)
> at org.eclipse.jetty.server.handler.AbstractHandler.
> doStart(AbstractHandler.java:61)
> at org.eclipse.jetty.server.handler.ScopedHandler.doStart(
> ScopedHandler.java:120)
> at org.eclipse.jetty.server.session.SessionHandler.
> doStart(SessionHandler.java:116)
> at org.eclipse.jetty.util.component.AbstractLifeCycle.
> start(AbstractLifeCycle.java:68)
> at org.eclipse.jetty.util.component.ContainerLifeCycle.
> start(ContainerLifeCycle.java:131)
> at org.eclipse.jetty.util.component.ContainerLifeCycle.
> doStart(ContainerLifeCycle.java:105)
> at org.eclipse.jetty.server.handler.AbstractHandler.
> doStart(AbstractHandler.java:61)
> at org.eclipse.jetty.server.handler.ScopedHandler.doStart(
> ScopedHandler.java:120)
>
> Does Jetty make some change on this area?
> Or I missed something on the migration?
>
> 2016-09-06 21:00 GMT+08:00 Simone Bordet :
>
>> Hi,
>>
>> On Tue, Sep 6, 2016 at 2:24 PM, John Jiang 
>> wrote:
>> > Hi Simone,
>> >
>> > 2016-09-06 18:03 GMT+08:00 Simone Bordet :
>> >>
>> >> Hi,
>> >>
>> >> On Tue, Sep 6, 2016 at 12:00 PM, Simone Bordet 
>> >> wrote:
>> >> > It was a bug, tracked here:
>> >> > https://github.com/eclipse/jetty.project/issues/902
>> >>
>> >> It's fixed, can you try the latest Jetty 9.3.x code and report back if
>> >> it's working for you ?
>> >
>> > Clone all of the source codes and build it by myself?
>>
>> Yes, branch "jetty-9.3.x" and:
>>
>> mvn install -DskipTests=true
>>
>> for a quick build.
>>
>> --
>> Simone Bordet
>> 
>> http://cometd.org
>> http://webtide.com
>> Developer advice, training, services and support
>> from the Jetty & CometD experts.
>> ___
>> jetty-users mailing list
>> jetty-users@eclipse.org
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>
>
>
> ___
> jetty-users mailing list
> jetty-users@eclipse.org
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
___
jetty-users mailing list
jetty-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Re: [jetty-users] Problems on 100-continue + HTTPS

2016-09-07 Thread John Jiang
Hi,
BTW, I suffered from another problem when migrated my base to the new built
Jetty.

My application setups a Basic Authentication, like the below,
web.xml

BASIC
Test Realm



Authentication
/auth/*



admin
user
moderator



mybase/etc/test-realm.xml

http://www.eclipse.org/jetty/configure_9_3.dtd;>









  

  Test Realm
  
  0

  



  demo test-realm is deployed. DO NOT USE IN
PRODUCTION!



But the server startup threw the following exception,
java.lang.IllegalStateException: No LoginService for
org.eclipse.jetty.security.authentication.BasicAuthenticator@24a35978 in
org.eclipse.jetty.security.ConstraintSecurityHandler@16f7c8c1
at
org.eclipse.jetty.security.authentication.LoginAuthenticator.setConfiguration(LoginAuthenticator.java:76)
at
org.eclipse.jetty.security.SecurityHandler.doStart(SecurityHandler.java:354)
at
org.eclipse.jetty.security.ConstraintSecurityHandler.doStart(ConstraintSecurityHandler.java:448)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
at
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
at
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at
org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:120)
at
org.eclipse.jetty.server.session.SessionHandler.doStart(SessionHandler.java:116)
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
at
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
at
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at
org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:120)

Does Jetty make some change on this area?
Or I missed something on the migration?

2016-09-06 21:00 GMT+08:00 Simone Bordet :

> Hi,
>
> On Tue, Sep 6, 2016 at 2:24 PM, John Jiang 
> wrote:
> > Hi Simone,
> >
> > 2016-09-06 18:03 GMT+08:00 Simone Bordet :
> >>
> >> Hi,
> >>
> >> On Tue, Sep 6, 2016 at 12:00 PM, Simone Bordet 
> >> wrote:
> >> > It was a bug, tracked here:
> >> > https://github.com/eclipse/jetty.project/issues/902
> >>
> >> It's fixed, can you try the latest Jetty 9.3.x code and report back if
> >> it's working for you ?
> >
> > Clone all of the source codes and build it by myself?
>
> Yes, branch "jetty-9.3.x" and:
>
> mvn install -DskipTests=true
>
> for a quick build.
>
> --
> Simone Bordet
> 
> http://cometd.org
> http://webtide.com
> Developer advice, training, services and support
> from the Jetty & CometD experts.
> ___
> jetty-users mailing list
> jetty-users@eclipse.org
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
___
jetty-users mailing list
jetty-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Re: [jetty-users] Servlet Filter is Called Twice in Embedded Jetty

2016-09-07 Thread Igal @ Lucee.org

Yep. Thanks again, Greg!


Igal Sapir
Lucee Core Developer
Lucee.org 

On 9/6/2016 4:21 PM, Greg Wilkins wrote:
Answered on stack overflow you are setting the web.xml as the 
default descriptor, so it is being run twice.

Don't set the default descriptor.


On 6 September 2016 at 14:52, Igal @ Lucee.org > wrote:


I have written a very simple test Filter, and am running it in an
embedded Jetty 9.2.18.v20160721 in debug mode in IntelliJ IDEA:

|System.out.println(TestFilter.class.getSimpleName()// line 12+" >
"+((HttpServletRequest)servletRequest).getRequestURL()+": IP
"+servletRequest.getRemoteAddr()+"; at "+newDate().toString());//
Pass request back down the filter
chainfilterChain.doFilter(servletRequest,servletResponse);// line 20}|

and added it to web.xml:


|TestFilternet.twentyonesolutions.TestFilterTestFilter/*
|

When running in debug mode in IntelliJ IDEA, the Filter's
doFilter() method is called twice, and the output from line 12 is
written twice.  You can see the stack trace at the 2nd call below.
When I deploy the Filter to regular Jetty (same version), or
Tomcat, the output from line 12 is only written once, as expected.
Why is this happening in debug/embedded mode?  TIA I posted this
question with a bit more detail at

http://stackoverflow.com/questions/39337962/why-does-my-servlet-filter-run-twice


Stack trace at 2nd call:
[net.twentyonesolutions.TestFilter.doFilter(TestFilter.java:20)
   
,org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
   
,net.twentyonesolutions.TestFilter.doFilter(TestFilter.java:20)
   
,org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)

,org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)

,org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
,org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)

,org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)

,org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
,org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)

,org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)

,org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)

,org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)

,org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
,org.eclipse.jetty.server.Server.handle(Server.java:497)
,org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
,org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:245)
,org.eclipse.jetty.io

.AbstractConnection$2.run(AbstractConnection.java:540)

,org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)

,org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
,java.lang.Thread.run(Thread.java:745)]
-- 


Igal Sapir Lucee Core Developer Lucee.org 

___ jetty-users
mailing list jetty-users@eclipse.org
 To change your delivery options,
retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
 


--
Greg Wilkins > CTO 
http://webtide.com


___
jetty-users mailing list
jetty-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
___
jetty-users mailing list
jetty-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Re: [jetty-users] Problems on 100-continue + HTTPS

2016-09-07 Thread Simone Bordet
Hi,

On Wed, Sep 7, 2016 at 7:56 AM, John Jiang  wrote:
> But I still found something interesting.
> In my webapp, /body is a pretty simple Servlet, which just print something.

Your servlet does one important thing: it calls
request.getInputStream(), which triggers the send of the 100 Continue
response.

> If using a static file, like https://localhost:9021/index, namely,
> curl -k --http2 -H "Expect: 100-continue" -d "body"
> https://localhost:9021/index
> it looks no error.
> But if add -v option for curl, namley
> curl -vk --http2 -H "Expect: 100-continue" -d "body"
> https://localhost:9021/index
> I met: curl: (92) HTTP/2 stream 1 was not closed cleanly: CANCEL (err 8)
>
> I tried several times.
> 1. If accessing a Servlet, there is no error.
> 2. If accessing a static page, the following error raised: curl: (92) HTTP/2
> stream 1 was not closed cleanly: CANCEL (err 8)
>
> Is it a problem?

What happens is that Jetty's DefaultServlet, which serves static
content, does not read the request body (because it does not expect
one).
Because it does not read the request body, it does not send the 100
Continue response to the client.
DefaultServlet generates a 200 OK response with the static file
content as the response body.
Jetty then sees that the request is not finished, but nobody will ever
read the request body, so it generates a reset with code CANCEL to
tell the client to not send the content.
In HTTP/1.1 the server would have closed the connection.

What you see is the right behavior.

-- 
Simone Bordet

http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
___
jetty-users mailing list
jetty-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users