Create multipart request

@param url URL to send to
@param connectTimeout connect timeout
@param readTimeout read timeout
@return new Multipart request
544011
public static Multipart multipart(String url, int connectTimeout, int readTimeout) {
        return new Multipart(url, connectTimeout, connectTimeout);
    }
1005964
public URLConnection createURLConnection(URL url) throws IOException {
        URLConnection conn = url.openConnection();
		return conn;
	}
41499
public static Put put(String url, byte[] content, int connectTimeout, int readTimeout) {

        try {
            return new Put(url, content, connectTimeout, readTimeout);
        } catch (Exception e) {
            throw new HttpException("Failed URL: " + url, e);
        }
    }
1120675
public function createRequest($url = null, $method = RequestInterface::METHOD_GET, $timeout = 5000)
    {
        return new Request($url, $method, $timeout);
    }
511018
public static String getContent(String stringUrl, Map<String, String> parameters, Proxy proxy)
      throws IOException {
    URL url = new URL(stringUrl);
    URLConnection conn;

    if (proxy != null) {
      conn = url.openConnection(proxy);
    } else {
      conn = url.openConnection();
    }

    conn.setConnectTimeout(5000); // set connect timeout to 5 seconds
    conn.setReadTimeout(60000); // set read timeout to 60 seconds

    if (parameters != null) {
      for (Entry<String, String> entry : parameters.entrySet()) {
        conn.addRequestProperty(entry.getKey(), entry.getValue());
      }
    }

    InputStream is = conn.getInputStream();
    if ("gzip".equals(conn.getContentEncoding())) {
       is = new GZIPInputStream(is);
    }
    
    return MyStreamUtils.readContent(is);
  }
593283
@Override
    protected Moment doConnect() throws IOException, ParseException {

        final NetTimeConfiguration cfg = this.getNetTimeConfiguration();

        URL url = new URL(cfg.getTimeServerAddress());
        int timeoutMillis =
            MathUtils.safeMultiply(cfg.getConnectionTimeout(), 1000);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setConnectTimeout(timeoutMillis);
        conn.setReadTimeout(timeoutMillis);
        conn.setUseCaches(false);
        conn.setRequestMethod("HEAD");

        int responseCode = conn.getResponseCode();

        if (responseCode >= 200 && responseCode <= 399) {
            return JAVA_UTIL_DATE.translate(new Date(conn.getDate()));
        }

        throw new IOException("HTTP server status: " + responseCode);

    }
60124
public RequestBuilder post(final String url) {

    checkNotNull(url, "url may not be null");
    final AsyncHttpClient.BoundRequestBuilder ningRequestBuilder = asyncHttpClient.preparePost(url);
    return createNewRequestBuilder(url, ningRequestBuilder);
  }
982060
public final Connection connectNow(Duration timeout) {
		Objects.requireNonNull(timeout, "timeout");
		try {
			return Objects.requireNonNull(connect().block(timeout), "aborted");
		}
		catch (IllegalStateException e) {
			if (e.getMessage().contains("blocking read")) {
				throw new IllegalStateException("TcpClient couldn't be started within "
						+ timeout.toMillis() + "ms");
			}
			throw e;
		}
	}
399084
public static Response delete(String url) throws HttpException {

		return delete(url, null, null, DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT);
	}
299886
public URLConnection connectWithRedirect(URL theURL) throws IOException {
        URLConnection conn = null;

        String accept_header = buildAcceptHeader();
        int redirect_count = 0;
        boolean done = false;

        while (!done) {
            if (theURL.getProtocol().equals("file")) {
                return null;
            }
            Boolean isHttp = (theURL.getProtocol().equals("http") || theURL
                    .getProtocol().equals("https"));

            logger.debug("Requesting: " + theURL.toString());

            conn = theURL.openConnection();

            if (isHttp) {
                logger.debug("Accept: " + accept_header);
                conn.setRequestProperty("Accept", accept_header);
            }

            conn.setConnectTimeout(60000);
            conn.setReadTimeout(60000);

            conn.connect();

            done = true; // by default quit after one request

            if (isHttp) {
                logger.debug("Response: " + conn.getHeaderField(0));
                int rc = ((HttpURLConnection) conn).getResponseCode();

                if ((rc == HttpURLConnection.HTTP_MOVED_PERM)
                        || (rc == HttpURLConnection.HTTP_MOVED_TEMP)
                        || (rc == HttpURLConnection.HTTP_SEE_OTHER)
                        || (rc == 307)) {
                    if (redirect_count > 10) {
                        return null; // Error: too many redirects
                    }
                    redirect_count++;
                    String loc = conn.getHeaderField("Location");
                    if (loc != null) {
                        theURL = new URL(loc);
                        done = false;
                    } else {
                        return null; // Bad redirect
                    }
                } else if ((rc < 200) || (rc >= 300)) {
                    return null; // Unsuccessful
                }
            }
        }
        return conn;
    }
