Skip to content

Commit

Permalink
Merge pull request square#172 from square/jw/casing
Browse files Browse the repository at this point in the history
Jw/casing
  • Loading branch information
swankjesse committed May 6, 2013
2 parents bd2cac5 + eb5e722 commit 3725b3d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Change Log
==========

Version 1.0.1 *(2013-05-06)*
----------------------------

* Correct casing of SSL in method names (`getSslSocketFactory`/`setSslSocketFactory`).


Version 1.0.0 *(2013-05-06)*
----------------------------

Expand Down
4 changes: 2 additions & 2 deletions okhttp/src/main/java/com/squareup/okhttp/OkHttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ private OkResponseCache okResponseCache() {
* <p>If unset, the {@link HttpsURLConnection#getDefaultSSLSocketFactory()
* system-wide default} SSL socket factory will be used.
*/
public OkHttpClient setSSLSocketFactory(SSLSocketFactory sslSocketFactory) {
public OkHttpClient setSslSocketFactory(SSLSocketFactory sslSocketFactory) {
this.sslSocketFactory = sslSocketFactory;
return this;
}

public SSLSocketFactory getSSLSocketFactory() {
public SSLSocketFactory getSslSocketFactory() {
return sslSocketFactory;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public HttpURLConnectionImpl(URL url, OkHttpClient client, OkResponseCache respo
this.proxySelector = client.getProxySelector();
this.cookieHandler = client.getCookieHandler();
this.connectionPool = client.getConnectionPool();
this.sslSocketFactory = client.getSSLSocketFactory();
this.sslSocketFactory = client.getSslSocketFactory();
this.hostnameVerifier = client.getHostnameVerifier();
this.transports = client.getTransports();
this.authenticator = client.getAuthenticator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ private void doUpload(TransferKind uploadKind, WriteKind writeKind) throws Excep
server.enqueue(new MockResponse().setBody("this response comes via HTTPS"));
server.play();

client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(new RecordingHostnameVerifier());
HttpURLConnection connection = client.open(server.getUrl("/foo"));

Expand All @@ -539,7 +539,7 @@ private void doUpload(TransferKind uploadKind, WriteKind writeKind) throws Excep
SSLSocketFactory clientSocketFactory = sslContext.getSocketFactory();
RecordingHostnameVerifier hostnameVerifier = new RecordingHostnameVerifier();

client.setSSLSocketFactory(clientSocketFactory);
client.setSslSocketFactory(clientSocketFactory);
client.setHostnameVerifier(hostnameVerifier);
HttpURLConnection connection = client.open(server.getUrl("/"));
assertContent("this response comes via HTTPS", connection);
Expand All @@ -559,12 +559,12 @@ private void doUpload(TransferKind uploadKind, WriteKind writeKind) throws Excep
server.play();

// install a custom SSL socket factory so the server can be authorized
client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(new RecordingHostnameVerifier());
HttpURLConnection connection1 = client.open(server.getUrl("/"));
assertContent("this response comes via HTTPS", connection1);

client.setSSLSocketFactory(null);
client.setSslSocketFactory(null);
HttpURLConnection connection2 = client.open(server.getUrl("/"));
try {
readAscii(connection2.getInputStream(), Integer.MAX_VALUE);
Expand All @@ -579,7 +579,7 @@ private void doUpload(TransferKind uploadKind, WriteKind writeKind) throws Excep
server.enqueue(new MockResponse().setBody("this response comes via SSL"));
server.play();

client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(new RecordingHostnameVerifier());
HttpURLConnection connection = client.open(server.getUrl("/foo"));

Expand Down Expand Up @@ -675,7 +675,7 @@ private void testConnectViaDirectProxyToHttps(ProxyConfig proxyConfig) throws Ex
server.play();

URL url = server.getUrl("/foo");
client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(new RecordingHostnameVerifier());
HttpURLConnection connection = proxyConfig.connect(server, client, url);

Expand Down Expand Up @@ -715,7 +715,7 @@ private void testConnectViaHttpProxyToHttps(ProxyConfig proxyConfig) throws Exce
server.play();

URL url = new URL("https://android.com/foo");
client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(hostnameVerifier);
HttpURLConnection connection = proxyConfig.connect(server, client, url);

Expand Down Expand Up @@ -752,7 +752,7 @@ private void testConnectViaHttpProxyToHttps(ProxyConfig proxyConfig) throws Exce
client.setProxy(server.toProxyAddress());

URL url = new URL("https://android.com/foo");
client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
HttpURLConnection connection = client.open(url);

try {
Expand Down Expand Up @@ -790,7 +790,7 @@ private void initResponseCache() throws IOException {
client.setProxy(server.toProxyAddress());

URL url = new URL("https://android.com/foo");
client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(hostnameVerifier);
HttpURLConnection connection = client.open(url);
connection.addRequestProperty("Private", "Secret");
Expand Down Expand Up @@ -822,7 +822,7 @@ private void initResponseCache() throws IOException {
client.setProxy(server.toProxyAddress());

URL url = new URL("https://android.com/foo");
client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(new RecordingHostnameVerifier());
HttpURLConnection connection = client.open(url);
assertContent("A", connection);
Expand Down Expand Up @@ -852,7 +852,7 @@ private void initResponseCache() throws IOException {
client.setProxy(server.toProxyAddress());

URL url = new URL("https://android.com/foo");
client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(new RecordingHostnameVerifier());
HttpURLConnection connection = client.open(url);
connection.setRequestProperty("Connection", "close");
Expand All @@ -873,7 +873,7 @@ private void initResponseCache() throws IOException {
client.setProxy(server.toProxyAddress());

URL url = new URL("https://android.com/foo");
client.setSSLSocketFactory(socketFactory);
client.setSslSocketFactory(socketFactory);
client.setHostnameVerifier(hostnameVerifier);
assertContent("response 1", client.open(url));
assertContent("response 2", client.open(url));
Expand Down Expand Up @@ -1088,7 +1088,7 @@ private void testClientConfiguredGzipContentEncodingAndConnectionReuse(TransferK
SSLSocketFactory socketFactory = sslContext.getSocketFactory();
RecordingHostnameVerifier hostnameVerifier = new RecordingHostnameVerifier();
server.useHttps(socketFactory, false);
client.setSSLSocketFactory(socketFactory);
client.setSslSocketFactory(socketFactory);
client.setHostnameVerifier(hostnameVerifier);
}

Expand Down Expand Up @@ -1399,7 +1399,7 @@ private void testSecureStreamingPost(StreamingMode streamingMode) throws Excepti
server.enqueue(new MockResponse().setBody("Success!"));
server.play();

client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(new RecordingHostnameVerifier());
HttpURLConnection connection = client.open(server.getUrl("/"));
connection.setDoOutput(true);
Expand Down Expand Up @@ -1533,7 +1533,7 @@ private void testRedirected(TransferKind transferKind, boolean reuse) throws Exc
server.enqueue(new MockResponse().setBody("This is the new location!"));
server.play();

client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(new RecordingHostnameVerifier());
HttpURLConnection connection = client.open(server.getUrl("/"));
assertEquals("This is the new location!",
Expand All @@ -1554,7 +1554,7 @@ private void testRedirected(TransferKind transferKind, boolean reuse) throws Exc
server.play();

client.setFollowProtocolRedirects(false);
client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(new RecordingHostnameVerifier());
HttpURLConnection connection = client.open(server.getUrl("/"));
assertEquals("This page has moved!", readAscii(connection.getInputStream(), Integer.MAX_VALUE));
Expand Down Expand Up @@ -1582,7 +1582,7 @@ private void testRedirected(TransferKind transferKind, boolean reuse) throws Exc
.setBody("This page has moved!"));
server.play();

client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(new RecordingHostnameVerifier());
client.setFollowProtocolRedirects(true);
HttpsURLConnection connection = (HttpsURLConnection) client.open(server.getUrl("/"));
Expand All @@ -1605,7 +1605,7 @@ private void testRedirected(TransferKind transferKind, boolean reuse) throws Exc
.setBody("This page has moved!"));
server.play();

client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(new RecordingHostnameVerifier());
client.setFollowProtocolRedirects(true);
HttpURLConnection connection = client.open(server.getUrl("/"));
Expand All @@ -1626,7 +1626,7 @@ private void redirectToAnotherOriginServer(boolean https) throws Exception {
if (https) {
server.useHttps(sslContext.getSocketFactory(), false);
server2.useHttps(sslContext.getSocketFactory(), false);
client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(new RecordingHostnameVerifier());
}

Expand Down Expand Up @@ -1848,7 +1848,7 @@ private void test307Redirect(String method) throws Exception {
sc.init(null, new TrustManager[] { trustManager }, new java.security.SecureRandom());

client.setHostnameVerifier(hostnameVerifier);
client.setSSLSocketFactory(sc.getSocketFactory());
client.setSslSocketFactory(sc.getSocketFactory());
server.useHttps(sslContext.getSocketFactory(), false);
server.enqueue(new MockResponse().setBody("ABC"));
server.enqueue(new MockResponse().setBody("DEF"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public boolean verify(String hostname, SSLSession session) {
private HttpResponseCache cache;

@Before public void setUp() throws Exception {
client.setSSLSocketFactory(sslContext.getSocketFactory());
client.setSslSocketFactory(sslContext.getSocketFactory());
client.setHostnameVerifier(NULL_HOSTNAME_VERIFIER);
String systemTmpDir = System.getProperty("java.io.tmpdir");
File cacheDir = new File(systemTmpDir, "HttpCache-" + UUID.randomUUID());
Expand Down

0 comments on commit 3725b3d

Please sign in to comment.