MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / httpRedirect

Function httpRedirect

internal/nodes/http_request_utils.go:221–228  ·  view source on GitHub ↗

跳转到某个URL

(writer http.ResponseWriter, req *http.Request, url string, code int)

Source from the content-addressed store, hash-verified

219
220// 跳转到某个URL
221func httpRedirect(writer http.ResponseWriter, req *http.Request, url string, code int) {
222 if len(writer.Header().Get("Content-Type")) == 0 {
223 // 设置Content-Type,是为了让页面不输出链接
224 writer.Header().Set("Content-Type", "text/html; charset=utf-8")
225 }
226
227 http.Redirect(writer, req, url, code)
228}
229
230// 分析URL中的Host部分
231func httpParseHost(urlString string) (host string, err error) {

Callers 7

doShutdownMethod · 0.85
doPageLookupMethod · 0.85
doHostRedirectMethod · 0.85
doMismatchMethod · 0.85
RedirectMethod · 0.85
doRewriteMethod · 0.85
doRedirectToHTTPSMethod · 0.85

Calls 4

RedirectMethod · 0.80
GetMethod · 0.45
HeaderMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected