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

Detect HTTPS interception #1430

Merged
merged 15 commits into from
Feb 17, 2017
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
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ one collaborator who did not open the pull request before merging. This will
help ensure high code quality as new collaborators are added to the project.

Read [CodeReviewComments](https://github.com/golang/go/wiki/CodeReviewComments)
on the Go wiki for an idea of what we look for in good, clean Go code.
on the Go wiki for an idea of what we look for in good, clean Go code, and
check out [what Linus suggests](https://gist.github.com/matthewhudson/1475276)
for good commit messages.



Expand Down
2 changes: 2 additions & 0 deletions caddy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// 1. Set the AppName and AppVersion variables.
// 2. Call LoadCaddyfile() to get the Caddyfile.
// Pass in the name of the server type (like "http").
// Make sure the server type's package is imported
// (import _ "github.com/mholt/caddy/caddyhttp").
// 3. Call caddy.Start() to start Caddy. You get back
// an Instance, on which you can call Restart() to
// restart it or Stop() to stop it.
Expand Down
11 changes: 11 additions & 0 deletions caddyhttp/httpserver/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,14 @@ func (c Context) Files(name string) ([]string, error) {

return names, nil
}

// IsMITM returns true if it seems likely that the TLS connection
// is being intercepted.
func (c Context) IsMITM() bool {
if val, ok := c.Req.Context().Value(CtxKey("mitm")).(bool); ok {
return val
}
return false
}

type CtxKey string
Loading