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)

... answering to my own mail ;-)

Am 15.02.2017 um 20:22 schrieb Lothar Kimmeringer:

                ServerConnector sconn = new ServerConnector(hs, new ConnectionFactory[]{
                        new HttpConnectionFactory(),
                });

should have been
                ServerConnector sconn = new ServerConnector(hs, new ConnectionFactory[]{
                        new HttpConnectionFactory(new HttpConfiguration(), HttpCompliance.RFC2616),
                });

With that the request goes through.

Thanks for creating the feature request for the support of option 2 of the RFC.

Since I don't want to be forced to change the jetty.xml-files out there I
solved the setting of the compliance-setting programmatically by overwriting
doStart in my Server-class:


    @Override
    protected void doStart() throws Exception {
        super.doStart();
        Connector[] conns = getConnectors();
        for (int i = 0; i < conns.length; i++) {
            Connector c = conns[i];
            if (!(c instanceof ServerConnector)) {
                continue;
            }
            @SuppressWarnings("resource")
            ServerConnector sc = (ServerConnector) c;
            HttpConnectionFactory factory = sc.getConnectionFactory(HttpConnectionFactory.class);
            if (factory == null) {
                continue;
            }
            factory.setHttpCompliance(HttpCompliance.RFC2616);
        }
    }

If your RFE goes through I can remove that block again ;-)


Thanks and cheers, Lothar


Back to the top