{"record":{"id":"a3cb21efcff479d9","repo":"XTLS/Xray-core","slug":"failed-to-read-http-1xx-response","errorCode":null,"errorMessage":"failed to read http 1xx response","messagePattern":"failed to read http 1xx response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/http/server.go","lineNumber":332,"sourceCode":"}\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)\n\t\t\tfor {\n\t\t\t\tdata, err := r.ReadSlice('\\n')\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.New(\"failed to read http 1xx response\").Base(err)\n\t\t\t\t}\n\t\t\t\tResponseHeader1xx = append(ResponseHeader1xx, data...)\n\t\t\t\tif bytes.Equal(ResponseHeader1xx[len(ResponseHeader1xx)-4:], []byte{'\\r', '\\n', '\\r', '\\n'}) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif len(ResponseHeader1xx) > 1024 {\n\t\t\t\t\treturn nil, errors.New(\"too big http 1xx response\")\n\t\t\t\t}\n\t\t\t}\n\t\t\twriter.Write(ResponseHeader1xx)\n\t\t}\n\t}\n\treturn http.ReadResponse(r, req)\n}\n\nfunc init() {\n\tcommon.Must(common.RegisterConfig((*ServerConfig)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {\n\t\treturn NewServer(ctx, config.(*ServerConfig))","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/http/server.go#L314-L350","documentation":"Error \"failed to read http 1xx response\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at proxy/http/server.go:332 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"}