Skip to content

Update server.js for a new returned value#52

Open
xBoyMinemc wants to merge 1 commit intomscdex:masterfrom
xBoyMinemc:master
Open

Update server.js for a new returned value#52
xBoyMinemc wants to merge 1 commit intomscdex:masterfrom
xBoyMinemc:master

Conversation

@xBoyMinemc
Copy link
Copy Markdown

so,when

const server = socks5.createServer((reqInfo, accept, deny) => {
  console.log('Requested target:', reqInfo);
  const socket = accept(false);
  if (socket) {
    socket.on('data', (data) => {
      const requestData = data.toString();
       
      if (requestData.startsWith('GET') || requestData.startsWith('POST')) { 
        const match = requestData.match(/^Host: (.+)$/m);
        if (match) {
          console.log('Host Header:', match[1]);
        }
      }
    });
  } 
});

i can get Host Header,without socket.resume()
after socket.resume(), Building sockets manually is cumbersome

so,when
```
const server = socks5.createServer((reqInfo, accept, deny) => {
  console.log('Requested target:', reqInfo);
  const socket = accept(false);
  if (socket) {
    socket.on('data', (data) => {
      const requestData = data.toString();
       
      if (requestData.startsWith('GET') || requestData.startsWith('POST')) { 
        const match = requestData.match(/^Host: (.+)$/m);
        if (match) {
          console.log('Host Header:', match[1]);
        }
      }
    });
  } 
});

```

i can get Host Header,without socket.resume()  
after socket.resume(),  Building sockets manually is cumbersome
@xBoyMinemc
Copy link
Copy Markdown
Author

data lost for accept(true) #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant