Compare commits

..

30 Commits

Author SHA1 Message Date
Matthew Holt 28e1f7c562 Version 1.0.2 2019-08-13 14:37:58 -06:00
Matthew Holt 914f39d784 Adjust address parsing for Go 1.12.8's breaking changes
See https://github.com/golang/go/commit/3226f2d492963d361af9dfc6714ef141ba606713
and https://github.com/golang/go/issues/29098
2019-08-13 14:37:45 -06:00
linquize 0ba427a6f4 websocket: Enhancements, message types, and tests (#2359)
* websocket: Should reset respawn parameter when processing next config entry

* websocket: add message types: lines, text, binary

* websocket: Add unit test

* Add websocket sample files
2019-07-19 13:29:49 -06:00
Matthew Holt 7fab1b15c8 readme: Fix tests badge 2019-07-19 11:28:59 -06:00
Christian Muehlhaeuser 3856ad03b0 Used goimports to fix import order (#2682)
Keeps the list sorted and prevents future merge conflicts.
2019-07-18 22:05:49 -06:00
George Hartzell d411b7d087 Add doc re running as non-root user on FreeBSD (#2655)
Add a README.md in `dist/init/freebsd` that describes how to configure
the system so that `caddy` can be run without root privileges.
2019-07-18 15:19:21 -06:00
George Hartzell 580f7677ad Use syslog to manage caddy std{out,err} on FreeBSD (#2652)
* Use syslog to manage caddy std{out,err} on FreeBSD

There is no good way to rotate the logfile created by the previous
FreeBSD rc.d script (it's the result of redirecting std{out,err} and
is held open by the shell).

This solves the problem by sending caddy's std{out,err} stream to
syslog, using the daemon command's builtin functionality.

It replaces the old `caddy_logfile` rc.conf variable with
`caddy_syslog_facility` (which defaults to 'local7') and
`caddy_syslog_level` (which defaults to 'notice').

By default, these messages will end up in /var/log/messages but can
be redirected as documented in the script's comments.

* Add info about rotating log with newsyslog

If you create a caddy specific logfile in `/var/log`, you should
rotate it.

This adds a bit of info to the dist/init/freebsd/README.md about
rotating that log file with newsyslog.
2019-07-18 13:58:40 -06:00
rouzier 120811e7f7 staticfiles: Support pre-compressed zstd, make etag content-encoding-aware (#2626)
* Add support for precompressed zstd files (rfc8478)

* Avoid the hash lookup for the file extension.

* Only calculate Etag once
2019-07-18 13:50:01 -06:00
aspeteRakete 43458bda46 Updated systemd caddy.service (#2620)
According to https://github.com/systemd/systemd/blob/v241/NEWS#L2799
The Directive ReadWriteDirectories= has been renamed to ReadWritePaths=
in 241.
2019-07-18 13:46:00 -06:00
William Wang a9ccaa1ae5 add recaptcha plugin (#2664) 2019-07-11 13:37:27 -06:00
Matthew Holt f6ee100bae Update notes for v1.0.1 2019-07-02 13:08:31 -06:00
Matthew Holt f5720fecd6 Change all import paths: mholt/caddy -> caddyserver/caddy
Includes updating go.mod to use new module path
2019-07-02 12:49:20 -06:00
Matthew Holt 0b2e054839 tls: Deprecate 'max_certs' in favor of 'ask'; use latest CertMagic 2019-07-01 11:43:27 -06:00
Damir Vandic 6f01928512 Fix graceful shutdown (#2618)
Currently, the instance waitgroup is decremented twice in `startServers()`: once when `Serve()` is finished and once when `ServePacket()` is finished. However, with a graceful shutdown, `Serve()` returns before the server has actually finished shutting down all active connections. This patch increases the wait group by one when the server is shut down so that the program only exits when all the server instances have finished serving their connections.
2019-06-23 16:24:13 -06:00
Matthew Holt 6115a462c7 mod: Use CertMagic v0.6.1 2019-06-21 08:03:17 -06:00
Matthew Holt 5f9cba0f19 caddyfile: Move metrics into caddy package 2019-06-21 08:02:53 -06:00
Matthew Holt 05b3938556 Minor fixes to tests 2019-06-19 17:02:34 -06:00
Matthew Holt 62b4553f7d tls: Disable on-demand TLS when random config is chosen
A random config is intended to be used only for solving TLS-ALPN
challenges; so we have to be sure to disable on-demand TLS so that
arbitrary names can't request certificates with another name's
on-demand config.
2019-06-19 16:57:45 -06:00
Matthew Holt ad20323b52 Refactor clustering setup code 2019-06-19 16:57:45 -06:00
Matthew Holt 721c100bb0 Use CertMagic's HTTP and HTTPS port variable
Slightly inconvenient because it uses int type and we use string, but
oh well. This fixes a bug related to setting -http-port and -https-port
flags which weren't being used by CertMagic in some cases.
2019-06-19 16:57:45 -06:00
Matthew Holt 6720bdfb55 Clean up certmagic locks on signaled process exit
This should help prevent hanging in some cases when the process is
restarted and tries to obtain or renew a certificate, for example, but
the lock remains from the previous shutdown (which was during the same
operation). Only works if the process is cleanly shut down with a signal
it can capture.
2019-06-19 16:57:45 -06:00
shouya 0c626fbc2e tls: Allow client auth configs if CA filenames match (#2648)
* verify client certs

* move client cert compatible checker to an independent function

* unexport client cert compatible checker

* rename functions and add comment

* gofmt code

* add test

* add back the comment
2019-06-19 11:25:56 -06:00
Daniel af82141808 caddyhttp: Add 'permission' plugin directive (#2639) 2019-06-12 10:15:17 -06:00
Jared Ririe d11b648137 caddytls: Fix goroutine leak when restarting Caddy (#2644)
Each time the Caddyfile reloads and Caddy is restarted,
caddytls.NewConfig starts a goroutine for cleaning the
certificate storage. This goroutine ranges over a time.Ticker
channel; although Stop is called on this ticker, Stop does
not close the underlying channel so the goroutine never exits.

This change adds an additional channel that is listened to
in the certificate cleaning goroutine so it can exit
on restarts.
2019-06-11 15:24:35 -06:00
Matthew Holt 14a8ffedd8 Fix panic serving index file if HTTP request is malformed 2019-05-27 08:12:19 -06:00
Matthew Holt b5906135c7 Move PR template in attempt to fix (sigh)
https://github.community/t5/How-to-use-Git-and-GitHub/Our-pull-request-templates-aren-t-showing-up-for-any-PRs/m-p/22958
2019-05-27 08:11:33 -06:00
AndreKR 4bad5c79be Simple rewrite regex captures (#2592)
* More informative rewrite test output

When running rewrite tests, the output in case of a test failure now
includes not only the rewritten URLs but also the from URL.

* Move re-escaping to regexpMatches

This commit moves the code to post-process the match replacements from
ComplexRule to regexpMatches, so it can later be re-used for SimpleRule.

Also changes the comment in an attempt to better explain the reasoning
behind that code.

The required strings.Replacer is now built only once.

* Support regex captures in simple rewrite rules

Closes #2586
2019-05-24 12:00:27 -06:00
Łukasz Nowak 81430e4aff gzip: Add .wasm (WebAssembly files) (#2624) 2019-05-24 09:59:06 -06:00
Anthony Plunkett c238b72d5d readme: clarify about Go file to build Caddy (#2611) 2019-05-13 22:17:36 -06:00
Kurt Jung a2ed91bc45 httpserver: Add pubsub plugin (#2589) 2019-04-26 12:32:43 -06:00
158 changed files with 1772 additions and 506 deletions
+8 -8
View File
@@ -23,7 +23,7 @@ Other menu items:
### Contributing code
You can have a direct impact on the project by helping with its code. To contribute code to Caddy, open a [pull request](https://github.com/mholt/caddy/pulls) (PR). If you're new to our community, that's okay: **we gladly welcome pull requests from anyone, regardless of your native language or coding experience.** You can get familiar with Caddy's code base by using [code search at Sourcegraph](https://sourcegraph.com/github.com/mholt/caddy/-/search).
You can have a direct impact on the project by helping with its code. To contribute code to Caddy, open a [pull request](https://github.com/caddyserver/caddy/pulls) (PR). If you're new to our community, that's okay: **we gladly welcome pull requests from anyone, regardless of your native language or coding experience.** You can get familiar with Caddy's code base by using [code search at Sourcegraph](https://sourcegraph.com/github.com/caddyserver/caddy/-/search).
We hold contributions to a high standard for quality :bowtie:, so don't be surprised if we ask for revisions—even if it seems small or insignificant. Please don't take it personally. :wink: If your change is on the right track, we can guide you to make it mergable.
@@ -52,9 +52,9 @@ We often grant [collaborator status](#collaborator-instructions) to contributors
Contributing to Go projects on GitHub is fun and easy. We recommend the following workflow:
1. [Fork this repo](https://github.com/mholt/caddy). This makes a copy of the code you can write to.
1. [Fork this repo](https://github.com/caddyserver/caddy). This makes a copy of the code you can write to.
2. If you don't already have this repo (mholt/caddy.git) repo on your computer, get it with `go get github.com/mholt/caddy/caddy`.
2. If you don't already have this repo (mholt/caddy.git) repo on your computer, get it with `go get github.com/caddyserver/caddy/caddy`.
3. Tell git that it can push the mholt/caddy.git repo to your fork by adding a remote: `git remote add myfork https://github.com/you/caddy.git`
@@ -62,7 +62,7 @@ Contributing to Go projects on GitHub is fun and easy. We recommend the followin
5. Push your changes to your fork: `git push myfork`
6. [Create a pull request](https://github.com/mholt/caddy/pull/new/master) to merge your changes into mholt/caddy @ master. (Click "compare across forks" and change the head fork.)
6. [Create a pull request](https://github.com/caddyserver/caddy/pull/new/master) to merge your changes into mholt/caddy @ master. (Click "compare across forks" and change the head fork.)
This workflow is nice because you don't have to change import paths. You can get fancier by using different branches if you want.
@@ -71,7 +71,7 @@ This workflow is nice because you don't have to change import paths. You can get
Caddy can do more with plugins! Anyone can write a plugin. Plugins are Go libraries that get compiled into Caddy, extending its feature set. They can add directives to the Caddyfile, change how the Caddyfile is loaded, and even implement new server types (e.g. HTTP, DNS). When it's ready, you can submit your plugin to the Caddy website so others can download it.
[Learn how to write and submit a plugin](https://github.com/mholt/caddy/wiki) on the wiki. You should also share and discuss your plugin idea [on the forums](https://caddy.community) to have people test it out. We don't use the Caddy issue tracker for plugins.
[Learn how to write and submit a plugin](https://github.com/caddyserver/caddy/wiki) on the wiki. You should also share and discuss your plugin idea [on the forums](https://caddy.community) to have people test it out. We don't use the Caddy issue tracker for plugins.
### Getting help using Caddy
@@ -83,7 +83,7 @@ Many people on the forums could benefit from your experience and expertise, too.
### Reporting bugs
Like every software, Caddy has its flaws. If you find one, [search the issues](https://github.com/mholt/caddy/issues) to see if it has already been reported. If not, [open a new issue](https://github.com/mholt/caddy/issues/new) and describe the bug, and somebody will look into it! (This repository is only for Caddy, not plugins.)
Like every software, Caddy has its flaws. If you find one, [search the issues](https://github.com/caddyserver/caddy/issues) to see if it has already been reported. If not, [open a new issue](https://github.com/caddyserver/caddy/issues/new) and describe the bug, and somebody will look into it! (This repository is only for Caddy, not plugins.)
**You can help stop bugs in their tracks!** Speed up the patch by identifying the bug in the code. This can sometimes be done by adding `fmt.Println()` statements (or similar) in relevant code paths to narrow down where the problem may be. It's a good way to [introduce yourself to the Go language](https://tour.golang.org), too.
@@ -96,9 +96,9 @@ Please be kind. :smile: Remember that Caddy comes at no cost to you, and you're
### Suggesting features
First, [search to see if your feature has already been requested](https://github.com/mholt/caddy/issues). If it has, you can add a :+1: reaction to vote for it. If your feature idea is new, open an issue to request the feature. You don't have to follow the bug template for feature requests. Please describe your idea thoroughly so that we know how to implement it! Really vague requests may not be helpful or actionable and without clarification will have to be closed.
First, [search to see if your feature has already been requested](https://github.com/caddyserver/caddy/issues). If it has, you can add a :+1: reaction to vote for it. If your feature idea is new, open an issue to request the feature. You don't have to follow the bug template for feature requests. Please describe your idea thoroughly so that we know how to implement it! Really vague requests may not be helpful or actionable and without clarification will have to be closed.
While we really do value your requests and implement many of them, not all features are a good fit for Caddy. Most of those [make good plugins](https://github.com/mholt/caddy/wiki), though, which can be made by anyone! But if a feature is not in the best interest of the Caddy project or its users in general, we may politely decline to implement it into Caddy core.
While we really do value your requests and implement many of them, not all features are a good fit for Caddy. Most of those [make good plugins](https://github.com/caddyserver/caddy/wiki), though, which can be made by anyone! But if a feature is not in the best interest of the Caddy project or its users in general, we may politely decline to implement it into Caddy core.
### Improving documentation
+16 -16
View File
@@ -4,13 +4,13 @@
<h3 align="center">Every Site on HTTPS <!-- Serve Confidently --></h3>
<p align="center">Caddy is a general-purpose HTTP/2 web server that serves HTTPS by default.</p>
<p align="center">
<a href="https://dev.azure.com/mholt-dev/Caddy/_build?definitionId=1"><img src="https://img.shields.io/azure-devops/build/mholt-dev/afec6074-9842-457f-98cf-69df6adbbf2e/1/master.svg?label=cross-platform%20tests"></a>
<a href="https://godoc.org/github.com/mholt/caddy"><img src="https://img.shields.io/badge/godoc-reference-blue.svg"></a>
<a href="https://goreportcard.com/report/mholt/caddy"><img src="https://goreportcard.com/badge/github.com/mholt/caddy"></a>
<a href="https://dev.azure.com/mholt-dev/Caddy/_build?definitionId=5"><img src="https://img.shields.io/azure-devops/build/mholt-dev/afec6074-9842-457f-98cf-69df6adbbf2e/5/master.svg?label=cross-platform%20tests"></a>
<a href="https://godoc.org/github.com/caddyserver/caddy"><img src="https://img.shields.io/badge/godoc-reference-blue.svg"></a>
<a href="https://goreportcard.com/report/caddyserver/caddy"><img src="https://goreportcard.com/badge/github.com/caddyserver/caddy"></a>
<br>
<a href="https://twitter.com/caddyserver" title="@caddyserver on Twitter"><img src="https://img.shields.io/badge/twitter-@caddyserver-55acee.svg" alt="@caddyserver on Twitter"></a>
<a href="https://caddy.community" title="Caddy Forum"><img src="https://img.shields.io/badge/community-forum-ff69b4.svg" alt="Caddy Forum"></a>
<a href="https://sourcegraph.com/github.com/mholt/caddy?badge" title="Caddy on Sourcegraph"><img src="https://sourcegraph.com/github.com/mholt/caddy/-/badge.svg" alt="Caddy on Sourcegraph"></a>
<a href="https://sourcegraph.com/github.com/caddyserver/caddy?badge" title="Caddy on Sourcegraph"><img src="https://sourcegraph.com/github.com/caddyserver/caddy/-/badge.svg" alt="Caddy on Sourcegraph"></a>
</p>
<p align="center">
<a href="https://caddyserver.com/download">Download</a> ·
@@ -22,7 +22,7 @@
Caddy is a **production-ready** open-source web server that is fast, easy to use, and makes you more productive.
Available for Windows, Mac, Linux, BSD, Solaris, and [Android](https://github.com/mholt/caddy/wiki/Running-Caddy-on-Android).
Available for Windows, Mac, Linux, BSD, Solaris, and [Android](https://github.com/caddyserver/caddy/wiki/Running-Caddy-on-Android).
<p align="center">
<b>Thanks to our special sponsor:</b>
@@ -68,7 +68,7 @@ Altogether, Caddy can do things other web servers simply cannot do. Its features
Caddy binaries have no dependencies and are available for every platform. Get Caddy any of these ways:
- **[Download page](https://caddyserver.com/download)** (RECOMMENDED) allows you to customize your build in the browser
- **[Latest release](https://github.com/mholt/caddy/releases/latest)** for pre-built, vanilla binaries
- **[Latest release](https://github.com/caddyserver/caddy/releases/latest)** for pre-built, vanilla binaries
- **[AWS Marketplace](https://aws.amazon.com/marketplace/pp/B07J1WNK75?qid=1539015041932&sr=0-1&ref_=srh_res_product_title&cl_spe=C)** makes it easy to deploy directly to your cloud environment. <a href="https://aws.amazon.com/marketplace/pp/B07J1WNK75?qid=1539015041932&sr=0-1&ref_=srh_res_product_title&cl_spe=C" target="_blank">
<img src="https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png" alt="Get Caddy on the AWS Marketplace" height="25"/></a>
@@ -81,7 +81,7 @@ To build from source you need **[Git](https://git-scm.com/downloads)** and **[Go
<!-- TODO: This env variable will not be required starting with Go 1.13 -->
1. Set the transitional environment variable for Go modules: `export GO111MODULE=on`
2. Run `go get github.com/mholt/caddy/caddy`
2. Run `go get github.com/caddyserver/caddy/caddy`
Caddy will be installed to your `$GOPATH/bin` folder.
@@ -93,12 +93,12 @@ There is no need to modify the Caddy code to build it with plugins. We will crea
<!-- TODO: This env variable will not be required starting with Go 1.13 -->
1. Set the transitional environment variable for Go modules: `export GO111MODULE=on`
2. Create a new folder anywhere, and put this Go file into it, then import the plugins you want to include:
2. Create a new folder anywhere and within create a Go file (extension `.go`) with the contents below, adjusting to import the plugins you want to include:
```go
package main
import (
"github.com/mholt/caddy/caddy/caddymain"
"github.com/caddyserver/caddy/caddy/caddymain"
// plug in plugins here, for example:
// _ "import/path/here"
@@ -111,14 +111,14 @@ func main() {
}
```
3. `go mod init caddy`
4. Run `go get github.com/mholt/caddy`
4. Run `go get github.com/caddyserver/caddy`
5. `go install` will then create your binary at `$GOPATH/bin`, or `go build` will put it in the current directory.
**To install Caddy's source code for development:**
<!-- TODO: This env variable will not be required starting with Go 1.13 -->
1. Set the transitional environment variable for Go modules: `export GO111MODULE=on`
2. Run `git clone https://github.com/mholt/caddy.git` in any folder (doesn't have to be in GOPATH).
2. Run `git clone https://github.com/caddyserver/caddy.git` in any folder (doesn't have to be in GOPATH).
You can make changes to the source code from that clone and checkout any commit or tag you wish to develop on.
@@ -182,7 +182,7 @@ Caddy is production-ready if you find it to be a good fit for your site and work
**Running as root:** We advise against this. You can still listen on ports < 1024 on Linux using setcap like so: `sudo setcap cap_net_bind_service=+ep ./caddy`
The Caddy project does not officially maintain any system-specific integrations nor suggest how to administer your own system. But your download file includes [unofficial resources](https://github.com/mholt/caddy/tree/master/dist/init) contributed by the community that you may find helpful for running Caddy in production.
The Caddy project does not officially maintain any system-specific integrations nor suggest how to administer your own system. But your download file includes [unofficial resources](https://github.com/caddyserver/caddy/tree/master/dist/init) contributed by the community that you may find helpful for running Caddy in production.
How you choose to run Caddy is up to you. Many users are satisfied with `nohup caddy &`. Others use `screen`. Users who need Caddy to come back up after reboots either do so in the script that caused the reboot, add a command to an init script, or configure a service with their OS.
@@ -191,17 +191,17 @@ If you have questions or concerns about Caddy' underlying crypto implementations
## Contributing
**[Join our forum](https://caddy.community) where you can chat with other Caddy users and developers!** To get familiar with the code base, try [Caddy code search on Sourcegraph](https://sourcegraph.com/github.com/mholt/caddy/)!
**[Join our forum](https://caddy.community) where you can chat with other Caddy users and developers!** To get familiar with the code base, try [Caddy code search on Sourcegraph](https://sourcegraph.com/github.com/caddyserver/caddy/)!
Please see our [contributing guidelines](https://github.com/mholt/caddy/blob/master/.github/CONTRIBUTING.md) for instructions. If you want to write a plugin, check out the [developer wiki](https://github.com/mholt/caddy/wiki).
Please see our [contributing guidelines](https://github.com/caddyserver/caddy/blob/master/.github/CONTRIBUTING.md) for instructions. If you want to write a plugin, check out the [developer wiki](https://github.com/caddyserver/caddy/wiki).
We use GitHub issues and pull requests only for discussing bug reports and the development of specific changes. We welcome all other topics on the [forum](https://caddy.community)!
If you want to contribute to the documentation, please [submit an issue](https://github.com/mholt/caddy/issues/new) describing the change that should be made.
If you want to contribute to the documentation, please [submit an issue](https://github.com/caddyserver/caddy/issues/new) describing the change that should be made.
### Good First Issue
If you are looking for somewhere to start and would like to help out by working on an existing issue, take a look at our [`Good First Issue`](https://github.com/mholt/caddy/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) tag
If you are looking for somewhere to start and would like to help out by working on an existing issue, take a look at our [`Good First Issue`](https://github.com/caddyserver/caddy/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) tag
Thanks for making Caddy -- and the Web -- better!
+13 -3
View File
@@ -20,7 +20,7 @@
// 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").
// (import _ "github.com/caddyserver/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.
@@ -43,8 +43,8 @@ import (
"sync"
"time"
"github.com/mholt/caddy/caddyfile"
"github.com/mholt/caddy/telemetry"
"github.com/caddyserver/caddy/caddyfile"
"github.com/caddyserver/caddy/telemetry"
)
// Configurable application parameters
@@ -600,6 +600,12 @@ func ValidateAndExecuteDirectives(cdyfile Input, inst *Instance, justValidate bo
return err
}
for _, sb := range sblocks {
for dir := range sb.Tokens {
telemetry.AppendUnique("directives", dir)
}
}
inst.context = stype.NewContext(inst)
if inst.context == nil {
return fmt.Errorf("server type %s produced a nil Context", stypeName)
@@ -882,6 +888,10 @@ func Stop() error {
}
inst := instances[0]
instancesMu.Unlock()
// Increase the instance waitgroup so that the last wait() call in
// caddymain/run.go blocks until this server instance has shut down
inst.wg.Add(1)
defer inst.wg.Done()
if err := inst.Stop(); err != nil {
log.Printf("[ERROR] Stopping %s: %v", inst.serverType, err)
}
+6 -6
View File
@@ -29,16 +29,16 @@ import (
"strconv"
"strings"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyfile"
"github.com/caddyserver/caddy/caddytls"
"github.com/caddyserver/caddy/telemetry"
"github.com/google/uuid"
"github.com/klauspost/cpuid"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyfile"
"github.com/mholt/caddy/caddytls"
"github.com/mholt/caddy/telemetry"
"github.com/mholt/certmagic"
lumberjack "gopkg.in/natefinch/lumberjack.v2"
_ "github.com/mholt/caddy/caddyhttp" // plug in the HTTP server type
_ "github.com/caddyserver/caddy/caddyhttp" // plug in the HTTP server type
// This is where other plugins get plugged in (imported)
)
@@ -290,7 +290,7 @@ func getBuildModule() *debug.Module {
// preserves caddy a read-only dependency
// TODO: track related Go issue: https://github.com/golang/go/issues/29228
for _, mod := range bi.Deps {
if mod.Path == "github.com/mholt/caddy" {
if mod.Path == "github.com/caddyserver/caddy" {
return mod
}
}
+1 -1
View File
@@ -19,7 +19,7 @@
package main
import "github.com/mholt/caddy/caddy/caddymain"
import "github.com/caddyserver/caddy/caddy/caddymain"
var run = caddymain.Run // replaced for tests
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"sync"
"testing"
"github.com/mholt/caddy/caddyfile"
"github.com/caddyserver/caddy/caddyfile"
)
/*
-3
View File
@@ -20,8 +20,6 @@ import (
"os"
"path/filepath"
"strings"
"github.com/mholt/caddy/telemetry"
)
// Parse parses the input just enough to group tokens, in
@@ -353,7 +351,6 @@ func (p *parser) directive() error {
// The directive itself is appended as a relevant token
p.block.Tokens[dir] = append(p.block.Tokens[dir], p.tokens[p.cursor])
telemetry.AppendUnique("directives", dir)
for p.Next() {
if p.Val() == "{" {
+1 -1
View File
@@ -33,8 +33,8 @@ import (
"strings"
"sync"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
"github.com/jimstudt/http-authentication/basic"
"github.com/mholt/caddy/caddyhttp/httpserver"
)
// BasicAuth is middleware to protect resources with a username and password.
+2 -2
View File
@@ -25,7 +25,7 @@ import (
"strings"
"testing"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestBasicAuth(t *testing.T) {
@@ -110,7 +110,7 @@ func TestBasicAuth(t *testing.T) {
}
} else {
if req.Header.Get("Authorization") == "" {
// see issue #1508: https://github.com/mholt/caddy/issues/1508
// see issue #1508: https://github.com/caddyserver/caddy/issues/1508
t.Errorf("Test %d: Expected Authorization header to be retained after successful auth, but was empty", i)
}
}
+2 -2
View File
@@ -17,8 +17,8 @@ package basicauth
import (
"strings"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
+2 -2
View File
@@ -21,8 +21,8 @@ import (
"strings"
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
+2 -2
View File
@@ -15,8 +15,8 @@
package bind
import (
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
+2 -2
View File
@@ -17,8 +17,8 @@ package bind
import (
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetupBind(t *testing.T) {
+2 -2
View File
@@ -29,9 +29,9 @@ import (
"text/template"
"time"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/staticfiles"
"github.com/dustin/go-humanize"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/mholt/caddy/caddyhttp/staticfiles"
)
const (
+2 -2
View File
@@ -31,8 +31,8 @@ import (
"text/template"
"time"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/mholt/caddy/caddyhttp/staticfiles"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/staticfiles"
)
const testDirPrefix = "caddy_browse_test"
+3 -3
View File
@@ -20,9 +20,9 @@ import (
"net/http"
"text/template"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/mholt/caddy/caddyhttp/staticfiles"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/staticfiles"
)
func init() {
+2 -2
View File
@@ -22,8 +22,8 @@ import (
"testing"
"time"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
+28 -28
View File
@@ -16,34 +16,34 @@ package caddyhttp
import (
// plug in the server
_ "github.com/mholt/caddy/caddyhttp/httpserver"
_ "github.com/caddyserver/caddy/caddyhttp/httpserver"
// plug in the standard directives
_ "github.com/mholt/caddy/caddyhttp/basicauth"
_ "github.com/mholt/caddy/caddyhttp/bind"
_ "github.com/mholt/caddy/caddyhttp/browse"
_ "github.com/mholt/caddy/caddyhttp/errors"
_ "github.com/mholt/caddy/caddyhttp/expvar"
_ "github.com/mholt/caddy/caddyhttp/extensions"
_ "github.com/mholt/caddy/caddyhttp/fastcgi"
_ "github.com/mholt/caddy/caddyhttp/gzip"
_ "github.com/mholt/caddy/caddyhttp/header"
_ "github.com/mholt/caddy/caddyhttp/index"
_ "github.com/mholt/caddy/caddyhttp/internalsrv"
_ "github.com/mholt/caddy/caddyhttp/limits"
_ "github.com/mholt/caddy/caddyhttp/log"
_ "github.com/mholt/caddy/caddyhttp/markdown"
_ "github.com/mholt/caddy/caddyhttp/mime"
_ "github.com/mholt/caddy/caddyhttp/pprof"
_ "github.com/mholt/caddy/caddyhttp/proxy"
_ "github.com/mholt/caddy/caddyhttp/push"
_ "github.com/mholt/caddy/caddyhttp/redirect"
_ "github.com/mholt/caddy/caddyhttp/requestid"
_ "github.com/mholt/caddy/caddyhttp/rewrite"
_ "github.com/mholt/caddy/caddyhttp/root"
_ "github.com/mholt/caddy/caddyhttp/status"
_ "github.com/mholt/caddy/caddyhttp/templates"
_ "github.com/mholt/caddy/caddyhttp/timeouts"
_ "github.com/mholt/caddy/caddyhttp/websocket"
_ "github.com/mholt/caddy/onevent"
_ "github.com/caddyserver/caddy/caddyhttp/basicauth"
_ "github.com/caddyserver/caddy/caddyhttp/bind"
_ "github.com/caddyserver/caddy/caddyhttp/browse"
_ "github.com/caddyserver/caddy/caddyhttp/errors"
_ "github.com/caddyserver/caddy/caddyhttp/expvar"
_ "github.com/caddyserver/caddy/caddyhttp/extensions"
_ "github.com/caddyserver/caddy/caddyhttp/fastcgi"
_ "github.com/caddyserver/caddy/caddyhttp/gzip"
_ "github.com/caddyserver/caddy/caddyhttp/header"
_ "github.com/caddyserver/caddy/caddyhttp/index"
_ "github.com/caddyserver/caddy/caddyhttp/internalsrv"
_ "github.com/caddyserver/caddy/caddyhttp/limits"
_ "github.com/caddyserver/caddy/caddyhttp/log"
_ "github.com/caddyserver/caddy/caddyhttp/markdown"
_ "github.com/caddyserver/caddy/caddyhttp/mime"
_ "github.com/caddyserver/caddy/caddyhttp/pprof"
_ "github.com/caddyserver/caddy/caddyhttp/proxy"
_ "github.com/caddyserver/caddy/caddyhttp/push"
_ "github.com/caddyserver/caddy/caddyhttp/redirect"
_ "github.com/caddyserver/caddy/caddyhttp/requestid"
_ "github.com/caddyserver/caddy/caddyhttp/rewrite"
_ "github.com/caddyserver/caddy/caddyhttp/root"
_ "github.com/caddyserver/caddy/caddyhttp/status"
_ "github.com/caddyserver/caddy/caddyhttp/templates"
_ "github.com/caddyserver/caddy/caddyhttp/timeouts"
_ "github.com/caddyserver/caddy/caddyhttp/websocket"
_ "github.com/caddyserver/caddy/onevent"
)
+1 -1
View File
@@ -18,7 +18,7 @@ import (
"strings"
"testing"
"github.com/mholt/caddy"
"github.com/caddyserver/caddy"
)
// TODO: this test could be improved; the purpose is to
+3 -3
View File
@@ -24,8 +24,8 @@ import (
"strings"
"time"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
@@ -142,7 +142,7 @@ func (h ErrorHandler) recovery(w http.ResponseWriter, r *http.Request) {
}
// Trim file path
delim := "/github.com/mholt/caddy/"
delim := "/github.com/caddyserver/caddy/"
pkgPathPos := strings.Index(file, delim)
if pkgPathPos > -1 && len(file) > pkgPathPos+len(delim) {
file = file[pkgPathPos+len(delim):]
+1 -1
View File
@@ -26,7 +26,7 @@ import (
"strings"
"testing"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestErrors(t *testing.T) {
+2 -2
View File
@@ -20,8 +20,8 @@ import (
"path/filepath"
"strconv"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
// setup configures a new errors middleware instance.
+2 -2
View File
@@ -19,8 +19,8 @@ import (
"reflect"
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
+1 -1
View File
@@ -19,7 +19,7 @@ import (
"fmt"
"net/http"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
// ExpVar is a simple struct to hold expvar's configuration
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"net/http/httptest"
"testing"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestExpVar(t *testing.T) {
+2 -2
View File
@@ -19,8 +19,8 @@ import (
"runtime"
"sync"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
+2 -2
View File
@@ -17,8 +17,8 @@ package expvar
import (
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
+1 -1
View File
@@ -26,7 +26,7 @@ import (
"path"
"strings"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
// Ext can assume an extension from clean URLs.
+2 -2
View File
@@ -15,8 +15,8 @@
package extensions
import (
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
+2 -2
View File
@@ -17,8 +17,8 @@ package extensions
import (
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
+3 -3
View File
@@ -35,9 +35,9 @@ import (
"crypto/tls"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/mholt/caddy/caddytls"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddytls"
)
// Handler is a middleware type that can handle requests as a FastCGI client.
+2 -2
View File
@@ -28,8 +28,8 @@ import (
"testing"
"time"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestServeHTTP(t *testing.T) {
+2 -2
View File
@@ -23,8 +23,8 @@ import (
"strings"
"time"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
var defaultTimeout = 60 * time.Second
+2 -2
View File
@@ -21,8 +21,8 @@ import (
"testing"
"time"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
+3 -3
View File
@@ -22,8 +22,8 @@ import (
"net/http"
"strings"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
@@ -67,7 +67,7 @@ outer:
}
// In order to avoid unused memory allocation, gzip.putWriter only be called when gzip compression happened.
// see https://github.com/mholt/caddy/issues/2395
// see https://github.com/caddyserver/caddy/issues/2395
gz := &gzipResponseWriter{
ResponseWriterWrapper: &httpserver.ResponseWriterWrapper{ResponseWriter: w},
newWriter: func() io.Writer {
+1 -1
View File
@@ -23,7 +23,7 @@ import (
"strings"
"testing"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestGzipHandler(t *testing.T) {
+2 -2
View File
@@ -18,7 +18,7 @@ import (
"net/http"
"path"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
// RequestFilter determines if a request should be gzipped.
@@ -30,7 +30,7 @@ type RequestFilter interface {
// defaultExtensions is the list of default extensions for which to enable gzipping.
var defaultExtensions = []string{"", ".txt", ".htm", ".html", ".css", ".php", ".js", ".json",
".md", ".mdown", ".xml", ".svg", ".go", ".cgi", ".py", ".pl", ".aspx", ".asp", ".m3u", ".m3u8"}
".md", ".mdown", ".xml", ".svg", ".go", ".cgi", ".py", ".pl", ".aspx", ".asp", ".m3u", ".m3u8", ".wasm"}
// DefaultExtFilter creates an ExtFilter with default extensions.
func DefaultExtFilter() ExtFilter {
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"net/http/httptest"
"testing"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestLengthFilter(t *testing.T) {
+2 -2
View File
@@ -22,8 +22,8 @@ import (
"strings"
"sync"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
// setup configures a new gzip middleware instance.
+2 -2
View File
@@ -17,8 +17,8 @@ package gzip
import (
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"net/http"
"strings"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
// Headers is middleware that adds headers to the responses
+1 -1
View File
@@ -24,7 +24,7 @@ import (
"sort"
"testing"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestHeader(t *testing.T) {
+2 -2
View File
@@ -17,8 +17,8 @@ package header
import (
"net/http"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
+2 -2
View File
@@ -20,8 +20,8 @@ import (
"reflect"
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"regexp"
"strings"
"github.com/mholt/caddy"
"github.com/caddyserver/caddy"
)
// SetupIfMatcher parses `if` or `if_op` in the current dispenser block.
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"strings"
"testing"
"github.com/mholt/caddy"
"github.com/caddyserver/caddy"
)
func TestConditions(t *testing.T) {
+11 -8
View File
@@ -18,9 +18,10 @@ import (
"fmt"
"net"
"net/http"
"strconv"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddytls"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddytls"
"github.com/mholt/certmagic"
)
@@ -125,7 +126,7 @@ func enableAutoHTTPS(configs []*SiteConfig, loadCertificates bool) error {
cfg.TLS.Enabled &&
(!cfg.TLS.Manual || cfg.TLS.Manager.OnDemand != nil) &&
cfg.Addr.Host != "localhost" {
cfg.Addr.Port = HTTPSPort
cfg.Addr.Port = strconv.Itoa(certmagic.HTTPSPort)
}
}
return nil
@@ -138,10 +139,12 @@ func enableAutoHTTPS(configs []*SiteConfig, loadCertificates bool) error {
// only set up redirects for configs that qualify. It returns the updated list of
// all configs.
func makePlaintextRedirects(allConfigs []*SiteConfig) []*SiteConfig {
httpPort := strconv.Itoa(certmagic.HTTPPort)
httpsPort := strconv.Itoa(certmagic.HTTPSPort)
for i, cfg := range allConfigs {
if cfg.TLS.Managed &&
!hostHasOtherPort(allConfigs, i, HTTPPort) &&
(cfg.Addr.Port == HTTPSPort || !hostHasOtherPort(allConfigs, i, HTTPSPort)) {
!hostHasOtherPort(allConfigs, i, httpPort) &&
(cfg.Addr.Port == httpsPort || !hostHasOtherPort(allConfigs, i, httpsPort)) {
allConfigs = append(allConfigs, redirPlaintextHost(cfg))
}
}
@@ -167,10 +170,10 @@ func hostHasOtherPort(allConfigs []*SiteConfig, thisConfigIdx int, otherPort str
// redirPlaintextHost returns a new plaintext HTTP configuration for
// a virtualHost that simply redirects to cfg, which is assumed to
// be the HTTPS configuration. The returned configuration is set
// to listen on HTTPPort. The TLS field of cfg must not be nil.
// to listen on certmagic.HTTPPort. The TLS field of cfg must not be nil.
func redirPlaintextHost(cfg *SiteConfig) *SiteConfig {
redirPort := cfg.Addr.Port
if redirPort == HTTPSPort {
if redirPort == strconv.Itoa(certmagic.HTTPSPort) {
// By default, HTTPSPort should be DefaultHTTPSPort,
// which of course doesn't need to be explicitly stated
// in the Location header. Even if HTTPSPort is changed
@@ -210,7 +213,7 @@ func redirPlaintextHost(cfg *SiteConfig) *SiteConfig {
}
host := cfg.Addr.Host
port := HTTPPort
port := strconv.Itoa(certmagic.HTTPPort)
addr := net.JoinHostPort(host, port)
return &SiteConfig{
+4 -3
View File
@@ -20,9 +20,10 @@ import (
"net"
"net/http"
"net/http/httptest"
"strconv"
"testing"
"github.com/mholt/caddy/caddytls"
"github.com/caddyserver/caddy/caddytls"
"github.com/mholt/certmagic"
)
@@ -55,7 +56,7 @@ func TestRedirPlaintextHost(t *testing.T) {
},
{
Host: "foohost",
Port: HTTPSPort, // since this is the 'default' HTTPS port, should not be included in Location value
Port: strconv.Itoa(certmagic.HTTPSPort), // since this is the 'default' HTTPS port, should not be included in Location value
},
{
Host: "*.example.com",
@@ -83,7 +84,7 @@ func TestRedirPlaintextHost(t *testing.T) {
if actual, expected := cfg.ListenHost, testcase.ListenHost; actual != expected {
t.Errorf("Test %d: Expected redir config to have bindhost %s but got %s", i, expected, actual)
}
if actual, expected := cfg.Addr.Port, HTTPPort; actual != expected {
if actual, expected := cfg.Addr.Port, strconv.Itoa(certmagic.HTTPPort); actual != expected {
t.Errorf("Test %d: Expected redir config to have port '%s' but got '%s'", i, expected, actual)
}
+1 -1
View File
@@ -23,8 +23,8 @@ import (
"strings"
"sync"
"github.com/caddyserver/caddy"
gsyslog "github.com/hashicorp/go-syslog"
"github.com/mholt/caddy"
)
var remoteSyslogPrefixes = map[string]string{
+5 -1
View File
@@ -21,7 +21,7 @@ import (
"path"
"time"
"github.com/mholt/caddy"
"github.com/caddyserver/caddy"
)
func init() {
@@ -117,6 +117,10 @@ func (c ConfigSelector) Select(r *http.Request) (config HandlerConfig) {
// path separator, just like URLs. IndexFle handles path manipulation
// internally for systems that use different path separators.
func IndexFile(root http.FileSystem, fpath string, indexFiles []string) (string, bool) {
if len(fpath) == 0 {
// https://caddy.community/t/panic-runtime-error-index-out-of-range/5781
fpath = "/"
}
if fpath[len(fpath)-1] != '/' || root == nil {
return "", false
}
+2 -2
View File
@@ -25,8 +25,8 @@ import (
"strings"
"sync"
"github.com/mholt/caddy/caddytls"
"github.com/mholt/caddy/telemetry"
"github.com/caddyserver/caddy/caddytls"
"github.com/caddyserver/caddy/telemetry"
)
// tlsHandler is a http.Handler that will inject a value
+48 -40
View File
@@ -27,19 +27,19 @@ import (
"strings"
"time"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyfile"
"github.com/mholt/caddy/caddyhttp/staticfiles"
"github.com/mholt/caddy/caddytls"
"github.com/mholt/caddy/telemetry"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyfile"
"github.com/caddyserver/caddy/caddyhttp/staticfiles"
"github.com/caddyserver/caddy/caddytls"
"github.com/caddyserver/caddy/telemetry"
"github.com/mholt/certmagic"
)
const serverType = "http"
func init() {
flag.StringVar(&HTTPPort, "http-port", HTTPPort, "Default port to use for HTTP")
flag.StringVar(&HTTPSPort, "https-port", HTTPSPort, "Default port to use for HTTPS")
flag.IntVar(&certmagic.HTTPPort, "http-port", certmagic.HTTPPort, "Default port to use for HTTP")
flag.IntVar(&certmagic.HTTPSPort, "https-port", certmagic.HTTPSPort, "Default port to use for HTTPS")
flag.StringVar(&Host, "host", DefaultHost, "Default host")
flag.StringVar(&Port, "port", DefaultPort, "Default port")
flag.StringVar(&Root, "root", DefaultRoot, "Root path of default site")
@@ -128,6 +128,8 @@ func (h *httpContext) saveConfig(key string, cfg *SiteConfig) {
// be parsed and executed.
func (h *httpContext) InspectServerBlocks(sourceFile string, serverBlocks []caddyfile.ServerBlock) ([]caddyfile.ServerBlock, error) {
siteAddrs := make(map[string]string)
httpPort := strconv.Itoa(certmagic.HTTPPort)
httpsPort := strconv.Itoa(certmagic.HTTPSPort)
// For each address in each server block, make a new config
for _, sb := range serverBlocks {
@@ -172,15 +174,15 @@ func (h *httpContext) InspectServerBlocks(sourceFile string, serverBlocks []cadd
// If default HTTP or HTTPS ports have been customized,
// make sure the ACME challenge ports match
var altHTTPPort, altTLSALPNPort int
if HTTPPort != DefaultHTTPPort {
portInt, err := strconv.Atoi(HTTPPort)
if httpPort != DefaultHTTPPort {
portInt, err := strconv.Atoi(httpPort)
if err != nil {
return nil, err
}
altHTTPPort = portInt
}
if HTTPSPort != DefaultHTTPSPort {
portInt, err := strconv.Atoi(HTTPSPort)
if httpsPort != DefaultHTTPSPort {
portInt, err := strconv.Atoi(httpsPort)
if err != nil {
return nil, err
}
@@ -228,6 +230,9 @@ func (h *httpContext) InspectServerBlocks(sourceFile string, serverBlocks []cadd
// MakeServers uses the newly-created siteConfigs to
// create and return a list of server instances.
func (h *httpContext) MakeServers() ([]caddy.Server, error) {
httpPort := strconv.Itoa(certmagic.HTTPPort)
httpsPort := strconv.Itoa(certmagic.HTTPSPort)
// make a rough estimate as to whether we're in a "production
// environment/system" - start by assuming that most production
// servers will set their default CA endpoint to a public,
@@ -266,7 +271,7 @@ func (h *httpContext) MakeServers() ([]caddy.Server, error) {
if !cfg.TLS.Enabled {
continue
}
if cfg.Addr.Port == HTTPPort || cfg.Addr.Scheme == "http" {
if cfg.Addr.Port == httpPort || cfg.Addr.Scheme == "http" {
cfg.TLS.Enabled = false
log.Printf("[WARNING] TLS disabled for %s", cfg.Addr)
} else if cfg.Addr.Scheme == "" {
@@ -281,7 +286,7 @@ func (h *httpContext) MakeServers() ([]caddy.Server, error) {
// this is vital, otherwise the function call below that
// sets the listener address will use the default port
// instead of 443 because it doesn't know about TLS.
cfg.Addr.Port = HTTPSPort
cfg.Addr.Port = httpsPort
}
if cfg.TLS.ClientAuth != tls.NoClientCert {
if QUIC {
@@ -421,7 +426,7 @@ func (a Address) String() string {
}
scheme := a.Scheme
if scheme == "" {
if a.Port == HTTPSPort {
if a.Port == strconv.Itoa(certmagic.HTTPSPort) {
scheme = "https"
} else {
scheme = "http"
@@ -502,6 +507,18 @@ func (a Address) Key() string {
func standardizeAddress(str string) (Address, error) {
input := str
httpPort := strconv.Itoa(certmagic.HTTPPort)
httpsPort := strconv.Itoa(certmagic.HTTPSPort)
// As of Go 1.12.8 (Aug 2019), ports that are service names such
// as ":http" and ":https" are no longer parsed as they were
// before, which is a breaking change for us. Attempt to smooth
// this over for now by replacing those strings with their port
// equivalents. See
// https://github.com/golang/go/commit/3226f2d492963d361af9dfc6714ef141ba606713
str = strings.Replace(str, ":https", ":"+httpsPort, 1)
str = strings.Replace(str, ":http", ":"+httpPort, 1)
// Split input into components (prepend with // to assert host by default)
if !strings.Contains(str, "//") && !strings.HasPrefix(str, "/") {
str = "//" + str
@@ -523,32 +540,26 @@ func standardizeAddress(str string) (Address, error) {
// see if we can set port based off scheme
if port == "" {
if u.Scheme == "http" {
port = HTTPPort
port = httpPort
} else if u.Scheme == "https" {
port = HTTPSPort
port = httpsPort
}
}
// repeated or conflicting scheme is confusing, so error
if u.Scheme != "" && (port == "http" || port == "https") {
return Address{}, fmt.Errorf("[%s] scheme specified twice in address", input)
}
// error if scheme and port combination violate convention
if (u.Scheme == "http" && port == HTTPSPort) || (u.Scheme == "https" && port == HTTPPort) {
if (u.Scheme == "http" && port == httpsPort) || (u.Scheme == "https" && port == httpPort) {
return Address{}, fmt.Errorf("[%s] scheme and port violate convention", input)
}
// standardize http and https ports to their respective port numbers
if port == "http" {
// (this behavior changed in Go 1.12.8)
if port == httpPort {
u.Scheme = "http"
port = HTTPPort
} else if port == "https" {
} else if port == httpsPort {
u.Scheme = "https"
port = HTTPSPort
}
return Address{Original: input, Scheme: u.Scheme, Host: host, Port: port, Path: u.Path}, err
return Address{Original: input, Scheme: u.Scheme, Host: host, Port: port, Path: u.Path}, nil
}
// RegisterDevDirective splices name into the list of directives
@@ -647,6 +658,7 @@ var directives = []string{
"filter", // github.com/echocat/caddy-filter
"ipfilter", // github.com/pyed/ipfilter
"ratelimit", // github.com/xuqingfeng/caddy-rate-limit
"recaptcha", // github.com/defund/caddy-recaptcha
"expires", // github.com/epicagency/caddy-expires
"forwardproxy", // github.com/caddyserver/forwardproxy
"basicauth",
@@ -656,13 +668,14 @@ var directives = []string{
"s3browser", // github.com/techknowlogick/caddy-s3browser
"nobots", // github.com/Xumeiquer/nobots
"mime",
"login", // github.com/tarent/loginsrv/caddy
"reauth", // github.com/freman/caddy-reauth
"extauth", // github.com/BTBurke/caddy-extauth
"jwt", // github.com/BTBurke/caddy-jwt
"jsonp", // github.com/pschlump/caddy-jsonp
"upload", // blitznote.com/src/caddy.upload
"multipass", // github.com/namsral/multipass/caddy
"login", // github.com/tarent/loginsrv/caddy
"reauth", // github.com/freman/caddy-reauth
"extauth", // github.com/BTBurke/caddy-extauth
"jwt", // github.com/BTBurke/caddy-jwt
"permission", // github.com/dhaavi/caddy-permission
"jsonp", // github.com/pschlump/caddy-jsonp
"upload", // blitznote.com/src/caddy.upload
"multipass", // github.com/namsral/multipass/caddy
"internal",
"pprof",
"expvar",
@@ -671,6 +684,7 @@ var directives = []string{
"prometheus", // github.com/miekg/caddy-prometheus
"templates",
"proxy",
"pubsub", // github.com/jung-kurt/caddy-pubsub
"fastcgi",
"cgi", // github.com/jung-kurt/caddy-cgi
"websocket",
@@ -721,10 +735,4 @@ var (
// QUIC indicates whether QUIC is enabled or not.
QUIC bool
// HTTPPort is the port to use for HTTP.
HTTPPort = DefaultHTTPPort
// HTTPSPort is the port to use for HTTPS.
HTTPSPort = DefaultHTTPSPort
)
+9 -9
View File
@@ -22,8 +22,8 @@ import (
"fmt"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyfile"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyfile"
)
func TestStandardizeAddress(t *testing.T) {
@@ -45,10 +45,10 @@ func TestStandardizeAddress(t *testing.T) {
{`localhost:https`, "https", "localhost", "443", "", false},
{`:http`, "http", "", "80", "", false},
{`:https`, "https", "", "443", "", false},
{`http://localhost:https`, "", "", "", "", true}, // conflict
{`http://localhost:http`, "", "", "", "", true}, // repeated scheme
{`http://localhost:443`, "", "", "", "", true}, // not conventional
{`https://localhost:80`, "", "", "", "", true}, // not conventional
{`http://localhost:https`, "", "", "", "", true}, // conflict
{`http://localhost:http`, "http", "localhost", "80", "", false}, // repeated scheme -- test adjusted for Go 1.12.8 (expect no error)
{`http://localhost:443`, "", "", "", "", true}, // not conventional
{`https://localhost:80`, "", "", "", "", true}, // not conventional
{`http://localhost`, "http", "localhost", "80", "", false},
{`https://localhost`, "https", "localhost", "443", "", false},
{`http://127.0.0.1`, "http", "127.0.0.1", "80", "", false},
@@ -58,8 +58,8 @@ func TestStandardizeAddress(t *testing.T) {
{`https://127.0.0.1:1234`, "https", "127.0.0.1", "1234", "", false},
{`http://[::1]:1234`, "http", "::1", "1234", "", false},
{``, "", "", "", "", false},
{`::1`, "", "::1", "", "", true},
{`localhost::`, "", "localhost::", "", "", true},
{`::1`, "", "::1", "", "", false}, // test adjusted for Go 1.12.8 (expect no error)
{`localhost::`, "", "localhost::", "", "", false}, // test adjusted for Go 1.12.8 (expect no error)
{`#$%@`, "", "", "", "", true},
{`host/path`, "", "host", "", "/path", false},
{`http://host/`, "http", "host", "80", "/", false},
@@ -67,7 +67,7 @@ func TestStandardizeAddress(t *testing.T) {
{`:1234/asdf`, "", "", "1234", "/asdf", false},
{`http://host/path`, "http", "host", "80", "/path", false},
{`https://host:443/path/foo`, "https", "host", "443", "/path/foo", false},
{`host:80/path`, "", "host", "80", "/path", false},
{`host:80/path`, "http", "host", "80", "/path", false}, // test adjusted for Go 1.12.8 (expect "http" scheme)
{`host:https/path`, "https", "host", "443", "/path", false},
{`/path`, "", "", "", "/path", false},
} {
+2 -2
View File
@@ -32,8 +32,8 @@ import (
"strings"
"time"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddytls"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddytls"
)
// requestReplacer is a strings.Replacer which is used to
+1 -1
View File
@@ -30,7 +30,7 @@ import (
"testing"
"time"
"github.com/mholt/caddy/caddytls"
"github.com/caddyserver/caddy/caddytls"
)
func TestNewReplacer(t *testing.T) {
+4 -4
View File
@@ -31,11 +31,11 @@ import (
"strings"
"time"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/staticfiles"
"github.com/caddyserver/caddy/caddytls"
"github.com/caddyserver/caddy/telemetry"
"github.com/lucas-clemente/quic-go/h2quic"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/staticfiles"
"github.com/mholt/caddy/caddytls"
"github.com/mholt/caddy/telemetry"
)
// Server is the HTTP server implementation.
+1 -1
View File
@@ -17,7 +17,7 @@ package httpserver
import (
"time"
"github.com/mholt/caddy/caddytls"
"github.com/caddyserver/caddy/caddytls"
)
// SiteConfig contains information about a site
+4 -2
View File
@@ -25,6 +25,7 @@ import (
"net/http"
"net/url"
"path"
"strconv"
"strings"
"sync"
"text/template"
@@ -32,7 +33,8 @@ import (
"os"
"github.com/mholt/caddy/caddytls"
"github.com/caddyserver/caddy/caddytls"
"github.com/mholt/certmagic"
"github.com/russross/blackfriday"
)
@@ -178,7 +180,7 @@ func (c Context) Port() (string, error) {
if err != nil {
if !strings.Contains(c.Req.Host, ":") {
// common with sites served on the default port 80
return HTTPPort, nil
return strconv.Itoa(certmagic.HTTPPort), nil
}
return "", err
}
+2 -2
View File
@@ -15,8 +15,8 @@
package index
import (
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
+3 -3
View File
@@ -17,9 +17,9 @@ package index
import (
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/mholt/caddy/caddyhttp/staticfiles"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/staticfiles"
)
func TestIndexIncompleteParams(t *testing.T) {
+1 -1
View File
@@ -23,7 +23,7 @@ package internalsrv
import (
"net/http"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
// Internal middleware protects internal locations from external requests -
+1 -1
View File
@@ -23,7 +23,7 @@ import (
"strconv"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
const (
+2 -2
View File
@@ -15,8 +15,8 @@
package internalsrv
import (
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
+2 -2
View File
@@ -17,8 +17,8 @@ package internalsrv
import (
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
+1 -1
View File
@@ -18,7 +18,7 @@ import (
"io"
"net/http"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
// Limit is a middleware to control request body size
+1 -1
View File
@@ -22,7 +22,7 @@ import (
"strings"
"testing"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestBodySizeLimit(t *testing.T) {
+2 -2
View File
@@ -20,8 +20,8 @@ import (
"strconv"
"strings"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
const (
+2 -2
View File
@@ -18,8 +18,8 @@ import (
"reflect"
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
const (
+2 -2
View File
@@ -20,8 +20,8 @@ import (
"net"
"net/http"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
+1 -1
View File
@@ -23,7 +23,7 @@ import (
"strings"
"testing"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
type erroringMiddleware struct{}
+2 -2
View File
@@ -18,8 +18,8 @@ import (
"net"
"strings"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
// setup sets up the logging middleware.
+2 -2
View File
@@ -19,8 +19,8 @@ import (
"reflect"
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
+1 -1
View File
@@ -26,7 +26,7 @@ import (
"text/template"
"time"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
"github.com/russross/blackfriday"
)
+2 -2
View File
@@ -23,8 +23,8 @@ import (
"testing"
"text/template"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
"github.com/russross/blackfriday"
)
+3 -3
View File
@@ -19,9 +19,9 @@ import (
"io/ioutil"
"os"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/mholt/caddy/caddyhttp/markdown/metadata"
"github.com/mholt/caddy/caddyhttp/markdown/summary"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/markdown/metadata"
"github.com/caddyserver/caddy/caddyhttp/markdown/summary"
"github.com/russross/blackfriday"
)
+1 -1
View File
@@ -19,7 +19,7 @@ import (
"strings"
"testing"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestConfig_Markdown(t *testing.T) {
+2 -2
View File
@@ -18,8 +18,8 @@ import (
"net/http"
"path/filepath"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
"github.com/russross/blackfriday"
)
+2 -2
View File
@@ -22,8 +22,8 @@ import (
"testing"
"text/template"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
+2 -2
View File
@@ -21,8 +21,8 @@ import (
"sync"
"text/template"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/mholt/caddy/caddyhttp/markdown/metadata"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/markdown/metadata"
)
// Data represents a markdown document.
+1 -1
View File
@@ -18,7 +18,7 @@ import (
"net/http"
"path"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
// Config represent a mime config. Map from extension to mime-type.
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"net/http/httptest"
"testing"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestMimeHandler(t *testing.T) {
+2 -2
View File
@@ -18,8 +18,8 @@ import (
"fmt"
"strings"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
+2 -2
View File
@@ -17,8 +17,8 @@ package mime
import (
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
+1 -1
View File
@@ -18,7 +18,7 @@ import (
"net/http"
pp "net/http/pprof"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
// BasePath is the base path to match for all pprof requests.
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"net/http/httptest"
"testing"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestServeHTTP(t *testing.T) {
+2 -2
View File
@@ -15,8 +15,8 @@
package pprof
import (
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
+1 -1
View File
@@ -17,7 +17,7 @@ package pprof
import (
"testing"
"github.com/mholt/caddy"
"github.com/caddyserver/caddy"
)
func TestSetup(t *testing.T) {
+1 -1
View File
@@ -25,7 +25,7 @@ import (
"sync/atomic"
"time"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
// Proxy represents a middleware instance that can proxy requests.
+2 -2
View File
@@ -40,8 +40,8 @@ import (
"time"
"github.com/lucas-clemente/quic-go/h2quic"
"github.com/mholt/caddy/caddyfile"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyfile"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
"golang.org/x/net/websocket"
)
+3 -3
View File
@@ -41,9 +41,9 @@ import (
"golang.org/x/net/http2"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
"github.com/lucas-clemente/quic-go"
"github.com/lucas-clemente/quic-go/h2quic"
"github.com/mholt/caddy/caddyhttp/httpserver"
)
var (
@@ -515,7 +515,7 @@ func (rp *ReverseProxy) copyResponse(dst io.Writer, src io.Reader) {
}
// skip these headers if they already exist.
// see https://github.com/mholt/caddy/pull/1112#discussion_r80092582
// see https://github.com/caddyserver/caddy/pull/1112#discussion_r80092582
var skipHeaders = map[string]struct{}{
"Content-Type": {},
"Content-Disposition": {},
@@ -529,7 +529,7 @@ func copyHeader(dst, src http.Header) {
for k, vv := range src {
if _, ok := dst[k]; ok {
// skip some predefined headers
// see https://github.com/mholt/caddy/issues/1086
// see https://github.com/caddyserver/caddy/issues/1086
if _, shouldSkip := skipHeaders[k]; shouldSkip {
continue
}
+2 -2
View File
@@ -15,8 +15,8 @@
package proxy
import (
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
+2 -2
View File
@@ -18,8 +18,8 @@ import (
"reflect"
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
+3 -3
View File
@@ -36,8 +36,8 @@ import (
"crypto/tls"
"github.com/mholt/caddy/caddyfile"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyfile"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
var (
@@ -645,7 +645,7 @@ func (u *staticUpstream) healthCheck() {
return false
}
// TODO ReadAll will be replaced if deemed necessary
// See https://github.com/mholt/caddy/pull/1691
// See https://github.com/caddyserver/caddy/pull/1691
buf, err := ioutil.ReadAll(r.Body)
if err != nil {
return true
+1 -1
View File
@@ -31,7 +31,7 @@ import (
"time"
"github.com/lucas-clemente/quic-go/h2quic"
"github.com/mholt/caddy/caddyfile"
"github.com/caddyserver/caddy/caddyfile"
)
func TestNewHost(t *testing.T) {
+1 -1
View File
@@ -18,7 +18,7 @@ import (
"net/http"
"strings"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func (h Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
+1 -1
View File
@@ -25,7 +25,7 @@ import (
"reflect"
"testing"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
type MockedPusher struct {
+1 -1
View File
@@ -17,7 +17,7 @@ package push
import (
"net/http"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
type (
+2 -2
View File
@@ -20,8 +20,8 @@ import (
"net/http"
"strings"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func init() {
+2 -2
View File
@@ -19,8 +19,8 @@ import (
"reflect"
"testing"
"github.com/mholt/caddy"
"github.com/mholt/caddy/caddyhttp/httpserver"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestPushAvailable(t *testing.T) {

Some files were not shown because too many files have changed in this diff Show More