Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Configuring option 2 of RFC 7230 paragraph 5 (HTTP header folding)

Hi Joakim,

Am 15.02.2017 um 19:21 schrieb Joakim Erdfelt:
Have you tried the HttpCompliance.RFC2616 mode in Jetty?

since I wasn't aware of that, no ;-)

https://github.com/eclipse/jetty.project/blob/jetty-9.3.16.v20170120/jetty-server/src/main/config/etc/jetty-http.xml#L32

Set the property `jetty.http.compliance=RFC2616` and try again.

I set the configuration first by setting it in a static block within my classes and
after that as property being set as run-conguration. Both tries failed. Here some
code how I set that up:

                System.out.println("Starting HTTP-server with comliance setting: " + System.getProperty("jetty.http.compliance"));
                Server hs = new Server();
                ServerSocket ss = new ServerSocket(0);
                LISTEN_PORT = ss.getLocalPort();
                ss.close();
                hs.setServerName("testserver"+LISTEN_PORT);
                assertNotNull("check existance of testserver", Server.getServer("testserver"+LISTEN_PORT));
                ServerConnector sconn = new ServerConnector(hs, new ConnectionFactory[]{
                        new HttpConnectionFactory(),
                });
                sconn.setPort(LISTEN_PORT);
                hs.addConnector(sconn);
                assertNotNull("check existance of testserver after second call", Server.getServer("testserver"+LISTEN_PORT));
                ContextHandlerCollection coll = new ContextHandlerCollection();
                hs.setHandler(coll);
                hs.start();

		[...]

Server is a class derived by me from the jetty-Server-class providing the
method getServer(String) in case you wonder.

These are the logs given out (plus some debug-text outputted by my testcase:

Starting HTTP-server with comliance setting: RFC2616
Feb 15, 2017 8:05:42 PM org.eclipse.jetty.server.Server doStart
INFORMATION: jetty-9.3.z-SNAPSHOT
Feb 15, 2017 8:05:42 PM org.eclipse.jetty.server.AbstractConnector doStart
INFORMATION: Started ServerConnector@1c93084c{HTTP/1.1,[http/1.1]}{0.0.0.0:27848}
Feb 15, 2017 8:05:42 PM org.eclipse.jetty.server.Server doStart
INFORMATION: Started @1224ms
[...]
20:05:42 NORMAL   SYSTEM:AS2:AS2PARTNERMANAGER(AUTH) Started
20:05:42 NORMAL   SYSTEM:AS2:AS2SERVICE: Setting context for servlet with server 'testserver27848', context '/project/*' and pathSpec '/AS2Retrieve/*'
20:05:42 NORMAL   SYSTEM:AS2:AS2SERVICE: Trying to start HTTP-Context /project'
Feb 15, 2017 8:05:42 PM org.eclipse.jetty.server.handler.ContextHandler doStart
INFORMATION: Started o.e.j.s.ServletContextHandler@50eac852{/project,null,AVAILABLE}
20:05:42 NORMAL   SYSTEM:AS2:AS2SERVICE: Adding servlet to context
20:05:42 NORMAL   SYSTEM:AS2:AS2SERVICE: Trying to set callback to servlet
20:05:42 NORMAL   SYSTEM:AS2:AS2SERVICE: Set callback to servlet
[...]
20:05:43 NORMAL   SYSTEM:SERVICEFACTORY Started all configured subsystems
=========================
POST /project/AS2Retrieve/ HTTP/1.1
Message-ID: <42D23EA6.8010100@xxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: application/pkcs7-mime; name=filename.dat;
	smime-type=compressed-data
Content-Transfer-Encoding: binary
Disposition-notification-options: signed-receipt-protocol=optional,pkcs7-signature; signed-receipt-micalg=optional,sha1,md5
AS2-Version: 1.1
Content-Disposition: attachment;filename=filename.dat
Date: Mon, 11 Jul 2005 11:40:54 +0200
From: Lothar Kimmeringer <sender@xxxxxxxxxxx>
To: receiver@xxxxxxxxxxx
AS2-From: as2from
AS2-To: as2to
Subject: Other Subject
Content-Length: 175
Host: 127.0.0.1:27848
Connection: close

[...]
=========================
Feb 15, 2017 8:05:43 PM org.eclipse.jetty.http.HttpParser parseNext
WARNUNG: bad HTTP parsed: 400 Header Folding for HttpChannelOverHttp@6d4ba4da{r=0,c=false,a=IDLE,uri=null}
stopping server
Stopping listener 27848
Feb 15, 2017 8:05:45 PM org.eclipse.jetty.server.AbstractConnector doStop
INFORMATION: Stopped ServerConnector@1c93084c{HTTP/1.1,[http/1.1]}{0.0.0.0:27848}


The request is a fixed text in the testcase in case you wonder about the Date.
The debug output shows that the system property is really set but it seems
to be ignored.


Thanks and cheers, Lothar


Back to the top