Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scala-library to 2.13.13 in series/0.23 #854

Merged
merged 4 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package client
import cats.effect._
import cats.effect.kernel.Resource
import cats.effect.std.Dispatcher
import cats.implicits.catsSyntaxApplicativeId
import cats.syntax.all._
import fs2.Stream
import io.netty.channel.ChannelHandlerContext
Expand Down Expand Up @@ -136,9 +135,9 @@ trait BlazeClientBase extends CatsEffectSuite {
)

val server: IOFixture[ServerScaffold[IO]] =
ResourceSuiteLocalFixture("http", makeScaffold(2, false))
ResourceSuiteLocalFixture("http", makeScaffold(2, secure = false))
val secureServer: IOFixture[ServerScaffold[IO]] =
ResourceSuiteLocalFixture("https", makeScaffold(1, true))
ResourceSuiteLocalFixture("https", makeScaffold(1, secure = true))

override val munitFixtures = List(
server,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ class BlazeClientSuite extends BlazeClientBase {
}
override def onRequestEnd(ctx: ChannelHandlerContext, request: HttpRequest): Unit = ()
})
ServerScaffold[IO](1, false, HandlersToNettyAdapter[IO](handlers)).use { server =>
ServerScaffold[IO](1, secure = false, HandlersToNettyAdapter[IO](handlers)).use { server =>
val address = server.addresses.head
val name = address.host
val port = address.port
Expand All @@ -343,7 +343,7 @@ class BlazeClientSuite extends BlazeClientBase {
}
override def onRequestEnd(ctx: ChannelHandlerContext, request: HttpRequest): Unit = ()
})
ServerScaffold[IO](1, false, HandlersToNettyAdapter[IO](handlers)).use { server =>
ServerScaffold[IO](1, secure = false, HandlersToNettyAdapter[IO](handlers)).use { server =>
val address = server.addresses.head
val name = address.host
val port = address.port
Expand All @@ -366,7 +366,7 @@ class BlazeClientSuite extends BlazeClientBase {
}
override def onRequestEnd(ctx: ChannelHandlerContext, request: HttpRequest): Unit = ()
})
ServerScaffold[IO](1, false, HandlersToNettyAdapter[IO](handlers)).use { server =>
ServerScaffold[IO](1, secure = false, HandlersToNettyAdapter[IO](handlers)).use { server =>
val address = server.addresses.head
val name = address.host
val port = address.port
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import cats.effect._
import cats.effect.kernel.Deferred
import cats.effect.std.Dispatcher
import cats.effect.std.Queue
import cats.syntax.all._
import fs2.Stream
import munit.CatsEffectSuite
import org.http4s.BuildInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private[http4s] class CachingChunkWriter[F[_]](
pipe.channelWrite(hbuff)
}
} else if (!chunk.isEmpty) {
writeBodyChunk(chunk, true).flatMap { _ =>
writeBodyChunk(chunk, flush = true).flatMap { _ =>
writeTrailer(pipe, trailer)
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private[http4s] class FlushingChunkWriter[F[_]](pipe: TailStage[ByteBuffer], tra
else pipe.channelWrite(encodeChunk(chunk, Nil))

protected def writeEnd(chunk: Chunk[Byte]): Future[Boolean] = {
if (!chunk.isEmpty) writeBodyChunk(chunk, true).flatMap { _ =>
if (!chunk.isEmpty) writeBodyChunk(chunk, flush = true).flatMap { _ =>
writeTrailer(pipe, trailer)
}
else writeTrailer(pipe, trailer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ package util

import cats.effect.Async
import org.http4s.blaze.util.Execution.directec
import org.typelevel.scalaccompat.annotation._

import scala.concurrent.Future
import scala.util.Failure
import scala.util.Success

@nowarn213("msg=package object inheritance is deprecated")
object `package` extends ParasiticExecutionContextCompat {

/** Used as a terminator for streams built from repeatEval */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,25 @@ class Http1WriterSpec extends CatsEffectSuite with DispatcherIOFixture {
runNonChunkedTests(
"CachingChunkWriter",
implicit dispatcher =>
tail => new CachingChunkWriter[IO](tail, IO.pure(Headers.empty), 1024 * 1024, false),
tail =>
new CachingChunkWriter[IO](
tail,
IO.pure(Headers.empty),
1024 * 1024,
omitEmptyContentLength = false,
),
)

runNonChunkedTests(
"CachingStaticWriter",
implicit dispatcher =>
tail => new CachingChunkWriter[IO](tail, IO.pure(Headers.empty), 1024 * 1024, false),
tail =>
new CachingChunkWriter[IO](
tail,
IO.pure(Headers.empty),
1024 * 1024,
omitEmptyContentLength = false,
),
)

def builder(tail: TailStage[ByteBuffer])(implicit D: Dispatcher[IO]): FlushingChunkWriter[IO] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ private[blaze] class Http1ServerStage[F[_]](
rr,
parser.minorVersion(),
closeOnFinish,
false,
omitEmptyContentLength = false,
)

// TODO: pool shifting: https://github.com/http4s/http4s/blob/main/core/src/main/scala/org/http4s/internal/package.scala#L45
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private[http4s] trait WebSocketSupport[F[_]] extends Http1ServerStage[F] {
.prepend(new WSFrameAggregator)
.prepend(new WebSocketDecoder(maxBufferSize.getOrElse(0)))

this.replaceTail(segment, true)
this.replaceTail(segment, startup = true)

case Failure(t) => fatalError(t, "Error writing Websocket upgrade response")
}(executionContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,26 @@ class BlazeServerMtlsSpec extends CatsEffectSuite {
*/
blazeServer(TLSParameters(needClientAuth = true).toSSLParameters)
.test("Server should send mTLS request correctly") { server =>
assertEquals(get(server, "/dummy", true), "CN=Test,OU=Test,O=Test,L=CA,ST=CA,C=US")
assertEquals(get(server, "/dummy"), "CN=Test,OU=Test,O=Test,L=CA,ST=CA,C=US")
}
blazeServer(TLSParameters(needClientAuth = true).toSSLParameters)
.test("Server should fail for invalid client auth") { server =>
assertNotEquals(get(server, "/dummy", false), "CN=Test,OU=Test,O=Test,L=CA,ST=CA,C=US")
assertNotEquals(
get(server, "/dummy", clientAuth = false),
"CN=Test,OU=Test,O=Test,L=CA,ST=CA,C=US",
)
}

/** Test "requested" auth mode
*/
blazeServer(TLSParameters(wantClientAuth = true).toSSLParameters)
.test("Server should send mTLS request correctly with optional auth") { server =>
assertEquals(get(server, "/dummy", true), "CN=Test,OU=Test,O=Test,L=CA,ST=CA,C=US")
assertEquals(get(server, "/dummy"), "CN=Test,OU=Test,O=Test,L=CA,ST=CA,C=US")
}

blazeServer(TLSParameters(wantClientAuth = true).toSSLParameters)
.test("Server should send mTLS request correctly without clientAuth") { server =>
assertEquals(get(server, "/noauth", false), "success")
assertEquals(get(server, "/noauth", clientAuth = false), "success")
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BlazeServerSuite extends CatsEffectSuite {
val s =
new ScheduledThreadPoolExecutor(
2,
threadFactory(i => s"blaze-server-suite-scheduler-$i", true),
threadFactory(i => s"blaze-server-suite-scheduler-$i", daemon = true),
)
s.setKeepAliveTime(10L, TimeUnit.SECONDS)
s.allowCoreThreadTimeOut(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ class Http1ServerStageSpec extends CatsEffectSuite {

fixture.test("Http1ServerStage: routes should Add a date header") { tw =>
val routes = HttpRoutes
.of[IO] { case req =>
IO.pure(Response(body = req.body))
.of[IO] { case r =>
IO.pure(Response(body = r.body))
}
.orNotFound

Expand All @@ -298,8 +298,8 @@ class Http1ServerStageSpec extends CatsEffectSuite {
fixture.test("Http1ServerStage: routes should Honor an explicitly added date header") { tw =>
val dateHeader = Date(HttpDate.Epoch)
val routes = HttpRoutes
.of[IO] { case req =>
IO.pure(Response(body = req.body).withHeaders(dateHeader))
.of[IO] { case r =>
IO.pure(Response(body = r.body).withHeaders(dateHeader))
}
.orNotFound

Expand All @@ -319,8 +319,8 @@ class Http1ServerStageSpec extends CatsEffectSuite {
"Http1ServerStage: routes should Handle routes that echos full request body for non-chunked"
) { tw =>
val routes = HttpRoutes
.of[IO] { case req =>
IO.pure(Response(body = req.body))
.of[IO] { case r =>
IO.pure(Response(body = r.body))
}
.orNotFound

Expand All @@ -341,8 +341,8 @@ class Http1ServerStageSpec extends CatsEffectSuite {
"Http1ServerStage: routes should Handle routes that consumes the full request body for non-chunked"
) { tw =>
val routes = HttpRoutes
.of[IO] { case req =>
req.as[String].map { s =>
.of[IO] { case r =>
r.as[String].map { s =>
Response().withEntity("Result: " + s)
}
}
Expand Down Expand Up @@ -422,8 +422,8 @@ class Http1ServerStageSpec extends CatsEffectSuite {
"Http1ServerStage: routes should Handle routes that runs the request body for non-chunked"
) { tw =>
val routes = HttpRoutes
.of[IO] { case req =>
req.body.compile.drain *> IO.pure(Response().withEntity("foo"))
.of[IO] { case r =>
r.body.compile.drain *> IO.pure(Response().withEntity("foo"))
}
.orNotFound

Expand All @@ -447,8 +447,8 @@ class Http1ServerStageSpec extends CatsEffectSuite {
fixture.test("Http1ServerStage: routes should Not die when two requests come in back to back") {
tw =>
val routes = HttpRoutes
.of[IO] { case req =>
IO.pure(Response(body = req.body))
.of[IO] { case r =>
IO.pure(Response(body = r.body))
}
.orNotFound

Expand All @@ -473,8 +473,8 @@ class Http1ServerStageSpec extends CatsEffectSuite {
"Http1ServerStage: routes should Handle using the request body as the response body"
) { tw =>
val routes = HttpRoutes
.of[IO] { case req =>
IO.pure(Response(body = req.body))
.of[IO] { case r =>
IO.pure(Response(body = r.body))
}
.orNotFound

Expand Down Expand Up @@ -504,17 +504,17 @@ class Http1ServerStageSpec extends CatsEffectSuite {

private val routes2 = HttpRoutes
.of[IO] {
case req if req.pathInfo === path"/foo" =>
case r if r.pathInfo === path"/foo" =>
for {
_ <- req.body.compile.drain
hs <- req.trailerHeaders
_ <- r.body.compile.drain
hs <- r.trailerHeaders
resp <- Ok(hs.headers.mkString)
} yield resp

case req if req.pathInfo === path"/bar" =>
case r if r.pathInfo === path"/bar" =>
for {
// Don't run the body
hs <- req.trailerHeaders
hs <- r.trailerHeaders
resp <- Ok(hs.headers.mkString)
} yield resp
}
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import com.typesafe.tools.mima.core._
import Dependencies._

val Scala212 = "2.12.19"
val Scala213 = "2.13.12"
val Scala213 = "2.13.13"
val Scala3 = "3.3.3"
val http4sVersion = "0.23.25"
val munitCatsEffectVersion = "2.0.0-M4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ class BufferToolsSuite extends FunSuite {
assert(BufferTools.areDirectOrEmpty(buffs))
}

private def getBuffers(count: Int): Array[ByteBuffer] = getBuffersBase(count, false)
private def getBuffers(count: Int): Array[ByteBuffer] = getBuffersBase(count, direct = false)

private def getDirect(count: Int): Array[ByteBuffer] = getBuffersBase(count, true)
private def getDirect(count: Int): Array[ByteBuffer] = getBuffersBase(count, direct = true)

private def getBuffersBase(count: Int, direct: Boolean): Array[ByteBuffer] =
(0 until count).map { _ =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object StreamClient extends IOApp {

class HttpClient[F[_]](implicit F: Async[F], S: StreamUtils[F]) {
implicit val jsonFacade: Facade[Json] =
new io.circe.jawn.CirceSupportParser(None, false).facade
new io.circe.jawn.CirceSupportParser(None, allowDuplicateKeys = false).facade

def run: F[Unit] =
BlazeClientBuilder[F].stream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private abstract class HeaderAggregatingFrameListener(
else if (buffer.remaining > localSettings.maxHeaderListSize)
headerSizeError(buffer.remaining, streamId)
else if (endHeaders) {
val r = headerDecoder.decode(buffer, streamId, true)
val r = headerDecoder.decode(buffer, streamId, endHeaders = true)
if (!r.success) r
else {
val hs = headerDecoder.finish()
Expand All @@ -129,7 +129,7 @@ private abstract class HeaderAggregatingFrameListener(
if (localSettings.maxHeaderListSize < buffer.remaining)
headerSizeError(buffer.remaining, streamId)
else if (endHeaders) {
val r = headerDecoder.decode(buffer, streamId, true)
val r = headerDecoder.decode(buffer, streamId, endHeaders = true)
if (!r.success) r
else {
val hs = headerDecoder.finish()
Expand Down Expand Up @@ -157,7 +157,7 @@ private abstract class HeaderAggregatingFrameListener(
val newBuffer = BufferTools.concatBuffers(hInfo.buffer, buffer)

if (endHeaders) {
val r = headerDecoder.decode(newBuffer, streamId, true)
val r = headerDecoder.decode(newBuffer, streamId, endHeaders = true)
if (!r.success) r
else {
val hs = headerDecoder.finish()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ final class ALPNServerSelector(
try {
val protocol = Option(engine.getApplicationProtocol()).getOrElse(selector(Set.empty))
val b = builder(protocol)
this.replaceTail(b, true)
this.replaceTail(b, startup = true)
()
} catch {
case NonFatal(t) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ final class ServerPriorKnowledgeHandshaker(
// We may have some extra data that we need to inject into the pipeline
newTail = newTail.prepend(new OneMessageStage[ByteBuffer](remainder))

this.replaceTail(newTail, true)
this.replaceTail(newTail, startup = true)

// The session starts itself up and drives the pipeline
new ConnectionImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ConnectionImplSuite extends BlazeTestSuite {
val stream = connection.newOutboundStream()
val tail = new BasicTail[StreamFrame]("tail")
LeafBuilder(tail).base(stream)
tail.channelWrite(HeadersFrame(Priority.NoPriority, true, Seq.empty))
tail.channelWrite(HeadersFrame(Priority.NoPriority, endStream = true, Seq.empty))

assertEquals(connection.quality, 0.5)
}
Expand Down Expand Up @@ -242,7 +242,7 @@ class ConnectionImplSuite extends BlazeTestSuite {
connection.invokeGoAway(connection.idManager.lastOutboundStream, err)
head.consumeOutboundByteBuf() // need to consume the GOAWAY

val w2 = basicStage.channelWrite(DataFrame(true, BufferTools.emptyBuffer))
val w2 = basicStage.channelWrite(DataFrame(endStream = true, BufferTools.emptyBuffer))
assertEquals(w2.value, Some(Success(())))
}

Expand All @@ -255,7 +255,7 @@ class ConnectionImplSuite extends BlazeTestSuite {
val stage = connection.newOutboundStream()
val basicStage = new BasicTail[StreamFrame]("")
LeafBuilder(basicStage).base(stage)
val f = basicStage.channelWrite(HeadersFrame(Priority.NoPriority, true, Seq.empty))
val f = basicStage.channelWrite(HeadersFrame(Priority.NoPriority, endStream = true, Seq.empty))

f.value match {
case Some(Failure(t: Http2StreamException)) =>
Expand Down Expand Up @@ -299,7 +299,7 @@ class ConnectionImplSuite extends BlazeTestSuite {
connection.invokeDrain(4.seconds)
head.consumeOutboundByteBuf() // need to consume the GOAWAY

val w2 = basicStage.channelWrite(DataFrame(true, BufferTools.emptyBuffer))
val w2 = basicStage.channelWrite(DataFrame(endStream = true, BufferTools.emptyBuffer))
assertEquals(w2.value, Some(Success(())))
}

Expand All @@ -312,7 +312,7 @@ class ConnectionImplSuite extends BlazeTestSuite {
val stage = connection.newOutboundStream()
val basicStage = new BasicTail[StreamFrame]("")
LeafBuilder(basicStage).base(stage)
val f = basicStage.channelWrite(HeadersFrame(Priority.NoPriority, true, Seq.empty))
val f = basicStage.channelWrite(HeadersFrame(Priority.NoPriority, endStream = true, Seq.empty))
f.value match {
case Some(Failure(t: Http2StreamException)) =>
assertEquals(t.code, Http2Exception.REFUSED_STREAM.code)
Expand Down
Loading