httptunnel icon indicating copy to clipboard operation
httptunnel copied to clipboard

couldn't write GET header: Invalid argument

Open SanskritFritz opened this issue 3 years ago • 4 comments

Hi! I try to setup the basic scenario. On my home Linux: hts --forward-port localhost:22 80 At my work Linux behind proxy: htc --forward-port 8888 --proxy localhost:3128 home_computer:80 The proxy is cntlm running locally which in turn connects to the corporate NTLM proxy. When I try ssh user@localhost -p 8888 In cntlm's log there is

Mar 03 19:25:03 corp cntlm[149874]: 127.0.0.1 GET http://home_computer:80/index.html?crap=1646331903
Mar 03 19:25:03 corp cntlm[149874]: 127.0.0.1 POST http://home_computer:80/index.html?crap=1646331903

the log on the home computer says:

márc 03 19:25:07 frank-desktop hts[274504]: connection from corp_firewall:port
márc 03 19:25:07 frank-desktop hts[274504]: tunnel_accept: couldn't write GET header: Invalid argument
márc 03 19:25:07 frank-desktop hts[274504]: connection from corp_firewall:another_port
márc 03 19:25:17 frank-desktop hts[274504]: tunnel_accept: poll timed out
márc 03 19:25:17 frank-desktop hts[274504]: tunnel_accept: in_fd = 5, out_fd = -1
márc 03 19:25:17 frank-desktop hts[274504]: couldn't accept connection: Success```

However:

frank@corp ~> telnet localhost 8888
Trying ::1...
Connection failed: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

but I can't see any traces in the home computer logs. What am I doing wrong?

SanskritFritz avatar Mar 03 '22 18:03 SanskritFritz

Sorry, it was actually decades ago I looked at this code. But there here are some questions I'd like to raise.

  1. The proxy first makes a GET request, and immediately after an identical POST request. Why is that?
  2. I may be confused here, but isn't it wrong for the server to attempt to make a GET request? By which I mean the hts 19:25:07 entry.
  3. Why does the write get an "Invalid argument" error? Maybe related to 2, is it even supposed to make a GET request?
  4. If your telnet connection worked but there are nothing in the hts logs, it must have went somewhere else.

Unfortunately it's almost impossible for me to assist further.

larsbrinkhoff avatar Mar 03 '22 19:03 larsbrinkhoff

Sorry, it was actually decades ago I looked at this code. But there here are some questions I'd like to raise.

Thanks for caring!

  1. The proxy first makes a GET request, and immediately after an identical POST request. Why is that?

I really thought those requests were made by htc to the server side hts to initiate communication. Could it be that the corporate firewall sends an extra request to check the destination?

  1. I may be confused here, but isn't it wrong for the server to attempt to make a GET request? By which I mean the hts 19:25:07 entry.

I don't think the server made that request, since that log is on the server side (the home computer), logging a client request.

  1. Why does the write get an "Invalid argument" error? Maybe related to 2, is it even supposed to make a GET request?

So maybe hts thinks it's a wrong request, since that GET seems to be superfluous according to your assessment.

  1. If your telnet connection worked but there are nothing in the hts logs, it must have went somewhere else.

Yeah it might be that telnet was already satisfied with the connection to the proxy.

Unfortunately it's almost impossible for me to assist further.

That's a pity but understood. Thanks anyway! I'll close this ticked if you're unable to assist me further.

SanskritFritz avatar Mar 03 '22 21:03 SanskritFritz

  1. The proxy first makes a GET request, and immediately after an identical POST request. Why is that?

From this question I assume you think this is not done by htc. Am I right? Should htc send only one GET request?

SanskritFritz avatar Mar 05 '22 10:03 SanskritFritz

From this question I assume you think this is not done by htc. Am I right?

Yes, I would expect htc to use only GET or only POST. As far as I remember.

larsbrinkhoff avatar Mar 08 '22 19:03 larsbrinkhoff