public static HttpRequest newJDiscRequest(CurrentContainer container, Request jettyRequest) {
        try {
            var jdiscHttpReq = HttpRequest.newServerRequest(
                    container,
                    getUri(jettyRequest),
                    getMethod(jettyRequest),
                    HttpRequest.Version.fromString(jettyRequest.getConnectionMetaData().getProtocol()),
                    new InetSocketAddress(Request.getRemoteAddr(jettyRequest), Request.getRemotePort(jettyRequest)),
                    getConnection(jettyRequest).getCreatedTimeStamp(),
                    Request.getTimeStamp(jettyRequest));
            jdiscHttpReq.context().put(RequestUtils.JDISC_REQUEST_X509CERT, getCertChain(jettyRequest));
            jdiscHttpReq.context().put(RequestUtils.JDICS_REQUEST_PORT, Request.getLocalPort(jettyRequest));
            var sslSessionData = (EndPoint.SslSessionData) jettyRequest.getAttribute(EndPoint.SslSessionData.ATTRIBUTE);
            if (sslSessionData != null) jdiscHttpReq.context().put(RequestUtils.JDISC_REQUEST_SSLSESSION, sslSessionData.sslSession());
            jettyRequest.setAttribute(HttpRequest.class.getName(), jdiscHttpReq);
            copyHeaders(jettyRequest, jdiscHttpReq);
            return jdiscHttpReq;
        } catch (IllegalArgumentException e) {
            throw createBadQueryException(e);
        }
    }
@author Simon Thoresen Hult
@author bjorncs
container-core/src/main/java/com/yahoo/jdisc/http/server/jetty/HttpRequestFactory.java