GNOME Bugzilla – Bug 590643
refactor HTTP request handling code
Last modified: 2009-09-02 23:30:18 UTC
Attached are some patches to clean up the request handling code a bit. This gets rid of a bunch of "if (this.transcoder != null)" conditionals in rygel-http-request.vala, and should make it easier to integrate non-GStreamer based transcoders (e.g. a jpeg transcoder or a thumbnailer). It also fixes a few small bugs: * Only set the tcp-timeout property on the GStreamer source element if the element has that property. * Fix a bug in the range header generation. It was not specifying the end position if the client sent an open range, even though it knew the length of the resource. * Only output the Range/TimeSeekRange headers if the corresponding request headers were present.
Created attachment 139795 [details] [review] 0001-Push-responsibility-for-creating-GStreamer-sources-t.patch
Created attachment 139796 [details] [review] 0002-Factor-out-the-request-handling-code-into-an-HTTPReq.patch Part two.
Created attachment 139797 [details] [review] 0002-Factor-out-the-request-handling-code-into-an-HTTPReq.patch Fixed version of second patch -- forgot to use "git commit -a"
Created attachment 141633 [details] [review] 0001-Push-responsibility-for-creating-GStreamer-sources-t.patch
Created attachment 141634 [details] [review] 0002-Factor-out-the-request-handling-code-into-an-HTTPReq.patch Updated and rebased patches.
Created attachment 141739 [details] [review] 0001-Push-responsibility-for-creating-GStreamer-sources-t.patch
Created attachment 141740 [details] [review] 0002-Factor-out-the-request-handling-code-into-an-HTTPReq.patch
commit 598a9588351c04d1379f97c9a16aa93e60d0378a Author: James Henstridge <james@jamesh.id.au> Date: Mon Aug 3 21:06:51 2009 +0800 core: Refactor: request handling into separate interface Factor out the request handling code into an HTTPRequestHandler interface. The interface is implemented by Rygel.Transcoder and an "identity request handler" used to serve items as is. commit c412f9c4a08d54beefe5a34767ef58a6321b5e32 Author: James Henstridge <james@jamesh.id.au> Date: Mon Aug 3 18:16:31 2009 +0800 core: Push creation of gst source to MediaItem Previously MediaItem.create_stream_source was only called for items that did not provide any URIs. If a URI was available, then HTTPRequest would create an element directly from it. Now HTTPRequest always calls create_stream_source and the default implementation knows how to create an element from a URI.
This was mostly good stuff and thats why I merged and pushed the changes. However, later while looking at some code I realized that this goes against one of my goals: HTTP-specific stuff be as separate as possible so that later on it's much easier to add more protocols (e.g RTSP) without messing-up the code. So I propose that we instead: * Make HTTPRequest an abstract class. * Merge HTTPRequestHandler into HTTPRequest. * Move current HTTPRequestHandler implementations into two new subclasses of HTTPRequest.
Issue resolved in rygel git master.