Skip to content

Commit 16a19c4

Browse files
authored
Merge pull request #749 from http4s/merge-to-main
Merge to main
2 parents e557600 + 44e846c commit 16a19c4

File tree

6 files changed

+60
-32
lines changed

6 files changed

+60
-32
lines changed

Diff for: .github/workflows/ci.yml

+17-20
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,25 @@ concurrency:
2424

2525
jobs:
2626
build:
27-
name: Build and Test
27+
name: Test
2828
strategy:
2929
fail-fast: false
3030
matrix:
31-
os: [ubuntu-latest]
31+
os: [ubuntu-22.04]
3232
scala: [2.13, 3]
3333
java: [temurin@17]
3434
project: [rootJVM]
3535
runs-on: ${{ matrix.os }}
3636
timeout-minutes: 60
3737
steps:
38-
- name: Install sbt
39-
if: contains(runner.os, 'macos')
40-
run: brew install sbt
41-
4238
- name: Checkout current branch (full)
4339
uses: actions/checkout@v4
4440
with:
4541
fetch-depth: 0
4642

43+
- name: Setup sbt
44+
uses: sbt/setup-sbt@v1
45+
4746
- name: Setup Java (temurin@17)
4847
id: setup-java-temurin-17
4948
if: matrix.java == 'temurin@17'
@@ -61,18 +60,18 @@ jobs:
6160
run: sbt githubWorkflowCheck
6261

6362
- name: Check headers and formatting
64-
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest'
63+
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-22.04'
6564
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck
6665

6766
- name: Test
6867
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test
6968

7069
- name: Check binary compatibility
71-
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest'
70+
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-22.04'
7271
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues
7372

7473
- name: Generate API documentation
75-
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest'
74+
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-22.04'
7675
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc
7776

7877
- name: Check scalafix lints
@@ -104,19 +103,18 @@ jobs:
104103
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
105104
strategy:
106105
matrix:
107-
os: [ubuntu-latest]
106+
os: [ubuntu-22.04]
108107
java: [temurin@17]
109108
runs-on: ${{ matrix.os }}
110109
steps:
111-
- name: Install sbt
112-
if: contains(runner.os, 'macos')
113-
run: brew install sbt
114-
115110
- name: Checkout current branch (full)
116111
uses: actions/checkout@v4
117112
with:
118113
fetch-depth: 0
119114

115+
- name: Setup sbt
116+
uses: sbt/setup-sbt@v1
117+
120118
- name: Setup Java (temurin@17)
121119
id: setup-java-temurin-17
122120
if: matrix.java == 'temurin@17'
@@ -179,19 +177,18 @@ jobs:
179177
if: github.event.repository.fork == false && github.event_name != 'pull_request'
180178
strategy:
181179
matrix:
182-
os: [ubuntu-latest]
180+
os: [ubuntu-22.04]
183181
java: [temurin@17]
184182
runs-on: ${{ matrix.os }}
185183
steps:
186-
- name: Install sbt
187-
if: contains(runner.os, 'macos')
188-
run: brew install sbt
189-
190184
- name: Checkout current branch (full)
191185
uses: actions/checkout@v4
192186
with:
193187
fetch-depth: 0
194188

189+
- name: Setup sbt
190+
uses: sbt/setup-sbt@v1
191+
195192
- name: Setup Java (temurin@17)
196193
id: setup-java-temurin-17
197194
if: matrix.java == 'temurin@17'
@@ -215,7 +212,7 @@ jobs:
215212
name: Validate Steward Config
216213
strategy:
217214
matrix:
218-
os: [ubuntu-latest]
215+
os: [ubuntu-22.04]
219216
java: [temurin@11]
220217
runs-on: ${{ matrix.os }}
221218
steps:

Diff for: build.sbt

+10-9
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ inThisBuild(
1818
)
1919
)
2020

21-
val http4sVersion = "1.0.0-M43"
21+
val http4sVersion = "1.0.0-M44"
2222

23-
val jetty = "12.0.14"
23+
val jetty = "12.0.16"
2424

25-
val netty = "4.1.114.Final"
25+
val netty = "4.1.116.Final"
2626

27-
val munit = "1.0.2"
27+
val munit = "1.0.3"
2828
val munitScalaCheck = "1.0.0"
2929

30-
val io_uring = "0.0.25.Final"
30+
val io_uring = "0.0.26.Final"
3131

3232
val nativeNettyModules =
3333
Seq(
@@ -55,7 +55,7 @@ lazy val core = project
5555
"io.netty" % "netty-codec-http" % netty,
5656
"io.netty" % "netty-handler" % netty,
5757
"org.http4s" %% "http4s-core" % http4sVersion,
58-
"org.typelevel" %% "cats-effect" % "3.5.4"
58+
"org.typelevel" %% "cats-effect" % "3.5.7"
5959
)
6060
)
6161

