=htc #16821 support UTF-8 characters in field values
This commit is contained in:
parent
d7b45e0fc3
commit
4a14feef08
3 changed files with 7 additions and 6 deletions
|
|
@ -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() }
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue