-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Http2ServerDisableResetSpec.scala
- Loading branch information
Showing
3 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
.../src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ServerDisableResetSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* license agreements; and to You under the Apache License, version 2.0: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* This file is part of the Apache Pekko project, which was derived from Akka. | ||
*/ | ||
|
||
/* | ||
* Copyright (C) 2018-2022 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package org.apache.pekko.http.impl.engine.http2 | ||
|
||
import org.apache.pekko | ||
Check warning on line 16 in http2-tests/src/test/scala/org/apache/pekko/http/impl/engine/http2/Http2ServerDisableResetSpec.scala GitHub Actions / Compile and test (2.12, 11)
|
||
import org.apache.pekko.http.impl.engine.http2.Http2Protocol.FrameType | ||
import org.apache.pekko.http.impl.engine.http2.framing.FrameRenderer | ||
import org.apache.pekko.util.ByteStringBuilder | ||
|
||
import java.nio.ByteOrder | ||
|
||
/** | ||
* This tests the http2 server support for rapid resets can be disabled. | ||
*/ | ||
class Http2ServerDisableResetSpec extends Http2SpecWithMaterializer(""" | ||
pekko.http.server.remote-address-header = on | ||
pekko.http.server.http2.log-frames = on | ||
pekko.http.server.http2.resets-throttle-interval = 0s | ||
""") { | ||
override def failOnSevereMessages: Boolean = true | ||
|
||
"The Http/2 server implementation" should { | ||
"not cancel connection during rapid reset attack (throttle disabled)".inAssertAllStagesStopped( | ||
new TestSetup with RequestResponseProbes { | ||
implicit val bigEndian: ByteOrder = ByteOrder.BIG_ENDIAN | ||
val bb = new ByteStringBuilder | ||
bb.putInt(0) | ||
val rstFrame = FrameRenderer.renderFrame(FrameType.RST_STREAM, ByteFlag.Zero, 1, bb.result()) | ||
val longFrame = Seq.fill(1000)(rstFrame).reduce(_ ++ _) | ||
network.sendBytes(longFrame) | ||
}) | ||
} | ||
} |