Пример #1
0
 private String normaliseIPv6Address(String s) {
   if (s == null || !InetAddressUtils.isIPv6Address(s)) {
     return s;
   }
   String s1;
   try {
     s1 = InetAddress.getByName(s).getHostAddress();
   } catch (UnknownHostException unknownhostexception) {
     log.error(
         (new StringBuilder()).append("Unexpected error converting ").append(s).toString(),
         unknownhostexception);
     return s;
   }
   return s1;
 }
Пример #2
0
    public CloseableHttpResponse execute(HttpRoute httproute, HttpRequestWrapper httprequestwrapper, HttpClientContext httpclientcontext, HttpExecutionAware httpexecutionaware)
        throws IOException, HttpException
    {
        Object obj;
        CloseableHttpResponse closeablehttpresponse;
        int j;
        Args.notNull(httproute, "HTTP route");
        Args.notNull(httprequestwrapper, "HTTP request");
        Args.notNull(httpclientcontext, "HTTP context");
        obj = httpclientcontext.getRedirectLocations();
        if (obj != null)
        {
            ((List) (obj)).clear();
        }
        RequestConfig requestconfig = httpclientcontext.getRequestConfig();
        int i;
        if (requestconfig.getMaxRedirects() > 0)
        {
            i = requestconfig.getMaxRedirects();
        } else
        {
            i = 50;
        }
        obj = httprequestwrapper;
        j = 0;
_L1:
        closeablehttpresponse = requestExecutor.execute(httproute, ((HttpRequestWrapper) (obj)), httpclientcontext, httpexecutionaware);
        if (!requestconfig.isRedirectsEnabled() || !redirectStrategy.isRedirected(((HttpRequest) (obj)), closeablehttpresponse, httpclientcontext))
        {
            break MISSING_BLOCK_LABEL_507;
        }
        if (j >= i)
        {
            java.net.URI uri;
            HttpHost httphost;
            AuthScheme authscheme;
            try
            {
                throw new RedirectException((new StringBuilder()).append("Maximum redirects (").append(i).append(") exceeded").toString());
            }
            // Misplaced declaration of an exception variable
            catch (HttpRoute httproute)
            {
                closeablehttpresponse.close();
                throw httproute;
            }
            // Misplaced declaration of an exception variable
            catch (HttpRoute httproute)
            {
                closeablehttpresponse.close();
                throw httproute;
            }
            // Misplaced declaration of an exception variable
            catch (HttpRoute httproute) { }
            break MISSING_BLOCK_LABEL_457;
        }
        j++;
        obj = redirectStrategy.getRedirect(((HttpRequest) (obj)), closeablehttpresponse, httpclientcontext);
        if (!((HttpRequest) (obj)).headerIterator().hasNext())
        {
            ((HttpRequest) (obj)).setHeaders(httprequestwrapper.getOriginal().getAllHeaders());
        }
        obj = HttpRequestWrapper.wrap(((HttpRequest) (obj)));
        if (obj instanceof HttpEntityEnclosingRequest)
        {
            RequestEntityProxy.enhance((HttpEntityEnclosingRequest)obj);
        }
        uri = ((HttpRequestWrapper) (obj)).getURI();
        httphost = URIUtils.extractHost(uri);
        if (httphost != null)
        {
            break MISSING_BLOCK_LABEL_298;
        }
        throw new ProtocolException((new StringBuilder()).append("Redirect URI does not specify a valid host name: ").append(uri).toString());
        if (httproute.getTargetHost().equals(httphost))
        {
            break MISSING_BLOCK_LABEL_375;
        }
        httproute = httpclientcontext.getTargetAuthState();
        if (httproute == null)
        {
            break MISSING_BLOCK_LABEL_332;
        }
        log.debug("Resetting target auth state");
        httproute.reset();
        httproute = httpclientcontext.getProxyAuthState();
        if (httproute == null)
        {
            break MISSING_BLOCK_LABEL_375;
        }
        authscheme = httproute.getAuthScheme();
        if (authscheme == null)
        {
            break MISSING_BLOCK_LABEL_375;
        }
        if (authscheme.isConnectionBased())
        {
            log.debug("Resetting proxy auth state");
            httproute.reset();
        }
        httproute = routePlanner.determineRoute(httphost, ((HttpRequest) (obj)), httpclientcontext);
        if (log.isDebugEnabled())
        {
            log.debug((new StringBuilder()).append("Redirecting to '").append(uri).append("' via ").append(httproute).toString());
        }
        EntityUtils.consume(closeablehttpresponse.getEntity());
        closeablehttpresponse.close();
          goto _L1