#37 Workaround for Samsung Smart TV 2012

Unstable (example)

New models of Samsung Smart TV violate RFC2396. As we can see in bug #3530232, the Request-Line contains a URI that is supposed to be an abs_path but in reality has a form of net_path. As a consequence, "//upnp/control/cds" is split into "upnp" as the authority and "/control/cds" as the abs_path. Later when MediaTomb tries to find the requested resource, it doesn't recognize "/control/cds" as something it can serve (as opposed to "/upnp/control/cds" which is a valid resource served by MediaTomb).

This patch strips excessive leading slashes if the scheme part was not found. Unfortunately this breaks the aforementioned RFC, specifically parsing URIs starting with a net_path will no longer work. I'm not sure if it actually impacts MediaTomb in any way. Are net_path URIs used in DLNA?

I will try to contact Samsung, see if they can fix their implementation.


  • Comment has been marked as spam. 

    You can see all pending comments posted by this user  here

    Anonymous - 2012-06-07
    Last edit: Anonymous 2014-08-20
  • Brent

    Brent - 2012-06-28

    Can you please explain how to use the "mediatomb-urifix.patch"? I'm not sure how to incorporate this into my mediatomb setup.


  • BlueH

    BlueH - 2012-06-30

    Good job swiergot !! I've just patched my FreeNAS 8.0.4 and it works perfectly.
    To breasthead: go to the location of uri.c within mediatomb source codes and just apply the patch: $> patch < <patch_file>
    Than just continue: $> make install

  • Brent

    Brent - 2012-07-02

    Thanks dflegl,
    However, I'm running a static build of mediatomb 0.12.0 SVN 2017 (compiled by another) on a NAS box, as such I don't have the source ... nor the development tools needed to compile that way. I trust there is no way to patch via edits to the config.xml?


  • BlueH

    BlueH - 2012-07-02

    You need to compile the Mediatomb personally not to rely on prepared packages. So you need to download the whole sources of Mediatomb, patch the mentioned file and finaly finalize the installation with magic keyword $> make install. It's simple.
    e.g. for FreeNAS I did.
    0) Download and install FreeBSD 8.2 to the Virtual Box
    1) go the the port: $> cd /usr/ports/net/mediatomb
    2) download and stop before building: $> make patch
    3) patch the uri.c itself as mentioned before
    4) finalize the installation $> make install
    5) copy the compiled binary "mediatomb" to the flashdisk with FreeNAS

    A bit long but simple.

  • BlueH

    BlueH - 2012-07-02

    btw: I'm using the same version used on FreeNAS 8.0.4 and currently building such NAS server. If you'd need I can provide you the compiled binary. It depends on you.
    This approach I've verified with Samsung UE40ES7000.

  • Brent

    Brent - 2012-07-03


    Well if you can provide the patched binary, in a static build (ie with all dependable libraries bundled) that would be great!!
    I myself am running it on a fun-plug'd dlink323 nas, which as I said currently doesn't have any development environment. I think I can get everything I need to compile on there (after all the guy who's build I'm currently using did it), but I'm not too confident that I won't kill everything else I have going on the box!


  • Spencer Oliver

    Spencer Oliver - 2012-07-25

    Thanks, this patch solves problems i was having with an ES6300.

  • Mark Boddington

    Mark Boddington - 2012-09-04


    Just found this thread after submitting my own patch to the bug... Doh!

    I don't use sourceforge.

    Anyway, my patch should workaround Samsungs broken client without affecting ABSOLUTE URIs, I only remove the additional leading slash if it was found not to be ABSOLUTE.

  • Schneider

    Schneider - 2012-10-10

    Hello, I like mediatomb. But I have problem describe here.
    I try made patched mediatomb 0.12.1 for ubuntu 12. But get some errors at the "make" procedure.


    sqlite3 : yes
    mysql : yes
    libjs : yes
    libmagic : yes
    inotify : yes
    libexif : yes
    id3lib : disabled
    taglib : yes
    libmp4v2 : yes
    ffmpeg : yes
    ffmpegthumbnailer : yes
    lastfmlib : missing
    external transcoding : yes
    curl : yes
    YouTube : yes
    libextractor : disabled
    db-autocreate : yes

    make ....
    ../src/zmm/object.h:51:32: ошибка: декларация «operator new» как не-функции
    ../src/zmm/object.h:51:27: ошибка: expected «;» at end of member declaration
    ../src/zmm/object.h:51:39: ошибка: expected «)» before «size»
    In file included from ../src/scripting/playlist_parser_script.h:36:0,
    from ../src/content_manager.h:46,
    from ../src/autoscan.cc:38:
    ../src/scripting/script.h:69:5: ошибка: «JSScript» не является именем типа
    ../src/scripting/script.h:70:5: ошибка: «JSScript» не является именем типа
    ../src/scripting/script.h:118:5: ошибка: «JSScript» не является именем типа
    ../src/scripting/script.h:119:19: ошибка: «JSScript» не был декларирован
    make[2]: *** [libmediatomb_a-autoscan.o] Ошибка 1

    How I can fix it. Or please make the static binary with URI-patch.

  • Comment has been marked as spam. 

    You can see all pending comments posted by this user  here

    Anonymous - 2012-10-16

    Mediatomb + Samsung TV 2012: Debian-way Squeeze. Testing on ES7507
    Add deb-src repo to /etc/apt/sources.list
    # apt-get update
    # cd /usr/src/
    # apt-get install dpkg-dev
    # apt-get install devscripts
    # apt-get install fakeroot
    # apt-get build-dep mediatomb
    # apt-get source -d mediatomb
    # ls -1
    # dpkg-source -x mediatomb_0.12.0~svn2018-6.1.dsc
    Download patch to /usr/src/mediatomb-0.12.0~svn2018/debian/patches/mediatomb-urifix.patch
    # echo mediatomb-urifix.patch >> /usr/src/mediatomb-0.12.0~svn2018/debian/patches/series
    # mcedit /usr/src/mediatomb-0.12.0~svn2018/debian/patches/mediatomb-urifix.patch
    Remove first line ("diff ... ")
    Change second line:
    --- mediatomb.orig/tombupnp/upnp/src/genlib/net/uri/uri.c 2012-06-06 23:01:22.000000000 +0200
    --- a/tombupnp/upnp/src/genlib/net/uri/uri.c
    Change three line:
    +++ mediatomb/tombupnp/upnp/src/genlib/net/uri/uri.c 2012-06-07 08:22:01.000000000 +0200
    +++ b/tombupnp/upnp/src/genlib/net/uri/uri.c
    # cd /usr/src/mediatomb-0.12.0~svn2018/
    # dch -i

    * Non-maintainer upload.
    * Samsung Smart TV 2012 fix by swiergot

    # dpkg-buildpackage -rfakeroot
    # ls -1
    # dpkg -i mediatomb-common_0.12.0~svn2018-6.2_i386.deb
    # dpkg -i mediatomb-daemon_0.12.0~svn2018-6.2_all.deb
    # dpkg -i mediatomb_0.12.0~svn2018-6.2_all.deb

    Last edit: Anonymous 2013-11-26
  • BlueH

    BlueH - 2012-10-17

    Hi taylor1477,
    I'm running it on FreBSD system. So such binary I'm able to provide you, but not Ubuntu distro. Sorry.

  • Leonid Podolny

    Leonid Podolny - 2012-11-24

    Great job, swiergot!!
    Prepared a patched Fedora RPM, works flawlessly.
    Two questions:
    a) will this patch go into official mediatomb sources or will I need to patch the RPM again when new version of mediatomb is released?
    b) did you hear back from samsung support?

  • Maxim

    Maxim - 2012-12-26

    Awesome! Works perfectly on my Sheevaplug!

  • Jin

    Jin - 2013-12-25
    • status: open --> closed-accepted
    • assigned_to: Jin
    • Group: --> Unstable (example)
  • Jin

    Jin - 2013-12-25

    Hope it does not affect any other devices, applied.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks