Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple browser to web-proxy connection? #3

Open
bornf opened this issue Mar 26, 2015 · 1 comment
Open

simple browser to web-proxy connection? #3

bornf opened this issue Mar 26, 2015 · 1 comment

Comments

@bornf
Copy link

bornf commented Mar 26, 2015

My issue is to connect two computers by serial-cable. A webbrowser on system-a should communicate to a squid-proxy on system-b.

try with ser2net

I successfully created a connection with the original ser2net with following settings:

ser2net config on system-a and system-b:
2000:raw:5:/dev/ttyS0:9600 NONE 1STOPBIT 8DATABITS RTSCTS

The connection between the listening squid on port 3128 and ser2net on port 2000 on system-b is done with a script and socat:

while true; do
    socat -d -d -v TCP:localhost:2000 TCP:localhost:3128
done

On system-a in a firefox-browser with the setting network.max-connections = 1, it mostly does work, but not very well... Obviously, the reason is the lack of multiple connections.

try with ser2nets

I successfully compiled ser2nets on both systems and used the same config as above. Additionally, I activated logging:

TRACEFILE:tw1:/tmp/tw-\p-\Y-\M-\D-\H:\i:\s.\U
TRACEFILE:tr1:/tmp/tr-\p-\Y-\M-\D-\H:\i:\s.\U
2000:raw:600:/dev/ttyS0:9600 NONE 1STOPBIT 8DATABITS RTSCTS tw=tw1 tr=tr1

I checked with nc an socat:

nc 127.0.0.1 2000 | cat
socat -d -d -v TCP:localhost:2000 -

...and nothing was sent to port 2000 on system-b:
But the log-file has received browser-request-data from system-a:

[D] tcps: 0 (0, 6) 6 (0, 0)
GET http://start.ubuntu.com/14.10/Google/?sourceid=hp HTTP/1.1
Host: start.ubuntu.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive

tcp 6 shutdown: tcp read close
[D] tcps: 0 (0, 0)
[D] tcps: 0 (0, 6) 6 (0, 0)
CONNECT tiles.services.mozilla.com:443 HTTP/1.1
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0
Proxy-Connection: keep-alive
Connection: keep-alive
Host: tiles.services.mozilla.com:443

My mistake is the wrong handling with the multiple connections, I think. How do I correct connect ser2nets with squid on system-b?

@longshine
Copy link
Owner

Hi~

Sorry for ser2nets not working. As far as I know, the reverse channel (network to serial) is not enabled for multiple connections for some reason.

For instance, assume that we have a ser2nets running on /dev/ttyS0 on system-a, with duplex on, and currently 3 parallel HTTP requests from the web browser. Two things will happen:

  • There is NO garantee that each request will be transferred to the serial orderly. They might be split into small fragments and mixed up while running through the cable.
  • Any data from the serial port will be deliverred to all of the 3 connections, which means each connection will receive more responses than what it wants. This may not be blamed on ser2net. You cannot tell among different responses from a single channel without additional info.

What I suggest is to create a protocol to wrap/unwrap HTTP requests/responses, like TCP/IP over Internet wire. The original ser2net will be OK.

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

No branches or pull requests

2 participants