From 23e3678c01f2f1a358f902fe6f02be930f6ed2e6 Mon Sep 17 00:00:00 2001 From: Alejandro Diaz Date: Sun, 18 Jun 2017 10:00:13 -0700 Subject: [PATCH 1/6] Adding createHttpClient to set a more sensible timeout. --- .../scala/com.zivver.webpush/PushService.scala | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com.zivver.webpush/PushService.scala b/src/main/scala/com.zivver.webpush/PushService.scala index 7d03e5f..02da25e 100644 --- a/src/main/scala/com.zivver.webpush/PushService.scala +++ b/src/main/scala/com.zivver.webpush/PushService.scala @@ -8,7 +8,8 @@ import org.apache.http.HttpResponse import org.apache.http.client.HttpClient import org.apache.http.client.methods.HttpPost import org.apache.http.entity.ByteArrayEntity -import org.apache.http.impl.client.HttpClients +import org.apache.http.client.config.RequestConfig +import org.apache.http.impl.client.HttpClientBuilder import org.apache.http.message.BasicHeader import pdi.jwt.Jwt import pdi.jwt.JwtAlgorithm.ES256 @@ -22,7 +23,20 @@ case class PushService(publicKey: ECPublicKey, privateKey: ECPrivateKey, subject private val base64encoder = Base64.getUrlEncoder private val defaultTtl: Int = 2419200 - private val httpClient: HttpClient = HttpClients.createDefault + private lazy val httpClient: HttpClient = createHttpClient + + /** + * Creates a sensible HttpClient with basic timeouts of 5 secs + * @return + */ + protected def createHttpClient: HttpClient = { + val timeout = 5 + val config = RequestConfig.custom + .setConnectTimeout(timeout * 1000) + .setConnectionRequestTimeout(timeout * 1000) + .setSocketTimeout(timeout * 1000).build + HttpClientBuilder.create.setDefaultRequestConfig(config).build + } /** * Send a data free push notification. From 82aac08e97393b824bc7943da0fab436c89d3e5c Mon Sep 17 00:00:00 2001 From: Alejandro Diaz Date: Sun, 18 Jun 2017 10:01:21 -0700 Subject: [PATCH 2/6] Bumping version --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index d2b4614..2dff99f 100644 --- a/build.sbt +++ b/build.sbt @@ -3,7 +3,7 @@ name := "web-push" organization := "com.zivver" -version := "0.2.1" +version := "0.2.2" scalaVersion := "2.12.1" From c44ca8efaf04a7266021820f43b4677e09cf7578 Mon Sep 17 00:00:00 2001 From: Alejandro Diaz Date: Sun, 18 Jun 2017 10:02:01 -0700 Subject: [PATCH 3/6] Bumping scala 2.11 minor version to 2.11.11 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 2dff99f..56e92c3 100644 --- a/build.sbt +++ b/build.sbt @@ -7,7 +7,7 @@ version := "0.2.2" scalaVersion := "2.12.1" -crossScalaVersions := Seq("2.11.8", "2.12.1") +crossScalaVersions := Seq("2.11.11", "2.12.1") libraryDependencies ++= Seq( "com.pauldijou" %% "jwt-core" % "0.10.0", From c7c7998675a6bf9744fb5876450703bb74c6301e Mon Sep 17 00:00:00 2001 From: Alejandro Diaz Date: Sun, 18 Jun 2017 10:20:22 -0700 Subject: [PATCH 4/6] Bumping dependencies version --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 56e92c3..31cc04d 100644 --- a/build.sbt +++ b/build.sbt @@ -10,9 +10,9 @@ scalaVersion := "2.12.1" crossScalaVersions := Seq("2.11.11", "2.12.1") libraryDependencies ++= Seq( - "com.pauldijou" %% "jwt-core" % "0.10.0", + "com.pauldijou" %% "jwt-core" % "0.13.0", "org.apache.httpcomponents" % "fluent-hc" % "4.5.2", - "org.bouncycastle" % "bcprov-jdk15on" % "1.55" + "org.bouncycastle" % "bcprov-jdk15on" % "1.57" ) publishTo := { From 29a4054f686767f134ad1383e8b4cc19bd93d81c Mon Sep 17 00:00:00 2001 From: Alejandro Diaz Date: Fri, 3 Nov 2017 10:56:19 -0700 Subject: [PATCH 5/6] Bumping libraries --- build.sbt | 10 +++++----- project/build.properties | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index 31cc04d..fc23bd0 100644 --- a/build.sbt +++ b/build.sbt @@ -3,15 +3,15 @@ name := "web-push" organization := "com.zivver" -version := "0.2.2" +version := "0.2.3" -scalaVersion := "2.12.1" +scalaVersion := "2.12.4" -crossScalaVersions := Seq("2.11.11", "2.12.1") +crossScalaVersions := Seq("2.11.11", "2.12.4") libraryDependencies ++= Seq( - "com.pauldijou" %% "jwt-core" % "0.13.0", - "org.apache.httpcomponents" % "fluent-hc" % "4.5.2", + "com.pauldijou" %% "jwt-core" % "0.14.1", + "org.apache.httpcomponents" % "fluent-hc" % "4.5.3", "org.bouncycastle" % "bcprov-jdk15on" % "1.57" ) diff --git a/project/build.properties b/project/build.properties index e0cbc71..017bb86 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 0.13.13 \ No newline at end of file +sbt.version = 1.0.2 From 5250ea7897f6abef9e84e8f7d501bd7860d976f9 Mon Sep 17 00:00:00 2001 From: Alejandro Diaz Date: Wed, 12 Dec 2018 17:58:55 -0300 Subject: [PATCH 6/6] Bumping versions --- build.sbt | 12 ++++++------ project/build.properties | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index fc23bd0..78e1455 100644 --- a/build.sbt +++ b/build.sbt @@ -3,16 +3,16 @@ name := "web-push" organization := "com.zivver" -version := "0.2.3" +version := "0.2.4" -scalaVersion := "2.12.4" +scalaVersion := "2.12.6" -crossScalaVersions := Seq("2.11.11", "2.12.4") +crossScalaVersions := Seq("2.11.11", "2.12.6") libraryDependencies ++= Seq( - "com.pauldijou" %% "jwt-core" % "0.14.1", - "org.apache.httpcomponents" % "fluent-hc" % "4.5.3", - "org.bouncycastle" % "bcprov-jdk15on" % "1.57" + "com.pauldijou" %% "jwt-core" % "1.0.0", + "org.apache.httpcomponents" % "fluent-hc" % "4.5.6", + "org.bouncycastle" % "bcprov-jdk15on" % "1.60" ) publishTo := { diff --git a/project/build.properties b/project/build.properties index 017bb86..467c7ad 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 1.0.2 +sbt.version = 1.2.3