From: Robert Klemme Date: 2012-03-23T20:10:13+09:00 Subject: Re: simple http proxy, TCPServer<->TCPSocket-> Bigmac Turdsplash wrote in post #1052885: > Robert Klemme wrote in post #1052606: >> Bigmac Turdsplash wrote in post #1052529: >>> this thing kind of works... i have connected my webbrowser to 8181 for >>> testing... im looking for help, everything i try produce the same >>> resaults... i dont really want to bother with event machines > so, my code has a few problems, the web browser will only load a few > pages and the connection will always stay open as if the browser is > waiting for more data... A few things: - Better use #read and #write for your IO - I think you are not properly implementing the HTTP proxy protocol. - You can make your life easier by using #gets("\r\n") to read HTTP request from client > i was thinking maybe i need 2 or 3 threads to handle both sides... > > Thread.start{ receive_get from webbrowser }#step one > Thread.start{ send_get to webserver } #step two > Thread.start{ send_response to webbrowser }#step three I don't think you'll necessarily need threads for HTTP 1.0. > if i understand, the first step i need to gather a host: field > then establish a connection to the host web server > and pass the response back to the web client... Right. > i think my loops are wrong... maybe i can use IO to handle sockets? No idea what you mean by that. Cheers robert -- Posted via http://www.ruby-forum.com/.