I'm only using TidTCPServer, but I found the information I need.  My memo
box was not big enough and had scrolled down missing the GET /test HTTP/1.1
on the first line.

 

Thanks anyway.

 

From: delphi-boun...@delphi.org.nz [mailto:delphi-boun...@delphi.org.nz] On
Behalf Of Jolyon Smith
Sent: Monday, 21 March 2011 4:57 PM
To: 'NZ Borland Developers Group - Delphi List'
Subject: Re: [DUG] Emulate a very basic web server using TCPServer

 

I suggest you look at the properties of the TIdHTTPRequestInfo object you
get, corresponding to a browser request.

 

All the information you need can be found there I suspect.  J

 

 

From: delphi-boun...@delphi.org.nz [mailto:delphi-boun...@delphi.org.nz] On
Behalf Of Ross Levis
Sent: Monday, 21 March 2011 16:47
To: 'NZ Borland Developers Group - Delphi List'
Subject: [DUG] Emulate a very basic web server using TCPServer

 

I've got a TCP Client/Server app using Indy10 which communicates using my
own protocol, but I have a situation where I want to send information to a
browser using the same TCP Server using the same port, rather than
implementing a separate Indy HTTP server.

 

All I need is to retrieve the URL path entered into the browser, and return
some content based on that.

 

I can currently do everything except determine the URL path.  My IE browser
is sending information like this.

 

User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0;
GTB6.6; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 2.0.50727; FDM; .NET CLR
3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR
3.5.30729; Open Codecs 0.85.17766)

Accept-Encoding: gzip, deflate

Host: localhost:2323

Connection: Keep-Alive

 

What I entered into the browser was http://localhost:2323/test  and I need
the "/test" to know what to send back.

 

I assume I need to send something back to the browser to ask for the path.
I could likely spend hours reading the HTTP 1.1 specifications but I'm
hoping someone may know.

 

Cheers,

Ross.

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: 
unsubscribe

Reply via email to