net.i2p.util
Class SSLEepGet
java.lang.Object
net.i2p.util.EepGet
net.i2p.util.SSLEepGet
public class SSLEepGet
- extends EepGet
HTTPS only, non-proxied only, no retries, no min and max size options, no timeout option
Fails on 301 or 302 (doesn't follow redirect)
Fails on self-signed certs (must have a valid cert chain)
- Since:
- 0.7.10
- Author:
- zzz
Fields inherited from class net.i2p.util.EepGet |
_aborted, _actualURL, _alreadyTransferred, _bytesRemaining, _bytesTransferred, _context, _currentAttempt, _encodingChunked, _fetchInactivityTimeout, _headersRead, _keepFetching, _listeners, _log, _notModified, _numRetries, _out, _outputFile, _outputStream, _proxy, _proxyIn, _proxyOut, _redirectLocation, _redirects, _shouldProxy, _transferFailed, _url, CONNECT_TIMEOUT, INACTIVITY_TIMEOUT, MAX_COMPLETE_FAILS, USER_AGENT |
Method Summary |
protected void |
doFetch(SocketTimeout timeout)
private static boolean addCert(KeyStore ks, String file) {
try {
InputStream fis = new FileInputStream(file);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
X509Certificate cert = (X509Certificate)cf.generateCertificate(fis);
fis.close();
System.err.println("Adding cert, Issuer: " + cert.getIssuerX500Principal());
try {
cert.checkValidity();
} catch (CertificateExpiredException cee) {
System.err.println("Warning - expired cert: " + cee);
} catch (CertificateNotYetValidException cnyve) {
System.err.println("Warning - not yet valid cert: " + cnyve);
}
// use file name as alias
ks.setCertificateEntry(file, cert);
} catch (GeneralSecurityException gse) {
System.err.println("Read cert error: " + gse);
return false;
} catch (IOException ioe) {
System.err.println("Read cert error: " + ioe);
return false;
}
return true;
} |
static void |
main(java.lang.String[] args)
SSLEepGet url
no command line options supported |
protected void |
sendRequest(SocketTimeout timeout)
|
Methods inherited from class net.i2p.util.EepGet |
addStatusListener, fetch, fetch, fetch, getContentType, getETag, getLastModified, getNotModified, getRequest, readChunkLength, readHeaders, stopFetching, suggestName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SSLEepGet
public SSLEepGet(I2PAppContext ctx,
java.io.OutputStream outputStream,
java.lang.String url)
main
public static void main(java.lang.String[] args)
- SSLEepGet url
no command line options supported
doFetch
protected void doFetch(SocketTimeout timeout)
throws java.io.IOException
- private static boolean addCert(KeyStore ks, String file) {
try {
InputStream fis = new FileInputStream(file);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
X509Certificate cert = (X509Certificate)cf.generateCertificate(fis);
fis.close();
System.err.println("Adding cert, Issuer: " + cert.getIssuerX500Principal());
try {
cert.checkValidity();
} catch (CertificateExpiredException cee) {
System.err.println("Warning - expired cert: " + cee);
} catch (CertificateNotYetValidException cnyve) {
System.err.println("Warning - not yet valid cert: " + cnyve);
}
// use file name as alias
ks.setCertificateEntry(file, cert);
} catch (GeneralSecurityException gse) {
System.err.println("Read cert error: " + gse);
return false;
} catch (IOException ioe) {
System.err.println("Read cert error: " + ioe);
return false;
}
return true;
}
- Overrides:
doFetch
in class EepGet
- Throws:
java.io.IOException
sendRequest
protected void sendRequest(SocketTimeout timeout)
throws java.io.IOException
- Overrides:
sendRequest
in class EepGet
- Throws:
java.io.IOException