Me TV, it's TV for me computer

Http layer

Asked by Pascal Noisette on 2012-02-02

Hello everyone,

I am currently trying to add a http layer to the application starting from the 1.4 branch. My purpose is to control me-tv-server via a web browser (manage recordings at least).

The new http layer would serve a kind of form to manage recordings, in addition to encapsulate the existing reception/emission of xml requests. The benefits would be the ability to receive request directly from a web browser (which cannot communicate with the current IP layer).

I will introduice a new package dependancy into the application : http://www.gnu.org/software/libmicrohttpd/ (there is a debian package). These to remove any direct socket call from me-tv-server :
- As far as I see, the request handle must be refactored since it strongly depends on a socket descriptor.
- The microhttpd is to be deamonized so I can also spare the NetworkThread.
- HTTP protocol in the server implies to add/parse header in existing client requests (console and gtk client but all can be done in the common libs and the glib can help me).

In a word this is few work for a web browser compliance.

I believe I will release this in a branch in a couple of weeks if you do no see any objection. In the meantime, I'd like to have feedback on technical decision I could have made and described above.

Pascal

Question information

Language:
English Edit question
Status:
Solved
For:
Me TV Edit question
Assignee:
No assignee Edit question
Solved by:
Pascal Noisette
Solved:
2012-03-17
Last query:
2012-03-17
Last reply:
2012-02-25

Hi Pascal,

I definitly see no objection. Basically, you can do everything (Recording,
Config, Get EPG, Change channel) because of the new architecture. The
communication between the client and the server is via the network (xml
over network) so everything the client can do, you can do it over a small
http server who receive client's request and pass them on to me-tv-server.

Maybe, instead of modifying me-tv, you can do a module (i.e me-tv-http) who
can "talk" with me-tv-server and have an http interface.

In time, I would like to separate me-tv even more. So instead of just
installing me-tv from repository, you would have to install
"me-tv-server" and "me-tv-client" independantly. So we could have an
other componant called "me-tv-http" for the web acces. This way, someone
can install a headless server (no graphic) with "me-tv-server" and
"me-tv-http" without "me-tv-client" (who required GTK) then install
"me-tv-client" on other computer "in da house". It is also easy to make a
meta-package called "me-tv-full" who install/configure everything on the
same computer (and maybe a lite version with only the server and the client
without http: me-tv-lite)

You can see in the file "/server/request_handler.cc" all the possible
command you can pass to the server.

Have a nice days,
Frédéric Côté (QC)

On Thu, Feb 2, 2012 at 5:01 PM, Pascal Noisette <
<email address hidden>> wrote:

> New question #186655 on Me TV:
> https://answers.launchpad.net/me-tv/+question/186655
>
> Hello everyone,
>
> I am currently trying to add a http layer to the application starting from
> the 1.4 branch. My purpose is to control me-tv-server via a web browser
> (manage recordings at least).
>
> The new http layer would serve a kind of form to manage recordings, in
> addition to encapsulate the existing reception/emission of xml requests.
> The benefits would be the ability to receive request directly from a web
> browser (which cannot communicate with the current IP layer).
>
> I will introduice a new package dependancy into the application :
> http://www.gnu.org/software/libmicrohttpd/ (there is a debian package).
> These to remove any direct socket call from me-tv-server :
> - As far as I see, the request handle must be refactored since it strongly
> depends on a socket descriptor.
> - The microhttpd is to be deamonized so I can also spare the NetworkThread.
> - HTTP protocol in the server implies to add/parse header in existing
> client requests (console and gtk client but all can be done in the common
> libs and the glib can help me).
>
> In a word this is few work for a web browser compliance.
>
> I believe I will release this in a branch in a couple of weeks if you do
> no see any objection. In the meantime, I'd like to have feedback on
> technical decision I could have made and described above.
>
> Pascal
>
>
> --
> You received this question notification because you are an answer
> contact for Me TV.
>

--
"In a world without walls, who really needs Windows"
"Nothing is foolproof because fools are so ingenious"

Thanks for the reply,

Actually I started to dialog with me-tv-server via an Apache http://httpd.apache.org/ to test some piece of html code to 'register'. Such a gateway would be a heavy solution for my needs if i didn't have it already running for other purposes...

Talking of making a 'me-tv-http' module reminds me that this is not a good idea to rewrite its own small http server from scratch : existing HTTP server demonstrate their reliability and already answered the good questions (security scalability). I believe the libmicrohttpd is therefore not appropriate since the module solution is favored to patching the me-tv-server core.

I may look for a lightweight HTTP server which could forward information to the IP layer, but for me (it's a shame) the html/js code development will take precedence since I can run it already.

Regards,
Pascal

Hello,

I wasn't suggesting to build an http server from scratch. The module can
use an existing small http server.

No matter what, you can do it the way you like it :o) (thanks to the open
source)

