Feature #198


Streaming via HTTP

Added by Greg Burri about 12 years ago. Updated about 12 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:



  • Be able to stream media (video and audio) via HTTP
  • Be able to browse directories and files via a web browser


  • The user can double-click a media file in the browser tab of D-LAN and automatically open it with a media reader like VLC (The gui will just open a media-reader and send to it an http address).
  • The user can access the directories and files of a peer with a web browser by using this kind of address : http://<ip>/<shared dir>/<path>
  • There is no authentication and no need to use D-LAN on the client side
  • The bandwidth is limited by default per connection, for example 1 MiB/s. The connection may adapt its limitation automatically to the bitrate of the current media file.
  • The HTTP service can be stopped or activated at any moment
  • The media reader is chosen depending the file extension and the OS settings.

Settings (Core)

Activated: bool
Port: int
Upload_rate_limit: int [b/s]
auto_media_rate_limit: bool


  • A new component is created called HTTPServer.
  • A flag in the IMAlive message tells if a peer supports HTTP or not.
  • The component depends of FileManager. UploadManager and NetworkListener components depends of it.
  • UploadManager listen for a signal to tell it to upload some chunks. The signal signature may be void getChunks(QList<QSharedPointer<FM::IChunk>> chunks, int offset, QSharedPointer<PM:ISocket> socket). The offset corresponds to the the first chunk of the list, the uploader will send all the given chunks in the order.
  • PM:ISocket should be moved in the Common namespace.
  • The http ISocket implementation can limits the bandwidth.
  • The method QList<QSharedPointer<IChunk>> getAllChunks(const Protos::Common::Entry& localEntry) const should be added to IFileManager.
  • This kind of http headers must be supported.
    GET /test.mkv HTTP/1.1
    User-Agent: VLC/2.0.0 LibVLC/2.0.0
    Range: bytes=544326882-
    Connection: close
    HTTP/1.1 206 Partial Content
    Date: [..]
    Server: [..]
    Last-Modified: Thu, 05 Apr 2012 20:23:46 GMT
    Accept-Ranges: bytes
    Content-Length: 164615087
    Content-Range: bytes 544326882-708941968/708941969
    Connection: close
    Content-Type: text/plain

Sequence for uploading a file

  1. NetworkListener -> newConnection(socket) -> HTTPServer
  2. HTTPServer receives a GET command for a file
  3. HTTPServer -> getAllChunks(entry) -> FileManager
  4. HTTPServer -> <<signal>> getChunks([chunk], offset, socket) -> UploadManager

Sequence for printing a directory content

  1. NetworkListener -> newConnection(socket) -> HTTPServer
  2. HTTPServer receives a GET command for a directory
  3. HTTPServer -> getEntries(entry) -> FileManager
  4. HTTPServer send a html page to the socket to show the entries
Actions #1

Updated by Greg Burri about 12 years ago

  • Category set to HTTPServer
  • Platform Linux, Mac OSX, Windows XP added
Actions #2

Updated by Greg Burri about 12 years ago

  • Platform deleted (Linux, Mac OSX, Windows Seven, Windows XP)

Also available in: Atom PDF