#!/bin/bash
# Create a big header value
echo -n "X-Huge: " > big-header.tmp
openssl rand -base64 80000 | tr -d '\n' >> big-header.tmp
# Issue the request
With the testing of it ...
$ ./curl-bigrequest.sh
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /test/ HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.53.1
> Accept: */*
> X-Huge: Ccq6uj0NVMiRRa...(snip huge header)...0TQnj+05cXtdNgjgIHGs=
>
< HTTP/1.1 431 Request Header Fields Too Large
< Content-Type: text/html;charset=iso-8859-1
< Content-Length: 74
< Connection: close
< Server: Jetty(9.4.3.v20170317)
<
* Closing connection 0
<h1>Bad Message 431</h1><pre>reason: Request Header Fields Too Large</pre>
Seems like its working fine on Jetty 9.4.3 at least.
Lets see about latest Jetty 9.2 ...
$ ./curl-bigrequest.sh
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /test/ HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.53.1
> Accept: */*
> X-Huge: 1Kp7vXpbrf...(snip huge header)...I6QHbIqk=
>
< HTTP/1.1 413 Request Entity Too Large
< Content-Length: 0
< Connection: close
< Server: Jetty(9.2.21.v20170120)
<
* Closing connection 0
The server side logs on Jetty 9.2.21 shows ...
2017-03-23 11:33:08.031:WARN:oejh.HttpParser:qtp463345942-36: Header is too large >8192
2017-03-23 11:33:08.031:WARN:oejh.HttpParser:qtp463345942-36: badMessage: 413 for HttpChannelOverHttp@7817c547{r=0,c=false,a=IDLE,uri=/test/}
2017-03-23 11:33:08.032:WARN:oejh.HttpParser:qtp463345942-36: badMessage: java.lang.IllegalStateException: too much data after closed for HttpChannelOverHttp@7817c547{r=0,c=true,a=COMPLETED,uri=/test/}
Seems to be responding appropriately.