{"record":{"id":"c9f7e8d4d16266eb","repo":"shadow1ng/fscan","slug":"webscan-http-client-init-failed","errorCode":"webscan_http_client_init_failed","errorMessage":"webscan_http_client_init_failed: %w","messagePattern":"webscan_http_client_init_failed: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"webscan/lib/Client.go","lineNumber":58,"sourceCode":"\tClientNoRedirect   *http.Client      // 不自动跟随重定向的HTTP客户端\n\tClientGM           *http.Client      // 国密TLS HTTP客户端\n\tClientNoRedirectGM *http.Client      // 国密TLS 不跟随重定向\n\tdialTimeout        = 5 * time.Second // 连接超时时间\n\tkeepAlive          = 5 * time.Second // 连接保持时间\n)\n\n// Inithttp 初始化HTTP客户端配置\nfunc Inithttp(cfg *common.Config) error {\n\t// 获取POC并发数，默认20\n\tpocNum := cfg.POC.Num\n\tif pocNum == 0 {\n\t\tpocNum = 20\n\t}\n\n\t// 初始化HTTP客户端\n\terr := InitHTTPClient(pocNum, cfg.Network.HTTPProxy, cfg.Network.WebTimeout, cfg.Network.MaxRedirects, &cfg.Network)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s: %w\", i18n.GetText(\"webscan_http_client_init_failed\"), err)\n\t}\n\treturn nil\n}\n\n// configureHTTPProxy 统一配置HTTP代理（SOCKS5优先于HTTP代理）\nfunc configureHTTPProxy(tr *http.Transport, legacyProxy string, networkConfig *common.NetworkConfig) error {\n\t// 优先使用SOCKS5代理（与服务扫描保持一致）\n\tif networkConfig.Socks5Proxy != \"\" {\n\t\tproxyConfig := &proxy.ProxyConfig{\n\t\t\tType:    proxy.ProxyTypeSOCKS5,\n\t\t\tTimeout: time.Second * 10,\n\t\t}\n\n\t\t// 解析SOCKS5 URL以提取认证信息\n\t\tsocks5URL := networkConfig.Socks5Proxy\n\t\tif !strings.HasPrefix(socks5URL, \"socks5://\") {\n\t\t\tsocks5URL = \"socks5://\" + socks5URL\n\t\t}","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/webscan/lib/Client.go#L40-L76","documentation":"Guard in Inithttp: InitHTTPClient (client construction plus proxy/timeout configuration) returned an error, so the shared web-scan HTTP clients (redirect, no-redirect, GM variants) were never populated and any subsequent web scanning would use nil clients.","triggerScenarios":"Thrown at webscan/lib/Client.go:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error to see if proxy configuration or transport creation failed","Fix the proxy settings in the network config","Retry initialization after correcting configuration"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}