HttpServer Sample - Read Me



-----BEGIN PGP SIGNED MESSAGE-----

HttpServer Sample - Read Me

HttpServer Macintosh OpenTransport Network Server shell 

Version: early but functional

Apple Macintosh Developer Technical Support
Written by:  Vinne Moscaritolo

Copyright (work in progress)  Apple Computer, Inc 

You may incorporate this sample code into your applications without
restriction, though the sample code has been provided "AS IS" and the
responsibility for its operation is 100% yours.  However, what you are
not permitted to do is to redistribute the source as "DTS Sample Code"
after having made changes. If you're going to re-distribute the source,
we require that you make it clear in the source that the code was
descended from Apple Sample Code, but that you've made changes.

HttpServer is a MacOS faceless background task that can be used as framework
for developing connection based OpenTransport network servers. Written in 
Metrowerks C++, the HttpServer utilizes the Thread Manager, OpenTransport, 
AppleEvents (barely) and C++ IOStreams.

The current example will bind onto TCP port 80 (HTTP) and listen for incoming
connection r
 * ests, It will then spawn the connetion to another thread which

can process it independantly.. To test, make sure your TCP/IP is up and
running, then launch the app into the background and a access it with a web
browser  (Netscape,Cyerdog or whatever) and it will return you a test page
for example my test node was 17.203.21.76 so I entered int netscape..

http://17.203.21.76

and I got back.

- -----
Vinnie's OpenTransport HTTP Test Server

Server Info:
Name:            Mr Mojo Risin
Date:            Fri, 12 Jan 1996 01:10:59 GMT
Active Sessions: 1
Free:            3
Accepted:        0
Rejected:        0
Up Time:         0 min
Client:          17.203.21.75 :1102
StackSpace:      23036

Provider: 0
Address:   17.203.21.76
NetMask:   255.255.252.0
Broadcast: 0.0.0.0
Gateway:   17.203.20.1
DNS:       17.203.21.76
Domain:    apple.com
Port 0
Name:      serialA
Bus:       Serial Devices
Module:    serialAB
Bus:       MthrBrd
Flags:     TPI Can-Yield
- -----


Some of the techniques demonstrated in this sample are:
 * Faceless Background Tasks
 * Thread Manager
 * OpenTransport connection management
 * OpenTransport Async Notifer managemnt
 * No-Copy network reads
 * IOStreams managment


There are a few key things that needs to be done 
 * Properly handle XTL LISTEN/ACCEPT Handoff ( I know..this s what you all
want)
 * IOStream extraction support (means reading from the stream) and Thread
suspend/resume
 * more support for Transport independant I/O


here is my detailed list..

main -
 * notifier for error handler

TContext
 * proper support for execptions

THTTServer
 * remove uneccessary construct.destruct
 * scan availablle providers to open on
 * It wold be cool if THTTPSession::Run actally parsed html

TBackroundApp
 * A start stop erver event would be cool

TNetworkAcceptor
 * Listen/Accept and OTLook support (THIS HAS TO BE FIXED)
 * Provideer will close event
 * shutdown msg
 * stream in prefs (TSessionPref)
 * OptionManagement reuse IP ?

TNetworkSession
 * timeout event/watchdog
 * handle out of sequence TDATA befor TPASSCON

TNetworkStream
 * write code for istream functions, support yield/suspend/resume thread

TNetworkEndpointDescriptor
 * setup options
 * adverstise service
 * make compatible with future OT tranparent stuff (watch this space, it will
be cool)
 * write TServicedescriptor

TAddrInet
TAddr
 * complete functionality

TGMT
 * stream in date/time

*--------------------------

I know that this code really requires some real documention but I wanted to
make it available as soon as I can, I will periodicaly post updates on
various places  on the net,  you can also contact me to find out where.

NOTE::
 The Accept loop in TNetworkAcceptor Needs to be fixed, this is not the way
to
 wait for connections, I didnt check the for TLook Errors and hence this will
 fail under any load. BUT this is the highest priory item for me to fix in
this package,
 (whenever I get to it that is)

I was last able to compile it under CW8.

good luck

*------------
Vinnie Moscaritolo
Apple DTS Sniper
"One Shot..One Kill"

http://thumper.vmeng.com/

Fingerprint =  4F A3 29 81 50 E4 04 F2  78 25 01 87 6E A2 14 6A
*-------------


Build Notes... 
be sure to put the OpenTransport 1.1 files should be in your Codewarrior
search path.

please send me any feedback or fixes you make..  



-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMVh/ZPMF2+rAU+UdAQHsbgQAxj5zjDNEx5o8MZqMtFIqNVNFxpBDRxbd
c33/N62HgMw6wPBXSg3R2PXlW/cNFcJVjb/7eTsC0hgY97uqfkDYxP4Qd79Kh7Ky
d040GuRS0ZOfRT/ZnA5xjd8X6Ijgej85z9BxBLFsORF9c1UpqS5qLy3tT7IrFVS8
CBOcQJUKamM=
=YBFE
-----END PGP SIGNATURE-----


Cool, download It.


Back to my homepage

Comments (vinnie@apple.com)