Skip to content

Commit

Permalink
Merge branch 'series/0.5' into merge-to-main
Browse files Browse the repository at this point in the history
  • Loading branch information
hamnis committed Dec 30, 2024
2 parents e557600 + fa03dbd commit 9bab88e
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 31 deletions.
37 changes: 17 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,25 @@ concurrency:

jobs:
build:
name: Build and Test
name: Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
os: [ubuntu-22.04]
scala: [2.13, 3]
java: [temurin@17]
project: [rootJVM]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Setup Java (temurin@17)
id: setup-java-temurin-17
if: matrix.java == 'temurin@17'
Expand All @@ -61,18 +60,18 @@ jobs:
run: sbt githubWorkflowCheck

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

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

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

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

- name: Check scalafix lints
Expand Down Expand Up @@ -104,19 +103,18 @@ jobs:
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-22.04]
java: [temurin@17]
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Setup Java (temurin@17)
id: setup-java-temurin-17
if: matrix.java == 'temurin@17'
Expand Down Expand Up @@ -179,19 +177,18 @@ jobs:
if: github.event.repository.fork == false && github.event_name != 'pull_request'
strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-22.04]
java: [temurin@17]
runs-on: ${{ matrix.os }}
steps:
- name: Install sbt
if: contains(runner.os, 'macos')
run: brew install sbt

- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup sbt
uses: sbt/setup-sbt@v1

- name: Setup Java (temurin@17)
id: setup-java-temurin-17
if: matrix.java == 'temurin@17'
Expand All @@ -215,7 +212,7 @@ jobs:
name: Validate Steward Config
strategy:
matrix:
os: [ubuntu-latest]
os: [ubuntu-22.04]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
Expand Down
19 changes: 10 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ inThisBuild(
)
)

val http4sVersion = "1.0.0-M43"
val http4sVersion = "1.0.0-M44"

val jetty = "12.0.14"
val jetty = "12.0.16"

val netty = "4.1.114.Final"
val netty = "4.1.116.Final"

val munit = "1.0.2"
val munit = "1.0.3"
val munitScalaCheck = "1.0.0"

val io_uring = "0.0.25.Final"
val io_uring = "0.0.26.Final"

val nativeNettyModules =
Seq(
Expand Down Expand Up @@ -55,7 +55,7 @@ lazy val core = project
"io.netty" % "netty-codec-http" % netty,
"io.netty" % "netty-handler" % netty,
"org.http4s" %% "http4s-core" % http4sVersion,
"org.typelevel" %% "cats-effect" % "3.5.4"
"org.typelevel" %% "cats-effect" % "3.5.7"
)
)

Expand All @@ -71,11 +71,11 @@ lazy val server = project
"org.eclipse.jetty.http2" % "jetty-http2-client-transport" % jetty % Test,
"org.http4s" %% "http4s-server" % http4sVersion,
"org.http4s" %% "http4s-dsl" % http4sVersion % Test,
"ch.qos.logback" % "logback-classic" % "1.4.5" % Test,
"ch.qos.logback" % "logback-classic" % "1.2.13" % Test,
"org.scalameta" %% "munit" % munit % Test,
"org.scalameta" %% "munit-scalacheck" % munitScalaCheck % Test,
"org.http4s" %% "http4s-circe" % http4sVersion % Test,
"org.http4s" %% "http4s-jdk-http-client" % "1.0.0-M9" % Test,
"org.http4s" %% "http4s-jdk-http-client" % "1.0.0-M10" % Test,
"org.typelevel" %% "munit-cats-effect" % "2.0.0" % Test
),
libraryDependencySchemes += "org.typelevel" %% "munit-cats-effect" % VersionScheme.Always, // "early-semver",
Expand All @@ -99,7 +99,8 @@ lazy val client = project
("com.github.monkeywie" % "proxyee" % "1.7.6" % Test)
.excludeAll("io.netty")
.excludeAll("org.bouncycastle"),
"com.github.bbottema" % "java-socks-proxy-server" % "4.1.1" % Test,
("com.github.bbottema" % "java-socks-proxy-server" % "4.1.2" % Test)
.exclude("org.slf4j", "slf4j-api"),
"org.scalameta" %% "munit" % munit % Test,
"ch.qos.logback" % "logback-classic" % "1.2.13" % Test,
"org.typelevel" %% "munit-cats-effect" % "2.0.0" % Test
Expand Down
30 changes: 30 additions & 0 deletions client/src/main/scala/org/http4s/netty/client/Http4sHandler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@ import cats.effect.std.Dispatcher
import cats.syntax.all._
import io.netty.channel._
import io.netty.handler.codec.http.HttpResponse
import io.netty.handler.codec.http2.DefaultHttp2PingFrame
import io.netty.handler.codec.http2.Http2Error
import io.netty.handler.codec.http2.Http2GoAwayFrame
import io.netty.handler.codec.http2.Http2PingFrame
import io.netty.handler.codec.http2.Http2SettingsFrame
import io.netty.handler.timeout.IdleState
import io.netty.handler.timeout.IdleStateEvent
import org.http4s._
import org.http4s.netty.client.Http4sHandler.Http2GoAwayError
import org.http4s.netty.client.Http4sHandler.logger

import java.io.IOException
import java.nio.channels.ClosedChannelException
import java.util.concurrent.CancellationException
import scala.concurrent.ExecutionContext
import scala.concurrent.Future
import scala.concurrent.TimeoutException
Expand Down Expand Up @@ -178,6 +185,26 @@ private[netty] class Http4sHandler[F[_]](dispatcher: Dispatcher[F])(implicit F:
}
}
}
case x: Http2PingFrame =>
if (!x.ack()) {
ctx.writeAndFlush(new DefaultHttp2PingFrame(x.content(), true))
} else {
logger.debug("got pong")
}
case x: Http2SettingsFrame =>
// What should we do with this?
logger.debug(s"got settings, ${x.settings()}")
case x: Http2GoAwayFrame =>
val http2Error = Http2Error.valueOf(x.errorCode())
http2Error match {
case Http2Error.CANCEL =>
onException(
ctx.channel(),
new CancellationException(s"Stream ${x.lastStreamId()} cancelled from server"))
case _ =>
val exception = Http2GoAwayError(http2Error, x.lastStreamId())
onException(ctx.channel(), exception)
}
case _ =>
super.channelRead(ctx, msg)
}
Expand Down Expand Up @@ -238,4 +265,7 @@ private[netty] class Http4sHandler[F[_]](dispatcher: Dispatcher[F])(implicit F:

private object Http4sHandler {
private val logger = org.log4s.getLogger

final case class Http2GoAwayError(error: Http2Error, lastStreamId: Int)
extends Exception(s"http/2 recieved GoAway with ${error.name} and streamId=${lastStreamId}")
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.10.2
sbt.version=1.10.7
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.17.3")
addSbtPlugin("org.http4s" % "sbt-http4s-org" % "0.17.6")

0 comments on commit 9bab88e

Please sign in to comment.