THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

38 lines
1.0KB

  1. // +build !windows
  2. // Copyright 2016 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package cmd
  6. import (
  7. "crypto/tls"
  8. "net/http"
  9. "code.gitea.io/gitea/modules/graceful"
  10. )
  11. func runHTTP(listenAddr string, m http.Handler) error {
  12. return graceful.HTTPListenAndServe("tcp", listenAddr, m)
  13. }
  14. func runHTTPS(listenAddr, certFile, keyFile string, m http.Handler) error {
  15. return graceful.HTTPListenAndServeTLS("tcp", listenAddr, certFile, keyFile, m)
  16. }
  17. func runHTTPSWithTLSConfig(listenAddr string, tlsConfig *tls.Config, m http.Handler) error {
  18. return graceful.HTTPListenAndServeTLSConfig("tcp", listenAddr, tlsConfig, m)
  19. }
  20. // NoHTTPRedirector tells our cleanup routine that we will not be using a fallback http redirector
  21. func NoHTTPRedirector() {
  22. graceful.InformCleanup()
  23. }
  24. // NoMainListener tells our cleanup routine that we will not be using a possibly provided listener
  25. // for our main HTTP/HTTPS service
  26. func NoMainListener() {
  27. graceful.InformCleanup()
  28. }