Git Product home page Git Product logo

Comments (2)

iYarnFog avatar iYarnFog commented on July 21, 2024

I also found this problem. After reading the code, I found this problem: HTTP1 Matcher tried to read a line and match it in the form of a newline character, while requests like socks did not contain a newline character.

This causes all HTTP1 Matchers to be blocked.

Related code:

cmux/matchers.go

Lines 93 to 94 in 5ec6847

br := bufio.NewReader(&io.LimitedReader{R: r, N: maxHTTPRead})
l, part, err := br.ReadLine()

from cmux.

munding avatar munding commented on July 21, 2024

I also read the code. HTTP1Fast use prefixByteMatcher, then use ReadAtLeast(r Reader, buf []byte, min int)
min is the max length of HTTP method(CONNECT or OPTIONS, just 7 bytes), so it needs to read at least 7 bytes.
but socks first payload usually less than 7 bytes,so it is blocked...
socks5 proto fist payload at least 3 bytes, like below:

# +----+----------+----------+
# |VER | NMETHODS | METHODS  |
# +----+----------+----------+
# | 1  |    1     | 1 to 255 |
# +----+----------+----------+

so i change the defaultHTTPMethods like this (just 3 bytes):

var defaultSimpleHTTPMethods = []string{
	"OPT", //OPTIONS
	"GET", //GET
	"HEA", //HEAD
	"POS", //POST
	"PUT", //PUT
	"DEL", //DELETE
	"TRA", //TRACE
	"CON", //CONNECT
}

from cmux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.