1202037
private Response sendJsonPostOrPut(OauthToken token, String url, String json,
                                       int connectTimeout, int readTimeout, String method) throws IOException {
        LOG.debug("Sending JSON " + method + " to URL: " + url);
        Response response = new Response();

        HttpClient httpClient = createHttpClient(connectTimeout, readTimeout);
        HttpEntityEnclosingRequestBase action;
        if("POST".equals(method)) {
            action = new HttpPost(url);
        } else if("PUT".equals(method)) {
            action = new HttpPut(url);
        } else {
            throw new IllegalArgumentException("Method must be either POST or PUT");
        }
        Long beginTime = System.currentTimeMillis();
        action.setHeader("Authorization", "Bearer" + " " + token.getAccessToken());

        StringEntity requestBody = new StringEntity(json, ContentType.APPLICATION_JSON);
        action.setEntity(requestBody);
        try {
            HttpResponse httpResponse = httpClient.execute(action);

            String content = handleResponse(httpResponse, action);

            response.setContent(content);
            response.setResponseCode(httpResponse.getStatusLine().getStatusCode());
            Long endTime = System.currentTimeMillis();
            LOG.debug("POST call took: " + (endTime - beginTime) + "ms");
        } finally {
            action.releaseConnection();
        }

        return response;
    }
6538
@Override
    @SuppressWarnings("unused")
    public URLConnection openConnection(URL url) throws IOException {
        try {
            return (URLConnection) _openConnection.invoke(getInstance(), new Object[] { url });
        } catch (Exception e) {
            FFDCFilter.processException(e, getClass().getName(), "openConnection", url);
            return null;
        }
    }
216992
public static long downloadFile(String url, File destFile, int timeout) {
		return downloadFile(url, destFile, timeout, null);
	}
1339724
function (url, data, timeout) {

   log.debug("new http_post request", url, data, timeout);

   var d = when.defer();
   var req = new XMLHttpRequest();
   req.withCredentials = true; // pass along cookies
   req.onreadystatechange = function () {

      if (req.readyState === 4) {

         // Normalize IE's response to HTTP 204 when Win error 1223.
         // http://stackoverflow.com/a/10047236/884770
         //
         var status = (req.status === 1223) ? 204 : req.status;

         if (status === 200) {

            // response with content
            //
            d.resolve(req.responseText);

         } if (status === 204) {

            // empty response
            //
            d.resolve();

         } else {

            // anything else is a fail
            //
            var statusText = null;
            try {
               statusText = req.statusText;
            } catch (e) {
               // IE8 fucks up on this
            }
            d.reject({code: status, text: statusText});
         }
      }
   }

   req.open("POST", url, true);
   req.setRequestHeader("Content-type", "application/json; charset=utf-8");

   if (timeout > 0) {
      req.timeout = timeout; // request timeout in ms

      req.ontimeout = function () {
         d.reject({code: 501, text: "request timeout"});
      }
   }

   if (data) {
      req.send(data);
   } else {
      req.send();
   }

   if (d.promise.then) {
      // whenjs has the actual user promise in an attribute
      return d.promise;
   } else {
      return d;
   }
}
927368
public void setConnectTimeout(int timeout) {
		Assert.isTrue(timeout >= 0, "Timeout must be a non-negative value");
		getHttpClient().getParams().setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, timeout);
	}
561194
public static URLConnection open(URL url) throws IOException {
        final ProxyConfiguration p = get();
        
        URLConnection con;
        if(p==null) {
            con = url.openConnection();
        } else {
            Proxy proxy = p.createProxy(url.getHost());
            con = url.openConnection(proxy);
            if(p.getUserName()!=null) {
                // Add an authenticator which provides the credentials for proxy authentication
                Authenticator.setDefault(p.authenticator);
                p.jenkins48775workaround(proxy, url);
            }
        }
        
        if(DEFAULT_CONNECT_TIMEOUT_MILLIS > 0) {
            con.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT_MILLIS);
        }
        
        if (JenkinsJVM.isJenkinsJVM()) { // this code may run on a slave
            decorate(con);
        }

        return con;
    }
241935
public SdkClientBuilder connectionCheckoutTimeout(long timeout, TimeUnit unit)
    {
        this.connectionCheckoutTimeoutMs = (int) TimeUnit.MILLISECONDS.convert(timeout, unit);
        return this;
    }