GithubHelp home page GithubHelp logo

horizon's People

Contributors

chrisayoub avatar hs-jenkins-bot avatar hsjbao avatar jaredstehler avatar jhaber avatar jw0x47 avatar mjball avatar ssalinas avatar stevie400 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

horizon's Issues

Support for StartSSL CA in Horizon SSL requests

@HiJon89 I would like to switch over to Horizon but I have one thing blocking me. I'm currently using certificates issued by StartSSL and had to add their CA cert to my local keystore. Ideally, I'd like to add my custom keystore to my project and configure the client to use it instead of doing what most people do and ignore SSL altogether by accepting all certs and defeat the purpose of TLS.

Is it possible already? I'd think we need something in HttpConfig to affect the part where we register a Scheme with the connection manager. I think something like this would be great ultimately if we could it through HttpConfig.

char[] kpass = "changeit".toCharArray();
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
File trustFile = new File(Resources.getResource(DefaultSSLSocketFactory.class, "/cacerts").toURI());
ks.load(new FileInputStream(trustFile), kpass);

KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmfactory.init(ks, kpass);

TrustManagerFactory tmfactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmfactory.init(ks);

SSLContext sslcontext = SSLContext.getInstance(TLS);
sslcontext.init(kmfactory.getKeyManagers(), tmfactory.getTrustManagers(), null);
return sslcontext;

Saner Defaults

@HiJon89 I'm running into a few SocketTimeoutException and I figured I reviewed my RetryStrategy and defaults and I found this: http://dev.bizo.com/2013/04/sensible-defaults-for-apache-httpclient.html just figured I shared it with you.

  • I think we should expose connection timeout in millis
  • Bump the number of connections per route
  • Bump the total number of connections
  • Reduce the connection timeout. Interesting if we could per-region settings which are very common anyway.

If the client does reach the MaxPerRoute or the MaxTotal connections, it will block until the connection manager timeout (ClientPNames.CONNMANAGERTIMEOUT) is reached. This timeout controls how long the client will wait for a connection from the connection manager. Fortunately, if this timeout is not set directly, it will default to the connection timeout if that is set, which will prevent the client from queuing up requests indefinitely.

addQueryParam(String name, Collection<String> values)

Would you be interested in adding this method to HttpRequest.Builder? This is to support a @QueryParam List<String> ids in Jersey without having to create a variable for the Builder with a for loop to make a request. I guess we'd need this for other primitive types also, but I'd leave that up to you. @HiJon89

public Builder addQueryParam(@Nonnull String name, @Nullable Collection<String> values) {
    Preconditions.checkNotNull(values);
    for(String value : values) {
      addQueryParam(name, value);
    }
    return this;
}

Here are the two examples:

HttpRequest.Builder builder = HttpRequest.newBuilder().setUrl(baseURL + "/users");
userNames.stream().forEach(u -> builder.addQueryParam("userName", u));
HttpResponse response = client.execute(builder.build());

vs

HttpResponse response = client.execute(HttpRequest
  .newBuilder()
  .setUrl(baseURL + "/users")
  .addQueryParam("userName", userNames);
  .build());

Imports

I'm using basepom and noticed this warning:

[WARNING] HorizonApache-0.0.11.jar, HorizonCore-0.0.11.jar define 623 overlappping classes:
[WARNING]   - org.apache.shaded.http.impl.client.DefaultBackoffStrategy
[WARNING]   - org.apache.shaded.http.client.entity.DeflateDecompressingEntity$DeflateStream
[WARNING]   - com.hubspot.horizon.HttpRuntimeException
[WARNING]   - org.apache.shaded.http.impl.conn.IdleConnectionHandler$TimeValues
[WARNING]   - org.apache.shaded.http.impl.conn.SingleClientConnManager$PoolEntry
[WARNING]   - org.apache.shaded.commons.codec.binary.BaseNCodecInputStream
[WARNING]   - org.apache.shaded.http.client.utils.URIBuilder
[WARNING]   - org.apache.shaded.http.conn.ssl.X509HostnameVerifier
[WARNING]   - org.apache.shaded.http.client.protocol.RequestAcceptEncoding
[WARNING]   - org.apache.shaded.http.ContentTooLongException
[WARNING]   - 613 more...

and my dependency tree looks like this:

[INFO] +- com.hubspot:HorizonApache:jar:0.0.11:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] +- com.hubspot:HorizonNing:jar:0.0.11:compile
[INFO] |  +- com.hubspot:HorizonCore:jar:0.0.11:compile
[INFO] |  \- com.ning:async-http-client:jar:1.8.12:compile
[INFO] |     \- io.netty:netty:jar:3.9.2.Final:compile

Any thoughts on how to structure the dependencies on Horizon so I don't get 623 repeated classes?

๐ŸŽฉ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.