final Proxy proxy = HttpSupport.proxyFor(proxySelector, u); HttpConnection conn = connectionFactory.create(u, proxy); HttpSupport.disableSslVerify(conn);
IOException error(final String action, final String key, final HttpURLConnection c) throws IOException { final IOException err = new IOException(MessageFormat.format( JGitText.get().amazonS3ActionFailed, action, key, Integer.valueOf(HttpSupport.response(c)), c.getResponseMessage())); if (c.getErrorStream() == null) { return err; } try (InputStream errorStream = c.getErrorStream()) { final ByteArrayOutputStream b = new ByteArrayOutputStream(); byte[] buf = new byte[2048]; for (;;) { final int n = errorStream.read(buf); if (n < 0) { break; } if (n > 0) { b.write(buf, 0, n); } } buf = b.toByteArray(); if (buf.length > 0) { err.initCause(new IOException("\n" + new String(buf, UTF_8))); //$NON-NLS-1$ } } return err; }
urlstr.append('/'); if (key.length() > 0) HttpSupport.encode(urlstr, key); if (!args.isEmpty()) { final Iterator<Map.Entry<String, String>> i; urlstr.append(e.getKey()); urlstr.append('='); HttpSupport.encode(urlstr, e.getValue()); if (i.hasNext()) urlstr.append('&'); final Proxy proxy = HttpSupport.proxyFor(proxySelector, url); final HttpURLConnection c;
private HttpURLConnection open(URL url) throws ConnectException, IOException { Proxy proxy = HttpSupport.proxyFor(proxySelector, url); HttpURLConnection c = (HttpURLConnection) url.openConnection(proxy); c.setUseCaches(false); return c; }
+ authorizationQueryParameters; Proxy proxy = HttpSupport.proxyFor(ProxySelector.getDefault(), endpointUrl); HttpClientConnectionFactory f = new HttpClientConnectionFactory(); HttpConnection conn = f.create(new URL(href), proxy); if (s3Config.isDisableSslVerify()) { HttpSupport.disableSslVerify(conn);
FileStream open(String path, AcceptEncoding acceptEncoding) throws IOException { final URL base = httpObjectsUrl; final URL u = new URL(base, path); final HttpConnection c = httpOpen(METHOD_GET, u, acceptEncoding); switch (HttpSupport.response(c)) { case HttpConnection.HTTP_OK: final InputStream in = openInputStream(c); // If content is being gzipped and then transferred, the content // length in the header is the zipped content length, not the // actual content length. if (!isGzipContent(c)) { final int len = c.getContentLength(); return new FileStream(in, len); } return new FileStream(in); case HttpConnection.HTTP_NOT_FOUND: throw new FileNotFoundException(u.toString()); default: throw new IOException(u.toString() + ": " //$NON-NLS-1$ + HttpSupport.response(c) + " " //$NON-NLS-1$ + c.getResponseMessage()); } }
urlstr.append('/'); if (key.length() > 0) HttpSupport.encode(urlstr, key); if (!args.isEmpty()) { final Iterator<Map.Entry<String, String>> i; urlstr.append(e.getKey()); urlstr.append('='); HttpSupport.encode(urlstr, e.getValue()); if (i.hasNext()) urlstr.append('&'); final Proxy proxy = HttpSupport.proxyFor(proxySelector, url); final HttpURLConnection c;
+ authorizationQueryParameters; Proxy proxy = HttpSupport.proxyFor(ProxySelector.getDefault(), endpointUrl); HttpClientConnectionFactory f = new HttpClientConnectionFactory(); HttpConnection conn = f.create(new URL(href), proxy); if (s3Config.isDisableSslVerify()) { HttpSupport.disableSslVerify(conn);
void openResponse() throws IOException { final int status = HttpSupport.response(conn); if (status != HttpConnection.HTTP_OK) { throw new TransportException(uri, status + " " //$NON-NLS-1$ + conn.getResponseMessage()); } final String contentType = conn.getContentType(); if (!responseType.equals(contentType)) { conn.getInputStream().close(); throw wrongContentType(responseType, contentType); } }
urlstr.append('/'); if (key.length() > 0) HttpSupport.encode(urlstr, key); if (!args.isEmpty()) { final Iterator<Map.Entry<String, String>> i; urlstr.append(e.getKey()); urlstr.append('='); HttpSupport.encode(urlstr, e.getValue()); if (i.hasNext()) urlstr.append('&'); final Proxy proxy = HttpSupport.proxyFor(proxySelector, url); final HttpURLConnection c;
HttpConnection contentServerConn = HttpTransport.getConnectionFactory() .create(contentUrl, HttpSupport .proxyFor(ProxySelector.getDefault(), contentUrl)); contentServerConn.setRequestMethod(method); if (action.header != null) { && !repo.getConfig().getBoolean(HttpConfig.HTTP, HttpConfig.SSL_VERIFY_KEY, true)) { HttpSupport.disableSslVerify(contentServerConn);
final HttpURLConnection c = open("GET", bucket, "", args); //$NON-NLS-1$ //$NON-NLS-2$ authorize(c); switch (HttpSupport.response(c)) { case HttpURLConnection.HTTP_OK: truncated = false;
URL url = new URL(lfsUrl + Protocol.OBJECTS_LFS_ENDPOINT); HttpConnection connection = HttpTransport.getConnectionFactory().create( url, HttpSupport.proxyFor(ProxySelector.getDefault(), url)); connection.setDoOutput(true); if (url.getProtocol().equals(SCHEME_HTTPS) && !config.getBoolean(HttpConfig.HTTP, HttpConfig.SSL_VERIFY_KEY, true)) { HttpSupport.disableSslVerify(connection);
switch (HttpSupport.response(c)) { case HttpURLConnection.HTTP_OK: return;
final Proxy proxy = HttpSupport.proxyFor(proxySelector, u); HttpConnection conn = connectionFactory.create(u, proxy); HttpSupport.disableSslVerify(conn);
switch (HttpSupport.response(c)) { case HttpURLConnection.HTTP_OK: return;
final Proxy proxy = HttpSupport.proxyFor(proxySelector, u); HttpConnection conn = connectionFactory.create(u, proxy); HttpSupport.disableSslVerify(conn);
new URL(baseUrl, HEAD), AcceptEncoding.GZIP); int status = HttpSupport.response(conn); switch (status) { case HttpConnection.HTTP_OK: {
final HttpURLConnection c = open("GET", bucket, key); //$NON-NLS-1$ authorize(c); switch (HttpSupport.response(c)) { case HttpURLConnection.HTTP_OK: encryption.validate(c, X_AMZ_META);
/** * Delete a single object. * <p> * Deletion always succeeds, even if the object does not exist. * * @param bucket * name of the bucket storing the object. * @param key * key of the object within its bucket. * @throws java.io.IOException * deletion failed due to communications error. */ public void delete(String bucket, String key) throws IOException { for (int curAttempt = 0; curAttempt < maxAttempts; curAttempt++) { final HttpURLConnection c = open("DELETE", bucket, key); //$NON-NLS-1$ authorize(c); switch (HttpSupport.response(c)) { case HttpURLConnection.HTTP_NO_CONTENT: return; case HttpURLConnection.HTTP_INTERNAL_ERROR: continue; default: throw error(JGitText.get().s3ActionDeletion, key, c); } } throw maxAttempts(JGitText.get().s3ActionDeletion, key); }