- when installed, it adds indication icon somewhere to the GUI. Preferably at the left side next to the menu icon. Clicking the indication icon shows a menu with two items - Enable, Disable. Current state is indicated in the menu. The app runs on background while the browser is running.
- when Disabled, the webserver does nothing
- when Enabled, the webserver opens random port from range 1111 to 9999 and listens on it for incoming HTTP communication (TCP). The app once enabled will alert IP and port where connections are accepted. After that it behaves like regular web server, meaning that it accepts connections from remote computers on the given port, waits for every request to receive all headers up to CRLF+CRLF. If POST request is received, it also waits for the posted data.
It must be able to accept many connections at the same time and handle them all properly.
When a connection is accepted on the given port and a request is fully received, it passes the request to some function. This function just alert()s the entire request as string on the computer where the chrome app is installed, including all headers and body. (Somebody else will implement handling of the requests and building correct reply.)
I will also need a possibility to return some reply over the network, as a reply to the request. So return value of the handling function will be sent as a string as a reply. That's all
As a test if the Chrome app is running, I will run the chrome app, enable it, then I will run telnet on another computer at [url removed, login to view] (using the correct IP and port number of the computer which runs the app) and I am expecting to see an alert on the "server machine" which alerts "GET /some_url HTTP/1.1" and some of the other headers, and I am expecting to receive some reply on the telnet.