Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop content-length header in compressed decorator #148

Merged
merged 1 commit into from
Nov 3, 2024
Merged
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 build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ trait CaskMainModule extends CaskModule {
object test extends ScalaTests with TestModule.Utest{
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0"
ivy"com.lihaoyi::requests::0.9.0"
)
}
def moduleDeps = Seq(cask.util.jvm(crossScalaVersion))
Expand Down
8 changes: 6 additions & 2 deletions cask/src/cask/decorators/compress.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ class compress extends cask.RawDecorator{
wrap.flush()
wrap.close()
}
override def headers = v.data.headers
// Since we don't know the length of the gzipped data ahead of time,
// we drop the content length header.
override def headers = v.data.headers.filter(_._1 != "Content-Length")
} -> Seq("Content-Encoding" -> "gzip")
}else if (acceptEncodings.exists(_.toLowerCase == "deflate")){
new Response.Data {
Expand All @@ -29,7 +31,9 @@ class compress extends cask.RawDecorator{
v.data.write(wrap)
wrap.flush()
}
override def headers = v.data.headers
// Since we don't know the length of the compressed data ahead of
// time, we drop the content length header.
override def headers = v.data.headers.filter(_._1 != "Content-Length")
} -> Seq("Content-Encoding" -> "deflate")
}else v.data -> Nil
Response(
Expand Down
2 changes: 1 addition & 1 deletion example/compress/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/compress2/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/compress3/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/cookies/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/decorated/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/decorated2/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/decoratedContext/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object app extends ScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/endpoints/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/formJsonPost/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0"
ivy"com.lihaoyi::requests::0.9.0"
)
}
}
2 changes: 1 addition & 1 deletion example/httpMethods/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
def forkArgs = Seq("--add-opens=java.base/java.net=ALL-UNNAMED")
}
Expand Down
2 changes: 1 addition & 1 deletion example/minimalApplication/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/minimalApplication2/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/queryParams/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/redirectAbort/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/scalatags/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/staticFiles/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trait AppModule extends CrossScalaModule{ app =>

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)

def forkWorkingDir = app.millSourcePath
Expand Down
2 changes: 1 addition & 1 deletion example/staticFiles2/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trait AppModule extends CrossScalaModule{ app =>

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)

def forkWorkingDir = app.millSourcePath
Expand Down
2 changes: 1 addition & 1 deletion example/todo/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/todoApi/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/todoDb/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/twirl/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ trait AppModule extends CrossScalaModule with mill.twirllib.TwirlModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/variableRoutes/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
)
}
}
2 changes: 1 addition & 1 deletion example/websockets/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
ivy"org.asynchttpclient:async-http-client:2.12.3"
)
}
Expand Down
2 changes: 1 addition & 1 deletion example/websockets2/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
ivy"org.asynchttpclient:async-http-client:2.12.3"
)
}
Expand Down
2 changes: 1 addition & 1 deletion example/websockets3/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
ivy"org.asynchttpclient:async-http-client:2.12.3"
)
}
Expand Down
2 changes: 1 addition & 1 deletion example/websockets4/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trait AppModule extends CrossScalaModule{

def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.8.4",
ivy"com.lihaoyi::requests::0.8.0",
ivy"com.lihaoyi::requests::0.9.0",
ivy"org.asynchttpclient:async-http-client:2.12.3"
)
}
Expand Down
Loading