mohiva/play-html-compressor — pull request #20 by akkie (2014-07-26 14:28:45+00:00)
Title: [play-2.3] HTML-compressor hangs on processing static HTML assets

play 2.3.1
play-html-compressor 0.3

In short: static HTML files (in `/public/` dir) are compressed by play-html-compressor (it's ok), but NO EOF is sent to client. File content is sent to client, but no close connection, no EOF, etc. Connection just hangs opened forever.

**Disabling play-html-compressor in `Global.scala` fixes the problem.**
There are NO errors nor in play/project/application.log, neither in play console.

Steps to reproduce:
1) Create HTML-file somewhere in `/public/` directory of some play23 project:
```
$ cd somePlay23ProjectRoot/
$ cat > public/dialog.html << EOF

Custom dialog

Input some text:
Close window

EOF
```
2) Enable html compression filter in `Global.scala`. Compression settings does not matter:
```
object Global extends WithFilters(MyHTMLCompressorFilter()) {
...
}
object MyHTMLCompressorFilter {
def apply() = {
val compressor = new HtmlCompressor()
compressor.setPreserveLineBreaks(true)
compressor.setRemoveComments(false)
compressor.setRemoveIntertagSpaces(true)
compressor.setRemoveHttpProtocol(false)
compressor.setRemoveHttpsProtocol(false)
new HTMLCompressorFilter(compressor)
}
}
```
3) Make GET request for static html file:
```
$ curl -v localhost:9000/assets/dialog.html
* Hostname was NOT found in DNS cache
* Trying ::1...
* Connected to localhost (::1) port 9000 (#0)
> GET /assets/dialog.html HTTP/1.1
> User-Agent: curl/7.37.0
> Host: localhost:9000
> Accept: */*
>
< HTTP/1.1 200 OK
< Cache-Control: no-cache
< Content-Length: 213
< Content-Type: text/html; charset=utf-8
< Date: Wed, 02 Jul 2014 12:48:07 GMT
< ETag: "1cff498d002d3c3aaef8bc7c10abac73dec3d7ba"
< Last-Modified: Thu, 26 Jun 2014 15:18:42 GMT
<

Custom dialog

Input some text:
Close window

--- AND IT JUST HANGS HERE FOREVER, NO EOF ---
--- AND IT JUST HANGS HERE FOREVER, NO EOF ---
--- AND IT JUST HANGS HERE FOREVER, NO EOF ---
```

If make request via nginx, something like this occurs:
```
$ curl https://.../assets/dialog.html
curl: (18) transfer closed with 9 bytes remaining to read

Custom dialog

Input some text: Close window

%
```