Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Merge pull request #495 from BalajiSi/balaji
Browse files Browse the repository at this point in the history
= http: Fix Location header parsing to accept relative URIs
  • Loading branch information
sirthias committed Sep 9, 2013
2 parents 9b91010 + 1c2f1ae commit 2470440
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private[parser] trait SimpleHeaders {
}

def `*Location` = rule {
oneOrMore(Text) ~> { uri Location(Uri.parseAbsolute(uri)) } ~ EOI
oneOrMore(Text) ~> { uri Location(Uri(uri)) } ~ EOI
}

def `*Proxy-Authenticate` = rule {
Expand Down
5 changes: 3 additions & 2 deletions spray-http/src/test/scala/spray/http/HttpHeaderSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ class HttpHeaderSpec extends Specification {
"Last-Modified: Wed, 13 Jul 2011 08:12:31 GMT" ! example(`Last-Modified`(DateTime(2011, 7, 13, 8, 12, 31)))_ ^
p ^
"Location: https://spray.io/secure" ! example(Location(Uri("https://spray.io/secure")))_ ^
"Location: /en-us/default.aspx" ! example(Location(Uri("/en-us/default.aspx")))_ ^
"Location: https://spray.io/{sec}" ! example(Location(Uri("https://spray.io/{sec}")), fix(_).replace("{", "%7B").replace("}", "%7D"))_ ^
"Location: https://spray.io/ sec" ! errorExample(ErrorInfo("Illegal HTTP header 'Location': Illegal absolute " +
"URI, unexpected character ' ' at position 17", "\nhttps://spray.io/ sec\n ^\n"))_ ^
"Location: https://spray.io/ sec" ! errorExample(ErrorInfo("Illegal HTTP header 'Location': Illegal URI " +
"reference, unexpected character ' ' at position 17", "\nhttps://spray.io/ sec\n ^\n"))_ ^
p ^
"Origin: http://spray.io" ! example(Origin(Uri("http://spray.io")))_ ^
p ^
Expand Down

0 comments on commit 2470440

Please sign in to comment.