fix insecure tls when trigger task

This commit is contained in:
Unknwon 2015-10-26 09:16:24 -04:00
parent 87c3c8172a
commit b9f5def5dc
5 changed files with 14 additions and 11 deletions

View File

@ -5,6 +5,7 @@
package cmd package cmd
import ( import (
"crypto/tls"
"fmt" "fmt"
"os" "os"
"os/exec" "os/exec"
@ -219,7 +220,9 @@ func runServ(c *cli.Context) {
strings.TrimPrefix(task.RefName, "refs/heads/") strings.TrimPrefix(task.RefName, "refs/heads/")
log.GitLogger.Trace("Trigger task: %s", reqURL) log.GitLogger.Trace("Trigger task: %s", reqURL)
resp, err := httplib.Head(reqURL).Response() resp, err := httplib.Head(reqURL).SetTLSClientConfig(&tls.Config{
InsecureSkipVerify: true,
}).Response()
if err == nil { if err == nil {
resp.Body.Close() resp.Body.Close()
if resp.StatusCode/100 != 2 { if resp.StatusCode/100 != 2 {

View File

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.6.18.1025 Beta" const APP_VER = "0.6.18.1026 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

View File

@ -76,7 +76,7 @@ func (pr *PullRequest) AfterSet(colName string, _ xorm.Cell) {
func (pr *PullRequest) getHeadRepo(e Engine) (err error) { func (pr *PullRequest) getHeadRepo(e Engine) (err error) {
pr.HeadRepo, err = getRepositoryByID(e, pr.HeadRepoID) pr.HeadRepo, err = getRepositoryByID(e, pr.HeadRepoID)
if err != nil && !IsErrRepoNotExist(err) { if err != nil && !IsErrRepoNotExist(err) {
return fmt.Errorf("GetRepositoryByID (head): %v", err) return fmt.Errorf("getRepositoryByID(head): %v", err)
} }
return nil return nil
} }

View File

@ -50,7 +50,7 @@ func SetDefaultSetting(setting Settings) {
} }
// return *Request with specific method // return *Request with specific method
func newBeegoRequest(url, method string) *Request { func newRequest(url, method string) *Request {
var resp http.Response var resp http.Response
req := http.Request{ req := http.Request{
Method: method, Method: method,
@ -64,27 +64,27 @@ func newBeegoRequest(url, method string) *Request {
// Get returns *Request with GET method. // Get returns *Request with GET method.
func Get(url string) *Request { func Get(url string) *Request {
return newBeegoRequest(url, "GET") return newRequest(url, "GET")
} }
// Post returns *Request with POST method. // Post returns *Request with POST method.
func Post(url string) *Request { func Post(url string) *Request {
return newBeegoRequest(url, "POST") return newRequest(url, "POST")
} }
// Put returns *Request with PUT method. // Put returns *Request with PUT method.
func Put(url string) *Request { func Put(url string) *Request {
return newBeegoRequest(url, "PUT") return newRequest(url, "PUT")
} }
// Delete returns *Request DELETE method. // Delete returns *Request DELETE method.
func Delete(url string) *Request { func Delete(url string) *Request {
return newBeegoRequest(url, "DELETE") return newRequest(url, "DELETE")
} }
// Head returns *Request with HEAD method. // Head returns *Request with HEAD method.
func Head(url string) *Request { func Head(url string) *Request {
return newBeegoRequest(url, "HEAD") return newRequest(url, "HEAD")
} }
type Settings struct { type Settings struct {

View File

@ -1 +1 @@
0.6.18.1025 Beta 0.6.18.1026 Beta