Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am writing a small http proxy/tunnel and I am having trouble with knowing when there is data to be received on the socket.
I have tried to determine the amount of data to be received by looking after the "content-length" field in the http header but sometimes the server doesn't send one.
I am also having a lot of troubles with the chunked packages.
Anyone here who knows his way around HTTP and can help me shed some light on this? All I need to know is how much data to receive. I really don't want to rely on timeouts while using my sockets cause that really slows things down to make it impossible to actually use the proxy.
The proxy is really simple, it doesn't do anything with the packages, just sends them back and forth.
Also, you may want to check out the NON-BLOCKING mode of your stream (open connection), that way, you can read from the stream, and if there is no data, the call returns immediately.
Also, you may want to check out the NON-BLOCKING mode of your stream (open connection), that way, you can read from the stream, and if there is no data, the call returns immediately.
I am using python and no, it does not. The call waits for a timeout if there is no data.
No, it does not. The problem is not the blocking part of the socket. The problem is that HTTP 1.1 uses persistent connections by default (unlike HTTP 1.0) and therefore I cannot rely on the function to return when there is no more data on the socket to be read.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.