Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/dependency-graph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install sbt
uses: sbt/setup-sbt@66fb4376e81982c7d92a4074170846fff88e2e30 # v1.5.0
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7
- uses: scalacenter/sbt-dependency-submission@f43202114d7522a4b233e052f82c2eea8d658134 # v3.2.1
with:
modules-ignore: pekko-http-tests_3 pekko-http-docs_3
4 changes: 2 additions & 2 deletions .github/workflows/headers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
java-version: 8

- name: Install sbt
uses: sbt/setup-sbt@66fb4376e81982c7d92a4074170846fff88e2e30 # v1.5.0
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Cache Coursier cache
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # v8.1.0
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1

- name: Enable jvm-opts
run: cp .jvmopts-ci .jvmopts
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/link-validator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ jobs:
java-version: 8

- name: Install sbt
uses: sbt/setup-sbt@66fb4376e81982c7d92a4074170846fff88e2e30 # v1.5.0
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Cache Coursier cache
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # v8.1.0
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1

- name: Setup Coursier
uses: coursier/setup-action@fd1707a76b027efdfb66ca79318b4d29b72e5a02 # v3.0.0
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ jobs:
java-version: ${{ matrix.JDK }}

- name: Install sbt
uses: sbt/setup-sbt@66fb4376e81982c7d92a4074170846fff88e2e30 # v1.5.0
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Cache Coursier cache
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # v8.1.0
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1

