本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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. }
上海开阖软件有限公司 沪ICP备12045867号-1