mirror of
https://github.com/caddyserver/caddy.git
synced 2026-05-25 16:22:36 -04:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 46ab93be51 | |||
| e0fc46a911 | |||
| 9f6393c64c | |||
| 105dac8c2a | |||
| 4ebf100f09 |
@@ -156,9 +156,6 @@ jobs:
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Create 'caddy-build'
|
||||
run: mkdir -p caddy-build
|
||||
|
||||
- uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
goos: ['android', 'linux', 'solaris', 'illumos', 'dragonfly', 'freebsd', 'openbsd', 'plan9', 'windows', 'darwin', 'netbsd']
|
||||
go: [ '1.16', '1.17' ]
|
||||
go: [ '1.17' ]
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
steps:
|
||||
|
||||
@@ -88,10 +88,6 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go${{ matrix.go }}-release
|
||||
|
||||
- name: Create the 'caddy-build' dir for GoReleaser
|
||||
run: |
|
||||
mkdir -p caddy-build
|
||||
|
||||
# GoReleaser will take care of publishing those artifacts into the release
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
|
||||
+1
-1
@@ -331,7 +331,7 @@ func cmdReload(fl Flags) (int, error) {
|
||||
}
|
||||
|
||||
func cmdVersion(_ Flags) (int, error) {
|
||||
fmt.Println(caddyVersion())
|
||||
fmt.Println(CaddyVersion())
|
||||
return caddy.ExitCodeSuccess, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,12 @@ type Command struct {
|
||||
// any error that occurred.
|
||||
type CommandFunc func(Flags) (int, error)
|
||||
|
||||
// Commands returns a list of commands initialised by
|
||||
// RegisterCommand
|
||||
func Commands() map[string]Command {
|
||||
return commands
|
||||
}
|
||||
|
||||
var commands = make(map[string]Command)
|
||||
|
||||
func init() {
|
||||
|
||||
+3
-3
@@ -420,7 +420,7 @@ func printEnvironment() {
|
||||
fmt.Printf("caddy.AppDataDir=%s\n", caddy.AppDataDir())
|
||||
fmt.Printf("caddy.AppConfigDir=%s\n", caddy.AppConfigDir())
|
||||
fmt.Printf("caddy.ConfigAutosavePath=%s\n", caddy.ConfigAutosavePath)
|
||||
fmt.Printf("caddy.Version=%s\n", caddyVersion())
|
||||
fmt.Printf("caddy.Version=%s\n", CaddyVersion())
|
||||
fmt.Printf("runtime.GOOS=%s\n", runtime.GOOS)
|
||||
fmt.Printf("runtime.GOARCH=%s\n", runtime.GOARCH)
|
||||
fmt.Printf("runtime.Compiler=%s\n", runtime.Compiler)
|
||||
@@ -437,8 +437,8 @@ func printEnvironment() {
|
||||
}
|
||||
}
|
||||
|
||||
// caddyVersion returns a detailed version string, if available.
|
||||
func caddyVersion() string {
|
||||
// CaddyVersion returns a detailed version string, if available.
|
||||
func CaddyVersion() string {
|
||||
goModule := caddy.GoModule()
|
||||
ver := goModule.Version
|
||||
if goModule.Sum != "" {
|
||||
|
||||
@@ -6,7 +6,7 @@ require (
|
||||
github.com/Masterminds/sprig/v3 v3.2.2
|
||||
github.com/alecthomas/chroma v0.9.2
|
||||
github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b
|
||||
github.com/caddyserver/certmagic v0.14.4
|
||||
github.com/caddyserver/certmagic v0.14.5
|
||||
github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac
|
||||
github.com/go-chi/chi v4.1.2+incompatible
|
||||
github.com/google/cel-go v0.7.3
|
||||
|
||||
@@ -173,8 +173,8 @@ github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl
|
||||
github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g=
|
||||
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
|
||||
github.com/caarlos0/ctrlc v1.0.0/go.mod h1:CdXpj4rmq0q/1Eb44M9zi2nKB0QraNKuRGYGrrHhcQw=
|
||||
github.com/caddyserver/certmagic v0.14.4 h1:jlGiMUHOd7p3sgT8zHA/4wckZjIp/6ME2JWGAN5zh5E=
|
||||
github.com/caddyserver/certmagic v0.14.4/go.mod h1:/0VQ5og2Jxa5yBQ8eT80wWS7fi/DgNy1uXeXRUJ1Wj0=
|
||||
github.com/caddyserver/certmagic v0.14.5 h1:y4HcFzLLBMsTv8sSlAPj5K55mvntX8e8ExcmB/lhO6w=
|
||||
github.com/caddyserver/certmagic v0.14.5/go.mod h1:/0VQ5og2Jxa5yBQ8eT80wWS7fi/DgNy1uXeXRUJ1Wj0=
|
||||
github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e/go.mod h1:9IOqJGCPMSc6E5ydlp5NIonxObaeu/Iub/X03EKPVYo=
|
||||
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
|
||||
github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e/go.mod h1:oDpT4efm8tSYHXV5tHSdRvBet/b/QzxZ+XyyPehvm3A=
|
||||
|
||||
@@ -182,6 +182,7 @@ type responseWriter struct {
|
||||
buf *bytes.Buffer
|
||||
config *Encode
|
||||
statusCode int
|
||||
wroteHeader bool
|
||||
}
|
||||
|
||||
// WriteHeader stores the status to write when the time comes
|
||||
@@ -195,6 +196,19 @@ func (enc *Encode) Match(rw *responseWriter) bool {
|
||||
return enc.Matcher.Match(rw.statusCode, rw.Header())
|
||||
}
|
||||
|
||||
// Flush implements http.Flusher. It delays the actual Flush of the underlying ResponseWriterWrapper
|
||||
// until headers were written.
|
||||
func (rw *responseWriter) Flush() {
|
||||
if !rw.wroteHeader {
|
||||
// flushing the underlying ResponseWriter will write header and status code,
|
||||
// but we need to delay that until we can determine if we must encode and
|
||||
// therefore add the Content-Encoding header; this happens in the first call
|
||||
// to rw.Write (see bug in #4314)
|
||||
return
|
||||
}
|
||||
rw.ResponseWriterWrapper.Flush()
|
||||
}
|
||||
|
||||
// Write writes to the response. If the response qualifies,
|
||||
// it is encoded using the encoder, which is initialized
|
||||
// if not done so already.
|
||||
@@ -225,6 +239,7 @@ func (rw *responseWriter) Write(p []byte) (int, error) {
|
||||
if rw.statusCode > 0 {
|
||||
rw.ResponseWriter.WriteHeader(rw.statusCode)
|
||||
rw.statusCode = 0
|
||||
rw.wroteHeader = true
|
||||
}
|
||||
|
||||
switch {
|
||||
@@ -271,6 +286,7 @@ func (rw *responseWriter) Close() error {
|
||||
// that rely on If-None-Match, for example
|
||||
rw.ResponseWriter.WriteHeader(rw.statusCode)
|
||||
rw.statusCode = 0
|
||||
rw.wroteHeader = true
|
||||
}
|
||||
if rw.w != nil {
|
||||
err2 := rw.w.Close()
|
||||
|
||||
Reference in New Issue
Block a user