crystal-helmet
所属分类:collect
开发工具:Crystal
文件大小:0KB
下载次数:0
上传日期:2017-10-23 20:34:24
上 传 者:
sh-1993
说明: 节点头盔模块到Crystal编程语言的端口,
(a port of the Node Helmet module to the Crystal programming language,)
文件列表:
.travis.yml (18, 2017-10-23)
HISTORY.md (677, 2017-10-23)
LICENSE.txt (1081, 2017-10-23)
shard.yml (149, 2017-10-23)
spec/ (0, 2017-10-23)
spec/dnsprefetchcontrolhandler_spec.cr (1181, 2017-10-23)
spec/frameguardhandler_spec.cr (1565, 2017-10-23)
spec/internetexplorernoopenhandler_spec.cr (423, 2017-10-23)
spec/nosniffhandler_spec.cr (398, 2017-10-23)
spec/spec_helper.cr (401, 2017-10-23)
spec/stricttransportsecurityhandler_spec.cr (2723, 2017-10-23)
spec/xssfilterhandler_spec.cr (3863, 2017-10-23)
src/ (0, 2017-10-23)
src/helmet.cr (21, 2017-10-23)
src/helmet/ (0, 2017-10-23)
src/helmet/dnsprefetchcontrolhandler.cr (1422, 2017-10-23)
src/helmet/frameguardhandler.cr (3100, 2017-10-23)
src/helmet/internetexplorernoopenhandler.cr (989, 2017-10-23)
src/helmet/nosniffhandler.cr (1157, 2017-10-23)
src/helmet/stricttransportsecurityhandler.cr (2000, 2017-10-23)
src/helmet/version.cr (38, 2017-10-23)
src/helmet/xssfilterhandler.cr (1710, 2017-10-23)
# Helmet
[![Build Status](https://travis-ci.org/EvanHahn/crystal-helmet.svg?branch=master)](https://travis-ci.org/EvanHahn/crystal-helmet)
Helmet helps you secure your Crystal web apps by setting various HTTP headers. *It's not a silver bullet*, but it can help!
This is a port of the [Node.js version of Helmet](https://github.com/helmetjs/helmet).
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
helmet:
github: EvanHahn/crystal-helmet
```
## Usage
```crystal
require "http/server"
require "helmet"
server = HTTP::Server.new("0.0.0.0", 8080,
[
Helmet::DNSPrefetchControllerHandler.new,
Helmet::FrameGuardHandler.new,
Helmet::InternetExplorerNoOpenHandler.new,
Helmet::NoSniffHandler.new,
Helmet::StrictTransportSecurityHandler.new(7.day),
Helmet::XSSFilterHandler.new,
]) do |context|
context.response.content_type = "text/plain"
context.response.print "Hello world!"
end
server.listen
```
Helmet is really just a collection of smaller handlers that set HTTP headers. See them listed in the example above and in [the documentation](https://evanhahn.github.io/crystal-helmet/).
## Contributing
1. Fork it (https://github.com/EvanHahn/crystal-helmet/fork)
2. Create your branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add XYZ'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new pull request
## Contributors
- [Evan Hahn](https://evanhahn.com) - creator, maintainer
- [Du Ba Thach](https://bthachdev.github.io/) - [#3](https://github.com/EvanHahn/crystal-helmet/pull/3)
近期下载者:
相关文件:
收藏者: