diff --git a/akka-http-core/src/main/scala/akka/http/impl/model/parser/CommonRules.scala b/akka-http-core/src/main/scala/akka/http/impl/model/parser/CommonRules.scala index 41d6f3cbd9..38399432fb 100644 --- a/akka-http-core/src/main/scala/akka/http/impl/model/parser/CommonRules.scala +++ b/akka-http-core/src/main/scala/akka/http/impl/model/parser/CommonRules.scala @@ -42,7 +42,7 @@ private[parser] trait CommonRules { this: Parser with StringBuilding ⇒ def qdtext = rule { `qdtext-base` | `obs-text` } - def `obs-text` = rule { "\u0080" - "\u00FF" } + def `obs-text` = rule { "\u0080" - "\uFFFE" } def `quoted-pair` = rule { '\\' ~ (`quotable-base` | `obs-text`) ~ appendSB() } diff --git a/akka-http-core/src/test/scala/akka/http/impl/model/parser/HttpHeaderSpec.scala b/akka-http-core/src/test/scala/akka/http/impl/model/parser/HttpHeaderSpec.scala index 5bb0ef48e8..67a555a26f 100644 --- a/akka-http-core/src/test/scala/akka/http/impl/model/parser/HttpHeaderSpec.scala +++ b/akka-http-core/src/test/scala/akka/http/impl/model/parser/HttpHeaderSpec.scala @@ -589,9 +589,10 @@ class HttpHeaderSpec extends FreeSpec with Matchers { parse("Foo", "ba\u0000r") shouldEqual ParsingResult.Error(ErrorInfo( "Illegal HTTP header value: Invalid input '\\u0000', expected field-value-char, FWS or 'EOI' (line 1, column 3)", "ba\u0000r\n ^")) - parse("Flood-Resistant-Hammerdrill", "árvíztűrő ütvefúrógép") shouldEqual ParsingResult.Error(ErrorInfo( - "Illegal HTTP header value: Invalid input 'ű', expected field-value-char, FWS or 'EOI' (line 1, column 7)", - "árvíztűrő ütvefúrógép\n ^")) + } + "allow UTF8 characters in RawHeaders" in { + parse("Flood-Resistant-Hammerdrill", "árvíztűrő ütvefúrógép") shouldEqual + ParsingResult.Ok(RawHeader("Flood-Resistant-Hammerdrill", "árvíztűrő ütvefúrógép"), Nil) } "compress value whitespace into single spaces and trim" in { parse("Foo", " b a \tr\t") shouldEqual ParsingResult.Ok(RawHeader("Foo", "b a r"), Nil) diff --git a/akka-http-tests/src/test/scala/akka/http/scaladsl/unmarshalling/MultipartUnmarshallersSpec.scala b/akka-http-tests/src/test/scala/akka/http/scaladsl/unmarshalling/MultipartUnmarshallersSpec.scala index 288d9bc7b7..023e601397 100644 --- a/akka-http-tests/src/test/scala/akka/http/scaladsl/unmarshalling/MultipartUnmarshallersSpec.scala +++ b/akka-http-tests/src/test/scala/akka/http/scaladsl/unmarshalling/MultipartUnmarshallersSpec.scala @@ -261,7 +261,7 @@ class MultipartUnmarshallersSpec extends FreeSpec with Matchers with BeforeAndAf |Content-Dispo""".stripMarginWithNewline("\r\n") }, ByteString { - """sition: form-data; name="userfile"; filename="test.dat" + """sition: form-data; name="userfile"; filename="test€.dat" |Content-Type: application/pdf |Content-Transfer-Encoding: binary |Content-Additional-1: anything @@ -273,7 +273,7 @@ class MultipartUnmarshallersSpec extends FreeSpec with Matchers with BeforeAndAf }) }.to[Multipart.FormData].flatMap(_.toStrict(1.second)) should haveParts( Multipart.FormData.BodyPart.Strict("email", HttpEntity(`application/octet-stream`, ByteString("test@there.com"))), - Multipart.FormData.BodyPart.Strict("userfile", HttpEntity(`application/pdf`, ByteString("filecontent")), Map("filename" -> "test.dat"), + Multipart.FormData.BodyPart.Strict("userfile", HttpEntity(`application/pdf`, ByteString("filecontent")), Map("filename" -> "test€.dat"), List( RawHeader("Content-Transfer-Encoding", "binary"), RawHeader("Content-Additional-1", "anything"),