- name: Cache Build Target
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: project/**/target
key: build-target-${{ hashFiles('**/*.sbt', 'project/build.properties', 'project/**/*.scala') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-1.0-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:
java-version: 8

- name: Install sbt
uses: sbt/setup-sbt@66fb4376e81982c7d92a4074170846fff88e2e30 # v1.5.0
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Cache Coursier cache
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # v8.1.0
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1

- name: Build Documentation
run: |-
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-1.0-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
java-version: 8

- name: Install sbt
uses: sbt/setup-sbt@66fb4376e81982c7d92a4074170846fff88e2e30 # v1.5.0
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Cache Coursier cache
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # v8.1.0
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1

- name: Install graphviz
run: sudo apt-get install -y graphviz
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-1.1-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:
java-version: 8

- name: Install sbt
uses: sbt/setup-sbt@66fb4376e81982c7d92a4074170846fff88e2e30 # v1.5.0
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Cache Coursier cache
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # v8.1.0
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1

- name: Build Documentation
run: |-
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-1.1-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
java-version: 8

- name: Install sbt
uses: sbt/setup-sbt@66fb4376e81982c7d92a4074170846fff88e2e30 # v1.5.0
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Cache Coursier cache
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # v8.1.0
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1

- name: Install graphviz
run: sudo apt-get install -y graphviz
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-1.2-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ jobs:
java-version: 8

- name: Install sbt
uses: sbt/setup-sbt@v1
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Cache Coursier cache
uses: coursier/cache-action@v6
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1

- name: Build Documentation
run: |-
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-1.3-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:
java-version: 8

- name: Install sbt
uses: sbt/setup-sbt@6c68d2fe8dfbc0a0534d70101baa2e0420e1a506 # v1.1.9
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Cache Coursier cache
uses: coursier/cache-action@v6
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1

- name: Build Documentation
run: |-
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ jobs:
java-version: 8

- name: Install sbt
uses: sbt/setup-sbt@66fb4376e81982c7d92a4074170846fff88e2e30 # v1.5.0
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Cache Coursier cache
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # v8.1.0
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1

- name: Install graphviz
run: sudo apt-get install -y graphviz
Expand Down Expand Up @@ -74,10 +74,10 @@ jobs:
java-version: 8

- name: Install sbt
uses: sbt/setup-sbt@66fb4376e81982c7d92a4074170846fff88e2e30 # v1.5.0
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Cache Coursier cache
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # v8.1.0
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1

- name: Build Documentation
run: |-
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stage-release-candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ jobs:
java-version: 8

- name: Install sbt
uses: sbt/setup-sbt@66fb4376e81982c7d92a4074170846fff88e2e30 # v1.5.0
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Install Graphviz
run: |-
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/validate-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ jobs:
java-version: 8

- name: Install sbt
uses: sbt/setup-sbt@66fb4376e81982c7d92a4074170846fff88e2e30 # v1.5.0
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Cache Coursier cache
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # v8.1.0
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1

- name: Cache Build Target
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: project/**/target
key: build-target-${{ hashFiles('**/*.sbt', 'project/build.properties', 'project/**/*.scala') }}
Expand Down Expand Up @@ -86,13 +86,13 @@ jobs:
java-version: ${{ matrix.JDK }}

- name: Install sbt
uses: sbt/setup-sbt@66fb4376e81982c7d92a4074170846fff88e2e30 # v1.5.0
uses: sbt/setup-sbt@8feba82adc7f01ddcf8165b86f778bdb5b82cebc # v1.5.7

- name: Cache Coursier cache
uses: coursier/cache-action@90c37294538be80a558fd665531fcdc2b467b475 # v8.1.0
uses: coursier/cache-action@95e5b1029b6b86e7bac033ee44a0697d8a527d2d # v8.1.1

- name: Cache Build Target
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: project/**/target
key: build-target-${{ hashFiles('**/*.sbt', 'project/build.properties', 'project/**/*.scala') }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import pekko.http.scaladsl.settings.{
import pekko.stream.{ BidiShape, Graph, StreamTcpException, ThrottleMode }
import pekko.stream.TLSProtocol._
import pekko.stream.scaladsl.{ BidiFlow, Flow, Keep, Source }
import pekko.util.ByteString
import pekko.util.OptionVal
import pekko.util.{ ByteString, OptionVal }
import pekko.util.Helpers.toRootLowerCase

import scala.concurrent.duration.{ Duration, FiniteDuration }
import scala.concurrent.{ ExecutionContext, Future }
Expand Down Expand Up @@ -226,7 +226,7 @@ private[http] object Http2Blueprint {
}

private[http2] def frameTypeAliasToFrameTypeName(frameType: String): Option[String] = {
frameType.toLowerCase match {
toRootLowerCase(frameType) match {
case "reset" => Some("RstStreamFrame")
case "headers" => Some("HeadersFrame")
case "continuation" => Some("ContinuationFrame")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import pekko.http.scaladsl.settings.ParserSettings.{
IllegalResponseHeaderValueProcessingMode
}
import pekko.util.ConstantFun
import pekko.util.Helpers.toRootLowerCase
import com.typesafe.config.Config

import scala.collection.JavaConverters._
Expand Down Expand Up @@ -115,7 +116,7 @@ object ParserSettingsImpl extends SettingsCompanionImpl[ParserSettingsImpl]("pek
Uri.ParsingMode(c.getString("uri-parsing-mode")),
CookieParsingMode(c.getString("cookie-parsing-mode")),
c.getBoolean("illegal-header-warnings"),
c.getStringList("ignore-illegal-header-for").asScala.map(_.toLowerCase).toSet,
c.getStringList("ignore-illegal-header-for").asScala.map(toRootLowerCase).toSet,
ErrorLoggingVerbosity(c.getString("error-logging-verbosity")),
IllegalResponseHeaderNameProcessingMode(c.getString("illegal-response-header-name-processing-mode")),
IllegalResponseHeaderValueProcessingMode(c.getString("illegal-response-header-value-processing-mode")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

package org.apache.pekko.http.javadsl

import java.util.Locale
import java.util.Optional

import org.apache.pekko
import pekko.annotation.{ DoNotInherit, InternalApi }
import pekko.http.javadsl.model.Uri
import pekko.util.Helpers.toRootLowerCase
import pekko.util.OptionConverters._

@DoNotInherit
Expand Down Expand Up @@ -71,7 +71,7 @@ object ConnectHttp {
}

private def toHost(uriHost: Uri, port: Int): ConnectHttp = {
val s = uriHost.scheme.toLowerCase(Locale.ROOT)
val s = toRootLowerCase(uriHost.scheme)
if (s == "https") new ConnectHttpsImpl(uriHost.host.address, effectivePort(s, port), context = Optional.empty())
else new ConnectHttpImpl(uriHost.host.address, effectivePort(s, port))
}
Expand Down Expand Up @@ -114,7 +114,7 @@ object ConnectHttp {
}

private def toHostHttps(uriHost: Uri, port: Int): ConnectWithHttps = {
val s = uriHost.scheme.toLowerCase(Locale.ROOT)
val s = toRootLowerCase(uriHost.scheme)
require(s == "" || s == "https", "toHostHttps used with non https scheme! Was: " + uriHost)
new ConnectHttpsImpl(uriHost.host.address, effectivePort("https", port), context = Optional.empty())
}
Expand All @@ -125,7 +125,7 @@ object ConnectHttp {
}

private def effectivePort(scheme: String, port: Int): Int = {
val s = scheme.toLowerCase(Locale.ROOT)
val s = toRootLowerCase(scheme)
if (port >= 0) port
else if (s == "https" || s == "wss") 443
else if (s == "http" || s == "ws") 80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import java.{ util => ju }

import pekko.annotation.DoNotInherit
import pekko.http.impl.util.JavaMapping.Implicits._
import pekko.util.Helpers.toRootLowerCase

import scala.annotation.varargs
import scala.collection.JavaConverters._
Expand Down Expand Up @@ -90,7 +91,7 @@ abstract class ParserSettings private[pekko] () extends BodyPartParser.Settings
self.copy(includeSslSessionAttribute = newValue)
def withModeledHeaderParsing(newValue: Boolean): ParserSettings = self.copy(modeledHeaderParsing = newValue)
def withIgnoreIllegalHeaderFor(newValue: List[String]): ParserSettings =
self.copy(ignoreIllegalHeaderFor = newValue.map(_.toLowerCase).toSet)
self.copy(ignoreIllegalHeaderFor = newValue.map(toRootLowerCase).toSet)

// special ---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
package org.apache.pekko.http.scaladsl.model

import StatusCodes.ClientError
import org.apache.pekko.annotation.InternalApi
import org.apache.pekko
import pekko.annotation.InternalApi
import pekko.util.Helpers.toRootLowerCase

/**
* Two-level model of error information.
Expand All @@ -28,7 +30,7 @@ final class ErrorInfo(
val errorHeaderName: String = "") extends scala.Product with scala.Equals with java.io.Serializable {
def withSummary(newSummary: String) = copy(summary = newSummary)
def withSummaryPrepended(prefix: String) = withSummary(if (summary.isEmpty) prefix else prefix + ": " + summary)
def withErrorHeaderName(headerName: String) = new ErrorInfo(summary, detail, headerName.toLowerCase)
def withErrorHeaderName(headerName: String) = new ErrorInfo(summary, detail, toRootLowerCase(headerName))
def withFallbackSummary(fallbackSummary: String) = if (summary.isEmpty) withSummary(fallbackSummary) else this
def formatPretty = if (summary.isEmpty) detail else if (detail.isEmpty) summary else summary + ": " + detail
def format(withDetail: Boolean): String = if (withDetail) formatPretty else summary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import pekko.http.impl.model.parser.{ CharacterClasses, HeaderParser }
import pekko.http.javadsl.{ model => jm }
import pekko.http.scaladsl.model.headers._
import pekko.util.OptionVal
import pekko.util.Helpers.toRootLowerCase

import scala.collection.immutable

Expand Down Expand Up @@ -91,7 +92,7 @@ object HttpHeader {
val parser = new HeaderParser(value, settings)
parser.`header-field-value`.run() match {
case Success(preProcessedValue) =>
HeaderParser.parseFull(name.toLowerCase, preProcessedValue, settings) match {
HeaderParser.parseFull(toRootLowerCase(name), preProcessedValue, settings) match {
case HeaderParser.Success(header) => ParsingResult.Ok(header, Nil)
case HeaderParser.Failure(info) =>
val errors = info.withSummaryPrepended(s"Illegal HTTP header '$name'") :: Nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import pekko.annotation.DoNotInherit
import pekko.http.impl.util._
import pekko.http.javadsl.{ model => jm }
import pekko.http.impl.util.JavaMapping.Implicits._
import pekko.util.Helpers.toRootLowerCase

/**
* A MediaType describes the type of the content of an HTTP message entity.
Expand Down Expand Up @@ -74,7 +75,7 @@ sealed abstract class MediaType(_mainType: String, _subType: String) extends jm.
case _ => false
}

override def hashCode(): Int = value.toLowerCase.hashCode
override def hashCode(): Int = toRootLowerCase(value).hashCode

/**
* JAVA API
Expand Down Expand Up @@ -327,12 +328,12 @@ object MediaTypes extends ObjectRegistry[(String, String), MediaType] {

private[this] var extensionMap = Map.empty[String, MediaType]

def forExtensionOption(ext: String): Option[MediaType] = extensionMap.get(ext.toLowerCase)
def forExtension(ext: String): MediaType = extensionMap.getOrElse(ext.toLowerCase, `application/octet-stream`)
def forExtensionOption(ext: String): Option[MediaType] = extensionMap.get(toRootLowerCase(ext))
def forExtension(ext: String): MediaType = extensionMap.getOrElse(toRootLowerCase(ext), `application/octet-stream`)

private def registerFileExtensions[T <: MediaType](mediaType: T): T = {
mediaType.fileExtensions.foreach { ext =>
val lcExt = ext.toLowerCase
val lcExt = toRootLowerCase(ext)
require(!extensionMap.contains(lcExt),
s"Extension '$ext' clash: media-types '${extensionMap(lcExt)}' and '$mediaType'")
extensionMap = extensionMap.updated(lcExt, mediaType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import pekko.http.javadsl.{ model => jm }
import pekko.http.impl.model.parser.UriParser
import pekko.http.impl.model.parser.CharacterClasses._
import pekko.http.impl.util._
import pekko.util.Helpers.toRootLowerCase
import Uri._

/**
Expand Down Expand Up @@ -868,7 +869,7 @@ object Uri {
} else if (allLower) -1
else -2
verify() match {
case -2 => scheme.toLowerCase
case -2 => toRootLowerCase(scheme)
case -1 => scheme
case ix => fail(s"Invalid URI scheme, unexpected character at pos $ix ('${scheme.charAt(ix)}')")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import pekko.http.impl.util._
import pekko.http.javadsl.model
import pekko.http.scaladsl.model._
import pekko.http.scaladsl.{ settings => js }
import pekko.util.Helpers.toRootLowerCase
import pekko.util.OptionConverters._
import com.typesafe.config.Config

Expand Down Expand Up @@ -123,7 +124,7 @@ abstract class ParserSettings private[pekko] () extends pekko.http.javadsl.setti
self.copy(includeSslSessionAttribute = newValue)
override def withModeledHeaderParsing(newValue: Boolean): ParserSettings = self.copy(modeledHeaderParsing = newValue)
override def withIgnoreIllegalHeaderFor(newValue: List[String]): ParserSettings =
self.copy(ignoreIllegalHeaderFor = newValue.map(_.toLowerCase).toSet)
self.copy(ignoreIllegalHeaderFor = newValue.map(toRootLowerCase).toSet)

// overloads for idiomatic Scala use
def withUriParsingMode(newValue: Uri.ParsingMode): ParserSettings = self.copy(uriParsingMode = newValue)
Expand Down
Loading
Loading