-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
type/enhancementAn improvement of existing functionalityAn improvement of existing functionality
Milestone
Description
- Gitea version (or commit ref): 1.9.2
- Git version: 2.23.0
- Operating system: linux/amd64
- Database (use
[x]
):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL)
- No
- Not relevant
- Log gist:
Description
In my environment Gitea does not have direct internet access, a proxy is required. I have been able to successfully mirror repositories and use the proxy to download other items. However, I am not able to post webhooks via Microsoft Teams. After further investigations it appears that the http client that is created in the InitDeliverHooks function in webhook.go does utilize any proxy settings.
Proposed Resolution
Current Implimentation
// InitDeliverHooks starts the hooks delivery thread
func InitDeliverHooks() {
timeout := time.Duration(setting.Webhook.DeliverTimeout) * time.Second
webhookHTTPClient = &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: setting.Webhook.SkipTLSVerify},
Dial: func(netw, addr string) (net.Conn, error) {
conn, err := net.DialTimeout(netw, addr, timeout)
if err != nil {
return nil, err
}
return conn, conn.SetDeadline(time.Now().Add(timeout))
},
},
}
go DeliverHooks()
}
Proposed Implementation
// InitDeliverHooks starts the hooks delivery thread
func InitDeliverHooks() {
timeout := time.Duration(setting.Webhook.DeliverTimeout) * time.Second
webhookHTTPClient = &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: setting.Webhook.SkipTLSVerify},
Proxy: http.ProxyFromEnvironment,
Dial: func(netw, addr string) (net.Conn, error) {
conn, err := net.DialTimeout(netw, addr, timeout)
if err != nil {
return nil, err
}
return conn, conn.SetDeadline(time.Now().Add(timeout))
},
},
}
go DeliverHooks()
}
I have implemented this in my environment and it is currently working.
Metadata
Metadata
Assignees
Labels
type/enhancementAn improvement of existing functionalityAn improvement of existing functionality