0xAX/weber — pull request #136 by slogsdon (2013-12-28 15:59:13+00:00)
Title: [Proposal] Allow gzip compression

Here is a proposal for allowing `gzip` compression on responses, which makes use of the `cowboy` option `compress`.

To enable, use a `config.ex` file similar to this:

```elixir
defmodule Config do
def config do
[webserver:
[http_host: "localhost",
http_port: 8080,
acceptors: 100,
ssl: false,
cacertfile_path: "",
certfile_path: "",
keyfile_path: "",
use_gzip: true
],
ws:
[ws_port: 8080,
ws_mod: :Handler
],
use_internationalization: false,
localization:
[default_locale: :en_US,
use_locales: [:en_US]
],
use_sessions: false,
session:
[max_age: 1440
],
log: true
]
end
end
```

To disable, one can either change the `use_gzip` option above to `false` or remove it completely.

Older projects without this change will be able to update Weber to include this change without any modifications to their code, as the change sets `compress` option for `cowboy` to false by default.

I did not include unit tests for this PR as it seems fairly trivial. If they are required/desired, please let me know, and I will see what I can do.

If this is merged, I can also send a PR to the `gh-pages` branch to update the configuration section of the [documentation](http://0xax.github.io/weber/#documentation).