This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); | |
| conn.setRequestMethod("GET"); | |
| int status = conn.getResponseCode(); | |
| boolean redirect = false; | |
| if (status == HttpURLConnection.HTTP_MOVED_TEMP || status == HttpURLConnection.HTTP_MOVED_PERM | |
| || status == HttpURLConnection.HTTP_SEE_OTHER) { | |
| // redirect | |
| String newUrl = conn.getHeaderField("Location"); | |
| log.debug("Redirect " + url + " -> " + newUrl); | |
| redirect = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void checkHttpConnection(String url) throws IOException { | |
| URL _url = new URL(url); | |
| HttpURLConnection connection = ((HttpURLConnection) _url.openConnection()); | |
| int status = 0; | |
| try { | |
| status = connection.getResponseCode(); | |
| } catch (SSLHandshakeException e) { | |
| connection.disconnect(); | |
| disableCertificateValidation(); | |
| connection = ((HttpURLConnection) _url.openConnection()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static class RedirectFilterWorkAround implements ClientResponseFilter { | |
| @Override | |
| public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException { | |
| if (responseContext.getStatusInfo().getFamily() != Response.Status.Family.REDIRECTION) { | |
| return; | |
| } | |
| Response resp = requestContext.getClient().target(responseContext.getLocation()).request() | |
| .method(requestContext.getMethod()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // First write a custom class of org.springframework.remoting.httpinvoker.HttpComponentsHttpInvokerRequestExecutor : | |
| package com.myorg.proid.sample; | |
| import static org.apache.http.conn.ssl.SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER; | |
| import java.security.KeyManagementException; | |
| import java.security.KeyStoreException; | |
| import java.security.NoSuchAlgorithmException; | |
| import java.security.UnrecoverableKeyException; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static TrustManager[] dummyTrustManager = new TrustManager[] { new X509TrustManager() { | |
| @Override | |
| public X509Certificate[] getAcceptedIssuers() { | |
| return new X509Certificate[0]; | |
| } | |
| @Override | |
| public void checkClientTrusted(X509Certificate[] certs, String authType) {} | |
| @Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.InputStream; | |
| import java.security.KeyStore; | |
| import javax.net.ssl.HostnameVerifier; | |
| import javax.net.ssl.SSLContext; | |
| import javax.net.ssl.SSLSession; | |
| import javax.net.ssl.TrustManager; | |
| import javax.net.ssl.TrustManagerFactory; | |
| public class SSLSupport { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wget -S --spider --no-check-certificate http://my.darkest.web/repository |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static class RedirectFilterWorkAround implements ClientResponseFilter { | |
| @Override | |
| public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException { | |
| if (responseContext.getStatusInfo().getFamily() != Response.Status.Family.REDIRECTION) { | |
| return; | |
| } | |
| Response resp = requestContext.getClient().target(responseContext.getLocation()).request() | |
| .method(requestContext.getMethod()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Version 2014-11-21 | |
| # - UTF-8-Umlaute ersetzt | |
| # | |
| # Version 2014-11-07 | |
| # - SSL 3.0-Test: Robuster, funktioniert jetzt auch mit | |
| # MS IIS 7.5 Windows Server 2008R2 als Gegenstelle | |
| # | |
| # Version 2014-10-27 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for i in {1..100};do((i%3))&&x=||x=Fizz;((i%5))||x+=Buzz;echo ${x:-$i};done |