Re: how to receive a Http message on a socket ?



On 2007-02-09, kant <sasi@xxxxxxxx> wrote:
Hi all,
I'm trying to learn something more about sockets because
I need to receive a HTTP message on a socket: I'm listening
on a port (let's say 8080) and the browser sees me as its
proxy. When it requires a page, I'd like to receive the entire
HTTP Request. I wrote the following, but - I don't know why -
it doesn't seem to work.

I hope anyone more experienced than me will help me,
because I really need this feature, it's quite urgent.
I'm trying my best but I think that sometimes the best
way to learn is to have some examples of codes..After all
it shouldn't be so unusual to receive a HTTP Request on a
socket .. I mean it should be a standard action for those
who program distributed applications. Please help.

This is the code I'm using:

#define PROXY_PORT 8080
#define MAXLENGTH 10000

longest HTTP requset I've ever seen was 800K, no I lie I did 1.2M once
if files are being uploaded it could be even longer....

are you reading the header of the request correctly?

--

Bye.
Jasen
.



Relevant Pages

  • Re: Wrapping TCP communications in HTTP
    ... SSL/TLS is an encryption and wire protocol, ... How you communicate through the socket is entirely ... > That sounds like we might be able to get away with going through port 80 ... > simply wrapping all of our messages in HTTP GETs or POSTs, ...
    (microsoft.public.win32.programmer.networks)
  • Re: How hard is socket programming?
    ... From what I understand, If I embed a webserver into my code, then I would be communicating with the webserver using HTTP which is a higher level abstraction than sockets, and the webserver code would be providing this higher level interface to me and handling the lower level details of sockets for me. ... All internet programs use the socket library available for the OS. ... For Microsoft its calls WINSOCK, but basic sockets is WINSOCK and at the most basic level: ... What makes it a web is PORT 80 or PORT 443 for SSL. ...
    (microsoft.public.vc.mfc)
  • Re: making an http server
    ... > create a socket, bind it to a port number and start listening to the ... transmit it to the browser as a fake HTML response ... > web- this function returns the request back to the browser ... > read from the socket the HTTP request ...
    (microsoft.public.dotnet.languages.csharp)
  • Imposing a timeout on the <> operator - is this possible?
    ... This is done via HTTP ... that one of the remote machines was in some kind of strange state. ... So my program opens up a socket, fires off the HTTP request and then ...
    (comp.lang.perl)
  • Re: Wrapping TCP communications in HTTP
    ... HTTP is a half-duplex protocol. ... The send socket is used to send all requests. ... so the server can return any data it has. ...
    (microsoft.public.win32.programmer.networks)