Skip to content

Commit

Permalink
Curl - DO NOT MERGE
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-signal committed May 27, 2020
1 parent 84737fb commit 13c5ab2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ apply plugin: 'com.google.protobuf'
apply plugin: 'androidx.navigation.safeargs'
apply plugin: 'witness'
apply from: 'translations.gradle'
apply from: 'witness-verifications.gradle'
//TODO reinstate
//apply from: 'witness-verifications.gradle'

repositories {
maven {
Expand Down
7 changes: 6 additions & 1 deletion libsignal/service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'witness'
apply plugin: 'idea'
apply from: 'witness-verifications.gradle'
//TODO reinstate
//apply from: 'witness-verifications.gradle'

sourceCompatibility = 1.8
archivesBaseName = "signal-service-java"
Expand All @@ -25,6 +26,7 @@ group = lib_signal_service_group_info
repositories {
mavenCentral()
mavenLocal()
jcenter()
}

dependencies {
Expand All @@ -38,6 +40,9 @@ dependencies {

api 'org.signal:zkgroup-java:0.7.0'

//TODO REMOVE
implementation 'com.github.mrmike:ok2curl:0.6.0'

testImplementation 'junit:junit:4.12'
testImplementation 'org.assertj:assertj-core:1.7.1'
testImplementation 'org.conscrypt:conscrypt-openjdk-uber:2.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.MessageLite;
import com.moczul.ok2curl.CurlInterceptor;

import org.signal.storageservice.protos.groups.AvatarUploadAttributes;
import org.signal.storageservice.protos.groups.Group;
Expand Down Expand Up @@ -101,6 +102,7 @@
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
Expand Down Expand Up @@ -1432,7 +1434,17 @@ private Response getServiceConnection(String urlFragment, String method, Request
OkHttpClient okHttpClient = baseClient.newBuilder()
.connectTimeout(soTimeoutMillis, TimeUnit.MILLISECONDS)
.readTimeout(soTimeoutMillis, TimeUnit.MILLISECONDS)
.build();

//TODO REMOVE
.addInterceptor(new CurlInterceptor(message ->{
if (StandardCharsets.US_ASCII.newEncoder().canEncode(message)) {
Log.v("Ok2Curl", message);
} else {
Log.v("Ok2Curl", "Can't log this");
}
}))

.build();

Log.d(TAG, "Push service URL: " + connectionHolder.getUrl());
Log.d(TAG, "Opening URL: " + String.format("%s%s", connectionHolder.getUrl(), urlFragment));
Expand Down

0 comments on commit 13c5ab2

Please sign in to comment.