Have a nice Day,
Fred

On Fri, Feb 3, 2012 at 3:11 PM, Pascal Noisette <
<email address hidden>> wrote:

> Question #186655 on Me TV changed:
> https://answers.launchpad.net/me-tv/+question/186655
>
> Pascal Noisette posted a new comment:
> Thanks for the reply,
>
> Actually I started to dialog with me-tv-server via an Apache
> http://httpd.apache.org/ to test some piece of html code to 'register'.
> Such a gateway would be a heavy solution for my needs if i didn't have
> it already running for other purposes...
>
> Talking of making a 'me-tv-http' module reminds me that this is not a
> good idea to rewrite its own small http server from scratch : existing
> HTTP server demonstrate their reliability and already answered the good
> questions (security scalability). I believe the libmicrohttpd is
> therefore not appropriate since the module solution is favored to
> patching the me-tv-server core.
>
> I may look for a lightweight HTTP server which could forward information
> to the IP layer, but for me (it's a shame) the html/js code development
> will take precedence since I can run it already.
>
> Regards,
> Pascal
>
> --
> You received this question notification because you are an answer
> contact for Me TV.
>

--
"In a world without walls, who really needs Windows"
"Nothing is foolproof because fools are so ingenious"

Hello,

I have just pushed my refactoring with http, and a sample action (register) to show where I am going.

To respect your advice about separating the whole application from the http module, I just need me-tv-server to implement HTTP protocol. The file server thing can be done separately ( and as I was saying, for the moment I use an apache so I also release an appropriate vhost if you want to test)

Please find in the lp:~netpascal0123/me-tv/me-tv_http branch the modification in server/ and common/ (the HTTP implementation), and the new folder http/www (the root directory for the web app)

Pascal

Hi Pascal,

The modifications on the server side seems minimal, so I'll probably merge
them soon (or make you a member of "me-tv-development" as soon as I'm the
owner of it).

I look forward to see this in action...

Have a nice day,
Fred

On Tue, Feb 14, 2012 at 5:10 PM, Pascal Noisette <
<email address hidden>> wrote:

> Question #186655 on Me TV changed:
> https://answers.launchpad.net/me-tv/+question/186655
>
> Pascal Noisette posted a new comment:
> Hello,
>
> I have just pushed my refactoring with http, and a sample action
> (register) to show where I am going.
>
> To respect your advice about separating the whole application from the
> http module, I just need me-tv-server to implement HTTP protocol. The
> file server thing can be done separately ( and as I was saying, for the
> moment I use an apache so I also release an appropriate vhost if you
> want to test)
>
> Please find in the lp:~netpascal0123/me-tv/me-tv_http branch the
> modification in server/ and common/ (the HTTP implementation), and the
> new folder http/www (the root directory for the web app)
>
> Pascal
>
> --
> You received this question notification because you are an answer
> contact for Me TV.
>

--
"In a world without walls, who really needs Windows"
"Nothing is foolproof because fools are so ingenious"

Hi,

An apache vhost is definitely hard work getting set up, so I push a py script (http://docs.python.org/library/simplehttpserver.html) to do the job instead.

It means that if you can checkout the program (bazaar is python driven) you can also run it without further configuration. In addition, no need to patch the me-tv-server as suggested above (#4) anymore.

Please find in lp:~netpascal0123/me-tv/me-tv_http_module an operational and independent http module (http/me-tv-http as executable and www/ containing the html from the previous branch).

Pascal

Hi Pascal,

Your first version was looking good but the fact that you remove the change
from the server is even better. Also removing the need for an big http
server is great too. I'm a step closer of getting a PPA in place and I'll
probably include your work.

This is looking good for the module "me-tv-http-module". I have now to do
the others: me-tv-client, me-tv-server and me-tv-common. :o)

Thanks for your work,
Frédéric Côté

On Sat, Feb 25, 2012 at 8:35 AM, Pascal Noisette <
<email address hidden>> wrote:

> Question #186655 on Me TV changed:
> https://answers.launchpad.net/me-tv/+question/186655
>
> Pascal Noisette posted a new comment:
> Hi,
>
> An apache vhost is definitely hard work getting set up, so I push a py
> script (http://docs.python.org/library/simplehttpserver.html) to do the
> job instead.
>
> It means that if you can checkout the program (bazaar is python driven)
> you can also run it without further configuration. In addition, no need
> to patch the me-tv-server as suggested above (#4) anymore.
>
> Please find in lp:~netpascal0123/me-tv/me-tv_http_module an operational
> and independent http module (http/me-tv-http as executable and www/
> containing the html from the previous branch).
>
> Pascal
>
> --
> You received this question notification because you are an answer
> contact for Me TV.
>

--
"In a world without walls, who really needs Windows"
"Nothing is foolproof because fools are so ingenious"

I close this topic, the light http client has been merged to the main branch.

Thank you,
Pascal