httpservices/src/main/java/ucar/httpservices/HTTPMethod.java
public HttpResponse
    executeRaw()
            throws HTTPException
    {
        if(this.closed)
            throw new IllegalStateException("HTTPMethod: attempt to execute closed method");
        if(this.executed)
            throw new IllegalStateException("HTTPMethod: attempt to re-execute method");
        this.executed = true;
        if(this.methodurl == null)
            throw new HTTPException("HTTPMethod: no url specified");
        if(!localsession && !sessionCompatible(this.methodurl))
            throw new HTTPException("HTTPMethod: session incompatible url: " + this.methodurl);

        // Capture the current state of the parent HTTPSession; never to be modified in this class
        this.settings = session.mergedSettings();

        try {
            // add range header
            if(this.range != null) {
                this.headers.put("Range", "bytes=" + range[0] + "-" + range[1]);
                range = null;
            }
            RequestBuilder rb = getRequestBuilder();
            setcontent(rb);
            setheaders(rb, this.headers);
            this.lastrequest = buildRequest(rb, this.settings);
            AuthScope methodscope = HTTPAuthUtil.uriToAuthScope(this.methodurl);
            AuthScope target = HTTPAuthUtil.authscopeUpgrade(session.getSessionScope(), methodscope);
            // AFAIK, targethost, httpclient, rb, and session
            // contain non-overlapping info => we cannot derive one
            // from any of the others.
            HttpHost targethost = HTTPAuthUtil.authscopeToHost(target);
            HttpClientBuilder cb = HttpClients.custom();
            configClient(cb, this.settings);
            session.setAuthenticationAndProxy(cb);
            HttpClient httpclient = cb.build();
            if(MOCKEXECUTOR != null) {
                URI uri = this.lastrequest.getURI();
                this.lastresponse = MOCKEXECUTOR.execute(this.lastrequest);
            } else {
                this.lastresponse = httpclient.execute(targethost, this.lastrequest, session.getContext());
            }
            if(this.lastresponse == null)
                throw new HTTPException("HTTPMethod.execute: Response was null");
            return this.lastresponse;
        } catch (IOException ioe) {
            throw new HTTPException(ioe);
        }
    }
public HttpResponse
    executeRaw()
            throws HTTPException
    {
        if(this.closed)
            throw new IllegalStateException("HTTPMethod: attempt to execute closed method");
        if(this.executed)
            throw new IllegalStateException("HTTPMethod: attempt to re-execute method");
        this.executed = true;
        if(this.methodurl == null)
            throw new HTTPException("HTTPMethod: no url specified");
        if(!localsession && !sessionCompatible(this.methodurl))
            throw new HTTPException("HTTPMethod: session incompatible url: " + this.methodurl);

        // Capture the current state of the parent HTTPSession; never to be modified in this class
        this.settings = session.mergedSettings();

        try {
            // add range header
            if(this.range != null) {
                this.headers.put("Range", "bytes=" + range[0] + "-" + range[1]);
                range = null;
            }
            RequestBuilder rb = getRequestBuilder();
            setcontent(rb);
            setheaders(rb, this.headers);
            this.lastrequest = buildRequest(rb, this.settings);
            AuthScope methodscope = HTTPAuthUtil.uriToAuthScope(this.methodurl);
            AuthScope target = HTTPAuthUtil.authscopeUpgrade(session.getSessionScope(), methodscope);
            // AFAIK, targethost, httpclient, rb, and session
            // contain non-overlapping info => we cannot derive one
            // from any of the others.
            HttpHost targethost = HTTPAuthUtil.authscopeToHost(target);
            HttpClientBuilder cb = HttpClients.custom();
            configClient(cb, this.settings);
            session.setAuthenticationAndProxy(cb);
            HttpClient httpclient = cb.build();
            if(MOCKEXECUTOR != null) {
                URI uri = this.lastrequest.getURI();
                this.lastresponse = MOCKEXECUTOR.execute(this.lastrequest);
            } else {
                this.lastresponse = httpclient.execute(targethost, this.lastrequest, session.getContext());
            }
            if(this.lastresponse == null)
                throw new HTTPException("HTTPMethod.execute: Response was null");
            return this.lastresponse;
        } catch (IOException ioe) {
            throw new HTTPException(ioe);
        }
    }
debug only