Here is the details of http post request:

* Hostname was NOT found in DNS cache

*   Trying 127.0.0.1...

* Connected to 127.0.0.1 (127.0.0.1) port 2013 (#0)

> POST /mock/127.0.0.1 HTTP/1.1

> User-Agent: curl/7.37.1

> Host: 127.0.0.1:2013

> Accept: */*

> Content-Type: application/json

> Content-Length: 248

>

* upload completely sent off: 248 out of 248 bytes

< HTTP/1.1 400 Bad Request

< Content-Length: 0

< Connection: close

* Server Jetty(9.2.13.v20150730) is not blacklisted

< Server: Jetty(9.2.13.v20150730)

<

* Closing connection 0


Here is the details of http get request:


* Hostname was NOT found in DNS cache

*   Trying 127.0.0.1...

* Connected to 127.0.0.1 (127.0.0.1) port 2013 (#0)

> GET /available HTTP/1.1

> User-Agent: curl/7.37.1

> Host: 127.0.0.1:2013

> Accept: */*

>

< HTTP/1.1 400 Bad Request

< Content-Length: 0

< Connection: close

* Server Jetty(9.2.13.v20150730) is not blacklisted

< Server: Jetty(9.2.13.v20150730)

<

* Closing connection 0


Thanks
zhong
________________________________
From: [email protected] <[email protected]> on 
behalf of Joakim Erdfelt <[email protected]>
Sent: Wednesday, August 12, 2015 5:33 PM
To: JETTY user mailing list
Subject: Re: [jetty-users] HTTP 400 status code returned after Jetty server 
upgraded from 9.0 to 9.2

Just mocked this up based on your descriptions.

A Jetty server using Jetty 9.2.13.v20150730
A servlet on "/mock/*" that has a doGet() and doPost() enabled.
Had the implementation of this servlet just respond what it got.

Using curl to access said servlet.

$ curl -vv http://127.0.0.1:2013/mock/127.0.0.1
* About to connect() to 127.0.0.1 port 2013 (#0)
*   Trying 127.0.0.1...
* Adding handle: conn: 0x11588d0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x11588d0) send_pipe: 1, recv_pipe: 0
* Connected to 127.0.0.1 (127.0.0.1) port 2013 (#0)
> GET /mock/127.0.0.1<http://127.0.0.1> HTTP/1.1
> User-Agent: curl/7.32.0
> Host: 127.0.0.1:2013<http://127.0.0.1:2013>
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Wed, 12 Aug 2015 21:32:07 GMT
< Content-Type: text/plain; charset=ISO-8859-1
< Content-Length: 62
* Server Jetty(9.2.13.v20150730) is not blacklisted
< Server: Jetty(9.2.13.v20150730)
<
GET Request received for http://127.0.0.1:2013/mock/127.0.0.1
* Connection #0 to host 127.0.0.1 left intact
$

$ curl -vv -H "Content-Type: application/json" --data @si.json 
http://127.0.0.1:2013/mock/127.0.0.1
* About to connect() to 127.0.0.1 port 2013 (#0)
*   Trying 127.0.0.1...
* Adding handle: conn: 0x12da920
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x12da920) send_pipe: 1, recv_pipe: 0
* Connected to 127.0.0.1 (127.0.0.1) port 2013 (#0)
> POST /mock/127.0.0.1<http://127.0.0.1> HTTP/1.1
> User-Agent: curl/7.32.0
> Host: 127.0.0.1:2013<http://127.0.0.1:2013>
> Accept: */*
> Content-Type: application/json
> Content-Length: 1103791
> Expect: 100-continue
>
< HTTP/1.1 200 OK
< Date: Wed, 12 Aug 2015 21:32:53 GMT
< Content-Type: text/plain; charset=ISO-8859-1
< Content-Length: 63
< Connection: close
* Server Jetty(9.2.z-SNAPSHOT) is not blacklisted
< Server: Jetty(9.2.z-SNAPSHOT)
<
POST Request received for http://127.0.0.1:2013/mock/127.0.0.1
* Closing connection 0

Can you use "-vv" on your curl line too?


Joakim Erdfelt / [email protected]<mailto:[email protected]>

On Wed, Aug 12, 2015 at 2:06 PM, X Z <[email protected]<mailto:[email protected]>> 
wrote:

curl -H "Content-Type: application/json" --data @si.json 
http://127.0.0.1:2013/mock/127.0.0.1

I also tried with "wget 
http://127.0.0.1:2013/available";<http://127.0.0.1:2013/available> which gave me 
same error code 400.

The above HTTP GET/POST worked with Jetty 9.0 server.

Thanks
zhong


________________________________
From: [email protected]<mailto:[email protected]> 
<[email protected]<mailto:[email protected]>> on 
behalf of Joakim Erdfelt <[email protected]<mailto:[email protected]>>
Sent: Wednesday, August 12, 2015 4:53 PM
To: JETTY user mailing list
Subject: Re: [jetty-users] HTTP 400 status code returned after Jetty server 
upgraded from 9.0 to 9.2

Can you capture the full POST request line and headers? and post it here?
Would like to see what you are sending.
>From the logs, it appears that something with your specific POST request is 
>tripping up the parser.
Best guess, you have a header without a key. (a HTTP spec violation)



Joakim Erdfelt / [email protected]<mailto:[email protected]>

On Wed, Aug 12, 2015 at 1:08 PM, X Z <[email protected]<mailto:[email protected]>> 
wrote:

Hi,


I have upgraded the embedded Jetty server from 9.0 to latest 9.2 version. The 
HTTP GET/POST requests return 400 code. I also saw this warning log:

WARN  HttpParser:59 - badMessage: java.lang.ArrayIndexOutOfBoundsException: 0 
for HttpChannelOverHttp@2e70eea7{r=0,c=false,a=IDLE,uri=-}

Anyone has got the insight on how to fix the issue?


The detailed debugging messages are:

015-08-12 15:51:55 DEBUG SelectorManager:89 - Queued change 
org.eclipse.jetty.io.SelectorManager$ManagedSelector$Accept@55c4b148

2015-08-12 15:51:55 DEBUG SelectorManager:89 - Selector loop woken up from 
select, 0/0 selected

2015-08-12 15:51:55 DEBUG SelectorManager:89 - Running change 
org.eclipse.jetty.io.SelectorManager$ManagedSelector$Accept@55c4b148

2015-08-12 15:51:55 DEBUG AbstractEndPoint:89 - onOpen 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,Open,in,out,-,-,3/30000,null}{io=0,kio=0,kro=0}

2015-08-12 15:51:55 DEBUG IdleTimeout:89 - 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,Open,in,out,-,-,3/30000,null}{io=0,kio=0,kro=0}
 idle timeout check, elapsed: 3 ms, remaining: 29997 ms

2015-08-12 15:51:55 DEBUG HttpChannel:89 - new 
HttpChannelOverHttp@2e70eea7{r=0,c=false,a=IDLE,uri=-} -> 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,Open,in,out,-,-,29/30000,null}{io=0,kio=0,kro=0},null,HttpChannelState@78442dc2{s=IDLE
 i=true a=null}

2015-08-12 15:51:55 DEBUG HttpConnection:89 - New HTTP Connection 
HttpConnection@45d14aaa{IDLE}

2015-08-12 15:51:55 DEBUG AbstractConnection:89 - onOpen 
HttpConnection@45d14aaa{IDLE}

2015-08-12 15:51:55 DEBUG AbstractConnection:89 - fillInterested 
HttpConnection@45d14aaa{IDLE}

2015-08-12 15:51:55 DEBUG AbstractConnection:89 - IDLE-->FILL_INTERESTED 
HttpConnection@45d14aaa{FILL_INTERESTED}

2015-08-12 15:51:55 DEBUG SelectChannelEndPoint:89 - Local interests updating 0 
-> 1 for 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,Open,in,out,R,-,0/30000,HttpConnection}{io=1,kio=0,kro=0}

2015-08-12 15:51:55 DEBUG SelectorManager:89 - Queued change 
org.eclipse.jetty.io.SelectChannelEndPoint$1@320dce4f

2015-08-12 15:51:55 DEBUG SelectorManager:89 - Created 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,Open,in,out,R,-,1/30000,HttpConnection}{io=1,kio=0,kro=0}

2015-08-12 15:51:55 DEBUG SelectorManager:89 - Running change 
org.eclipse.jetty.io.SelectChannelEndPoint$1@320dce4f

2015-08-12 15:51:55 DEBUG SelectChannelEndPoint:89 - Key interests updated 0 -> 
1 on 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,Open,in,out,R,-,2/30000,HttpConnection}{io=1,kio=1,kro=0}

2015-08-12 15:51:55 DEBUG SelectorManager:89 - Selector loop waiting on select

2015-08-12 15:51:55 DEBUG SelectorManager:89 - Selector loop woken up from 
select, 1/1 selected

2015-08-12 15:51:55 DEBUG SelectChannelEndPoint:89 - Key interests updated 1 -> 
0 on 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,Open,in,out,R,-,2/30000,HttpConnection}{io=1,kio=0,kro=1}

2015-08-12 15:51:55 DEBUG SelectChannelEndPoint:89 - Local interests updating 1 
-> 0 for 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,Open,in,out,R,-,3/30000,HttpConnection}{io=0,kio=0,kro=1}

2015-08-12 15:51:55 DEBUG SelectorManager:89 - Queued change 
org.eclipse.jetty.io.SelectChannelEndPoint$1@320dce4f

2015-08-12 15:51:55 DEBUG AbstractConnection:89 - FILL_INTERESTED-->FILLING 
HttpConnection@45d14aaa{FILLING}

2015-08-12 15:51:55 DEBUG SelectorManager:89 - Running change 
org.eclipse.jetty.io.SelectChannelEndPoint$1@320dce4f

2015-08-12 15:51:55 DEBUG SelectorManager:89 - Selector loop waiting on select

2015-08-12 15:51:55 DEBUG HttpConnection:89 - HttpConnection@45d14aaa{FILLING} 
onFillable HttpChannelState@78442dc2{s=IDLE i=true a=null}

2015-08-12 15:51:55 DEBUG ChannelEndPoint:89 - filled 394 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,Open,in,out,-,-,4/30000,HttpConnection}{io=0,kio=0,kro=1}

2015-08-12 15:51:55 DEBUG HttpParser:89 - parseNext s=START 
HeapByteBuffer@2c5c9e4a[p=0,l=394,c=8192,r=394]={<<<POST 
/mock/127.0....d":"127.0.0.1"}>>>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}

2015-08-12 15:51:55 DEBUG HttpParser:89 - START --> SPACE1

2015-08-12 15:51:55 DEBUG HttpParser:89 - SPACE1 --> URI

2015-08-12 15:51:55 DEBUG HttpParser:89 - URI --> SPACE2

2015-08-12 15:51:55 DEBUG HttpParser:89 - SPACE2 --> REQUEST_VERSION

2015-08-12 15:51:55 DEBUG HttpParser:89 - REQUEST_VERSION --> HEADER

2015-08-12 15:51:55 WARN  HttpParser:59 - badMessage: 
java.lang.ArrayIndexOutOfBoundsException: 0 for 
HttpChannelOverHttp@2e70eea7{r=0,c=false,a=IDLE,uri=-}

2015-08-12 15:51:55 DEBUG HttpParser:105 -

java.lang.ArrayIndexOutOfBoundsException: 0

at org.eclipse.jetty.util.ArrayTernaryTrie.getBest(ArrayTernaryTrie.java:374)

at org.eclipse.jetty.util.ArrayTernaryTrie.getBest(ArrayTernaryTrie.java:357)

at org.eclipse.jetty.http.HttpParser.parseHeaders(HttpParser.java:1047)

at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1257)

at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:250)

at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)

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

at 
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)

at java.lang.Thread.run(Thread.java:744)

2015-08-12 15:51:55 DEBUG HttpParser:89 - HEADER --> CLOSED

2015-08-12 15:51:55 DEBUG HttpChannelState:89 - 
HttpChannelState@78442dc2{s=IDLE i=true a=null} handling IDLE

2015-08-12 15:51:55 DEBUG HttpConnection:89 - 
org.eclipse.jetty.server.HttpConnection$SendCallback@4652a2dd[PROCESSING][i=ResponseInfo{HTTP/1.1
 400 
null,0,false},cb=org.eclipse.jetty.server.HttpChannel$CommitCallback@5b427f3c] 
generate: NEED_HEADER (null,null,true)@START

2015-08-12 15:51:55 DEBUG HttpConnection:89 - 
org.eclipse.jetty.server.HttpConnection$SendCallback@4652a2dd[PROCESSING][i=ResponseInfo{HTTP/1.1
 400 
null,0,false},cb=org.eclipse.jetty.server.HttpChannel$CommitCallback@5b427f3c] 
generate: FLUSH ([p=0,l=99,c=8192,r=99],null,true)@COMPLETING

2015-08-12 15:51:55 DEBUG WriteFlusher:89 - write: WriteFlusher@5bd3465a{IDLE} 
[HeapByteBuffer@4e26e633[p=0,l=99,c=8192,r=99]={<<<HTTP/1.1 400 Bad 
....v20150730)\r\n\r\n>>>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}]

2015-08-12 15:51:55 DEBUG WriteFlusher:89 - update 
WriteFlusher@5bd3465a{WRITING}:IDLE-->WRITING

2015-08-12 15:51:55 DEBUG ChannelEndPoint:89 - flushed 99 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,Open,in,out,-,W,10/30000,HttpConnection}{io=0,kio=0,kro=1}

2015-08-12 15:51:55 DEBUG WriteFlusher:89 - update 
WriteFlusher@5bd3465a{IDLE}:WRITING-->IDLE

2015-08-12 15:51:55 DEBUG HttpConnection:89 - 
org.eclipse.jetty.server.HttpConnection$SendCallback@4652a2dd[PROCESSING][i=ResponseInfo{HTTP/1.1
 400 
null,0,false},cb=org.eclipse.jetty.server.HttpChannel$CommitCallback@5b427f3c] 
generate: SHUTDOWN_OUT ([p=99,l=99,c=8192,r=0],null,true)@END

2015-08-12 15:51:55 DEBUG HttpConnection:89 - 
org.eclipse.jetty.server.HttpConnection$SendCallback@4652a2dd[PROCESSING][i=ResponseInfo{HTTP/1.1
 400 
null,0,false},cb=org.eclipse.jetty.server.HttpChannel$CommitCallback@5b427f3c] 
generate: DONE ([p=99,l=99,c=8192,r=0],null,true)@END

2015-08-12 15:51:55 DEBUG ChannelEndPoint:89 - oshut 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,Open,in,out,-,-,1/30000,HttpConnection}{io=0,kio=0,kro=1}

2015-08-12 15:51:55 DEBUG HttpChannelState:89 - 
HttpChannelState@78442dc2{s=DISPATCHED i=true a=null} unhandle DISPATCHED

2015-08-12 15:51:55 DEBUG ChannelEndPoint:89 - filled -1 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,Open,in,OSHUT,-,-,1/30000,HttpConnection}{io=0,kio=0,kro=1}

2015-08-12 15:51:55 DEBUG ChannelEndPoint:89 - ishut 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,Open,in,OSHUT,-,-,2/30000,HttpConnection}{io=0,kio=0,kro=1}

2015-08-12 15:51:55 DEBUG AbstractEndPoint:89 - onClose 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,CLOSED,ISHUT,OSHUT,-,-,2/30000,HttpConnection}{io=0,kio=0,kro=1}

2015-08-12 15:51:55 DEBUG ChannelEndPoint:89 - close 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,CLOSED,ISHUT,OSHUT,-,-,3/30000,HttpConnection}{io=0,kio=0,kro=1}

2015-08-12 15:51:55 DEBUG SelectorManager:89 - Destroyed 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,CLOSED,ISHUT,OSHUT,-,-,3/30000,HttpConnection}{io=0,kio=-1,kro=-1}

2015-08-12 15:51:55 DEBUG AbstractConnection:89 - onClose 
HttpConnection@45d14aaa{FILLING}

2015-08-12 15:51:55 DEBUG AbstractEndPoint:89 - onClose 
SelectChannelEndPoint@57f83f44{/127.0.0.1:60062<http://127.0.0.1:60062><->2013,CLOSED,ISHUT,OSHUT,-,-,4/30000,HttpConnection}{io=0,kio=-1,kro=-1}

2015-08-12 15:51:55 DEBUG HttpParser:89 - atEOF HttpParser{s=CLOSED,0 of 0}

2015-08-12 15:51:55 DEBUG HttpParser:89 - parseNext s=CLOSED 
HeapByteBuffer@4e26e633[p=0,l=0,c=8192,r=0]={<<<>>>HTTP/1.1 400 Bad 
...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}

2015-08-12 15:51:55 DEBUG AbstractConnection:89 - FILLING-->IDLE 
HttpConnection@45d14aaa{IDLE}

_______________________________________________
jetty-users mailing list
[email protected]<mailto:[email protected]>
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
[email protected]<mailto:[email protected]>
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
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to