{"record":{"id":"6cbc386980542801","repo":"XTLS/Xray-core","slug":"connection-ends-6cbc38","errorCode":null,"errorMessage":"connection ends","messagePattern":"connection ends","errorType":"exception","errorClass":"errors.Error","httpStatus":null,"severity":"error","filePath":"proxy/http/server.go","lineNumber":310,"sourceCode":"\t\t\t\tProtoMinor:    1,\n\t\t\t\tHeader:        http.Header(make(map[string][]string)),\n\t\t\t\tBody:          nil,\n\t\t\t\tContentLength: 0,\n\t\t\t\tClose:         true,\n\t\t\t}\n\t\t\tresponse.Header.Set(\"Connection\", \"close\")\n\t\t\tresponse.Header.Set(\"Proxy-Connection\", \"close\")\n\t\t}\n\t\tif err := response.Write(writer); err != nil {\n\t\t\treturn errors.New(\"failed to write response\").Base(err).AtWarning()\n\t\t}\n\t\treturn nil\n\t}\n\n\tif err := task.Run(ctx, requestDone, responseDone); err != nil {\n\t\tcommon.Interrupt(link.Reader)\n\t\tcommon.Interrupt(link.Writer)\n\t\treturn errors.New(\"connection ends\").Base(err)\n\t}\n\n\treturn result\n}\n\n// Sometimes, server might send 1xx response to client\n// it should not be processed by http proxy handler, just forward it to client\nfunc readResponseAndHandle100Continue(r *bufio.Reader, req *http.Request, writer io.Writer) (*http.Response, error) {\n\t// have a little look of response\n\tpeekBytes, err := r.Peek(56)\n\tif err == nil || err == bufio.ErrBufferFull {\n\t\tstr := string(peekBytes)\n\t\tResponseLine := strings.Split(str, \"\\r\\n\")[0]\n\t\t_, status, _ := strings.Cut(ResponseLine, \" \")\n\t\t// only handle 1xx response\n\t\tif strings.HasPrefix(status, \"1\") {\n\t\t\tResponseHeader1xx := []byte{}\n\t\t\t// read until \\r\\n\\r\\n (end of http response header)","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/http/server.go#L292-L328","documentation":"Error \"connection ends\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at proxy/http/server.go:310 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}