mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-10-29 13:38:50 +08:00
A custom latency test URL that http.NewRequest rejects made a spawned goroutine dereference nil and exit the process; the URL is validated before any goroutine starts and the request error is handled. A Shadowsocks link whose plugin field has no ";" panicked the parser, and from the automatic subscription update that goroutine was unrecovered; the parser accepts it and each updater recovers and logs. The DNS module took the last non-bootstrap upstream as the fallback while the template emitted upstreams in rule order with deduplication, so a catch-all rule anywhere but last, or one whose upstream was deduplicated, was not the fallback. The template names the fallback in a new default_upstream field and the module honours it. PUT /routingA stored the rules without regenerating the running core. It goes through ApplyCoreConfig like the other config writers, with restore on failure. UpdateSubscription logged a failed core reload and answered success; it returns the error. PATCH /subscription joins the mutation turn. Subscription fetching retried through a direct connection when the selected proxy failed, leaking the subscription URL; it returns the error. Subscription documents are capped at 32 MiB and downloaded assets at 256 MiB. PUT /gfwList validates the downloaded file as a geosite list before replacing the working one. The login handler took its one-at-a-time semaphore before reading the body, so a client sending headers and no body blocked every login; the body is read first and the HTTP server has header and idle timeouts. Share links: a VLESS or VMess link without a numeric port is rejected at parse time instead of producing port 0; an SSR link with a password that is not base64 is rejected instead of importing empty; the SIP003 path gets its leading slash prepended, not a trailing one appended. The macOS system proxy quoted shell arguments with strconv.Quote, which leaves $(...) live; values are single-quoted. The Windows system proxy snapshot includes AutoConfigURL, which teardown deleted and never restored. Latency test responses with a non-2xx status are closed. The version response carries the docker flag the GUI's port hints read.
35 lines
916 B
Go
35 lines
916 B
Go
package httpClient
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"net/http"
|
|
neturl "net/url"
|
|
|
|
"github.com/v2rayA/v2rayA/conf"
|
|
)
|
|
|
|
func HttpGetUsingSpecificClient(c *http.Client, url string) (resp *http.Response, err error) {
|
|
req, err := http.NewRequest("GET", url, nil)
|
|
if err != nil {
|
|
return
|
|
}
|
|
//shadowrocket会有可能不清楚alterid的情况,影响aead是否启用的问题
|
|
req.Header.Set("User-Agent", fmt.Sprintf("v2rayA/%v WebRequestHelper", conf.Version))
|
|
if resp, err = c.Do(req); err != nil {
|
|
return nil, fmt.Errorf("could not fetch through the selected proxy mode (%w); set the mode to direct or start the core", err)
|
|
}
|
|
if resp == nil {
|
|
cause := err
|
|
var urlErr *neturl.Error
|
|
if errors.As(cause, &urlErr) {
|
|
cause = urlErr.Err
|
|
}
|
|
if cause == nil {
|
|
cause = errors.New("request returned no response")
|
|
}
|
|
return nil, fmt.Errorf("could not reach %s: %w", req.URL.Hostname(), cause)
|
|
}
|
|
return
|
|
}
|