@@ -71,11 +71,11 @@ lazy val server = project
7171
"org.eclipse.jetty.http2" % "jetty-http2-client-transport" % jetty % Test,
7272
"org.http4s" %% "http4s-server" % http4sVersion,
7373
"org.http4s" %% "http4s-dsl" % http4sVersion % Test,
74-
"ch.qos.logback" % "logback-classic" % "1.4.5" % Test,
74+
"ch.qos.logback" % "logback-classic" % "1.2.13" % Test,
7575
"org.scalameta" %% "munit" % munit % Test,
7676
"org.scalameta" %% "munit-scalacheck" % munitScalaCheck % Test,
7777
"org.http4s" %% "http4s-circe" % http4sVersion % Test,
78-
"org.http4s" %% "http4s-jdk-http-client" % "1.0.0-M9" % Test,
78+
"org.http4s" %% "http4s-jdk-http-client" % "1.0.0-M10" % Test,
7979
"org.typelevel" %% "munit-cats-effect" % "2.0.0" % Test
8080
),
8181
libraryDependencySchemes += "org.typelevel" %% "munit-cats-effect" % VersionScheme.Always, // "early-semver",
@@ -99,7 +99,8 @@ lazy val client = project
9999
("com.github.monkeywie" % "proxyee" % "1.7.6" % Test)
100100
.excludeAll("io.netty")
101101
.excludeAll("org.bouncycastle"),
102-
"com.github.bbottema" % "java-socks-proxy-server" % "4.1.1" % Test,
102+
("com.github.bbottema" % "java-socks-proxy-server" % "4.1.2" % Test)
103+
.exclude("org.slf4j", "slf4j-api"),
103104
"org.scalameta" %% "munit" % munit % Test,
104105
"ch.qos.logback" % "logback-classic" % "1.2.13" % Test,
105106
"org.typelevel" %% "munit-cats-effect" % "2.0.0" % Test

Diff for: client/src/main/scala/org/http4s/netty/client/Http4sChannelPoolMap.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ private[client] class Http4sChannelPoolMap[F[_]](
115115
val key = Key(RequestKey.fromRequest(request), request.httpVersion)
116116

117117
for {
118-
channel <- connectAndConfigure(key)
119118
dispatcher <- Dispatcher.sequential[F](await = true)
119+
channel <- connectAndConfigure(key)
120120
handler <- Resource.make {
121121
F.pure {
122122
val handler =

Diff for: client/src/main/scala/org/http4s/netty/client/Http4sHandler.scala

+30
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,20 @@ import cats.effect.std.Dispatcher
2424
import cats.syntax.all._
2525
import io.netty.channel._
2626
import io.netty.handler.codec.http.HttpResponse
27+
import io.netty.handler.codec.http2.DefaultHttp2PingFrame
28+
import io.netty.handler.codec.http2.Http2Error
29+
import io.netty.handler.codec.http2.Http2GoAwayFrame
30+
import io.netty.handler.codec.http2.Http2PingFrame
31+
import io.netty.handler.codec.http2.Http2SettingsFrame
2732
import io.netty.handler.timeout.IdleState
2833
import io.netty.handler.timeout.IdleStateEvent
2934
import org.http4s._
35+
import org.http4s.netty.client.Http4sHandler.Http2GoAwayError
3036
import org.http4s.netty.client.Http4sHandler.logger
3137

3238
import java.io.IOException
3339
import java.nio.channels.ClosedChannelException
40+
import java.util.concurrent.CancellationException
3441
import scala.concurrent.ExecutionContext
3542
import scala.concurrent.Future
3643
import scala.concurrent.TimeoutException
@@ -178,6 +185,26 @@ private[netty] class Http4sHandler[F[_]](dispatcher: Dispatcher[F])(implicit F:
178185
}
179186
}
180187
}
188+
case x: Http2PingFrame =>
189+
if (!x.ack()) {
190+
ctx.writeAndFlush(new DefaultHttp2PingFrame(x.content(), true))
191+
} else {
192+
logger.debug("got pong")
193+
}
194+
case x: Http2SettingsFrame =>
195+
// What should we do with this?
196+
logger.debug(s"got settings, ${x.settings()}")
197+
case x: Http2GoAwayFrame =>
198+
val http2Error = Http2Error.valueOf(x.errorCode())
199+
http2Error match {
200+
case Http2Error.CANCEL =>
201+
onException(
202+
ctx.channel(),
203+
new CancellationException(s"Stream ${x.lastStreamId()} cancelled from server"))
204+
case _ =>
205+
val exception = Http2GoAwayError(http2Error, x.lastStreamId())
206+
onException(ctx.channel(), exception)
207+
}
181208
case _ =>
182209
super.channelRead(ctx, msg)
183210
}
@@ -238,4 +265,7 @@ private[netty] class Http4sHandler[F[_]](dispatcher: Dispatcher[F])(implicit F:
238265

239266
private object Http4sHandler {
240267
private val logger = org.log4s.getLogger
268+
269+
final case class Http2GoAwayError(error: Http2Error, lastStreamId: Int)
270+
extends Exception(s"http/2 recieved GoAway with ${error.name} and streamId=${lastStreamId}")
241271
}

Diff for: project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.10.2
1+
sbt.version=1.10.7

Diff for: project/plugins.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.17.3")
1+
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.17.6")

0 commit comments

Comments
 (0)