Hi everyone.
I'm in the process of designing (and eventually building) an "interface" HTTP service. The idea is that this is a HTTP front-end to a traditional socket-server application. Hopefully the ASCII art below will illustrate what I'm trying to achieve.
,--------------. ,---------------.
| HTTP Request | | HTTP Response | A
`--------------' `---------------'
| ^
| | B
v |
,---------------------------------.
| Web Server | C
`----- | --------------- ^ -------'
| | D
,----- v --------------- | -------.
| Pool of socket connections | E
`---------------------------------'
| | | ^ ^ ^
| | | | | | F
v v v | | |
,---------------------------------.
| Multi-threaded backend system | G
`---------------------------------'
The point of this exercise is that I need to provide a HTTP front-end to the backend system (G). This system has a socket interface (e.g. listens on port 4567), and is designed to have one, long running, request-response stream (however it is multi-threaded, and can support multiple connections). The connection to this system (F) is a proprietary TCP/IP protocol. I need to provide a standard HTTP interface (B) to this application.
The crux of my query is this: how would you recommend implementing steps C, D and E? There are no really complicated translations needed. All messages are ASCII (text/plain), and I don't need to wrap HTML around or anything else. It is really just a translation from one protocol to another (with a very thin layer of logic to rewrite message headers).
The options I have thought of so far are as follows:
This is a common enough thing to want to implement, I'm just wondering if anyone can share any "gotchas" or suggestions about which way to go. Links to other people's implementations are just as welcome as any of your own personal experiences.
Thank you for your time. It is much appreciated. :-)
Cheers,
-- Dave :-)
$q=[split+qr,,,q,~swmi,.$,],+s.$.Em~w^,,.,s,.,$&&$$q[pos],eg,print
In reply to HTTP server guidance by DaveH
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |