hzeller / gmrender-resurrect

Resource efficient UPnP/DLNA renderer, optimal for Raspberry Pi, CuBox or a general MediaServer. Fork of GMediaRenderer to add some features to make it usable.
GNU General Public License v2.0
832 stars 202 forks source link

404 Not found while accessing from upnp client #135

Closed arasucreationz closed 6 years ago

arasucreationz commented 6 years ago

Hi, I am using this library in raspberry pi board, And i got one problem when i request file from browser. for example i'm requesting http://172.21.4.221:49494/upnp/renderconnmgrSCPD.xml, but in library it appending index.html like this - /upnp/renderconnmgrSCPD.xml/index.html so 404 File not fount error in browser and in library terminal - [webserver] 404 Not Found. (attempt to access non-existent /upnp/renderconnmgrSCPD.xml/index.html) is getting. please help me to solve this, i checked about auto index.html from apache2 but that is not calling, the port number is different.

Thanks in advance..

hzeller commented 6 years ago

I don't quite understand what the problem is. The gmediarenderer will serve the upnp/renderconnmgrSCPD.xml URL under that host and it will work fine.

I don't understand why you append /index.html when requesting the URL, but the service is exactly behaving as it should to return a 404 NOT FOUND when requesting a non-existing URL. You are not mentioning which library you are talking abou; gmrender-resurrect is a program acting as UPNP renderer, not a library.

arasucreationz commented 6 years ago

Hi, I'm using gmrender-resurrect program only, and i'm running in raspberry pi 3, gmrender is listening on 49494 port, From my Browser i request /upnp/renderconnmgrSCPD.xml, i'm getting 404 File not Found and the same time in Raspberry pi3 terminal i got [webserver] 404 Not Found. (attempt to access non-existent /upnp/renderconnmgrSCPD.xml/index.html) this message, But i'm requesting without index.html but gmrender-rescrrect is receiving a appended index.html with my actual request.

But when i run this gmrender-resurrect in my linux PC it is working fine.. There is an issue when i run in Raspberry pi3 platform. This is the main problem for me. please help me to solve this. Thank you.

arasucreationz commented 6 years ago

Hi, webserver_get_info(const char filename, struct File_Info info)** (From Webserver.c - Line 146) this function is calling from gboolean result = (UpnpVirtualDir_set_GetInfoCallback(webserver_get_info) == UPNP_E_SUCCESS (webserver.c line 293) this UPNP API, when i request /upnp/renderconnmgrSCPD.xml from my browser, the const char filename, is receiving with appended index.html and next logic says that request is invalid. but i'm requesting without index.html.

hzeller commented 6 years ago

What browser are you using ? Maybe you are using a browser that is trying to do something where it attempts to 'correct' a user input to a wrong request (Microsoft tools are notorious for that). I'd suggest to try with a simple wget or curl call or a browser such as Chrome or Firefox.

arasucreationz commented 6 years ago

Hi, I tried both wget and curl method, but not working. tried from Firefox and Chrome too. But same result.

hzeller commented 6 years ago

It is pretty unusual that you would get a different request received than you send. Maybe you have some dynamic proxy somewhere ?

You can also see things directly by manually speaking HTTP protocol, issuing a get request (don't forget the double newline):

$ telnet localhost 49494
Trying ::1...
Connected to localhost.
Escape character is '^]'.
GET /upnp/renderconnmgrSCPD.xml HTTP/1.1

HTTP/1.1 200 OK
CONTENT-LENGTH: 4783
CONTENT-TYPE: text/xml
DATE: Wed, 30 Aug 2017 13:30:48 GMT
LAST-MODIFIED: Thu, 01 Jan 1970 00:00:00 GMT
SERVER: Linux/4.9.0-3-amd64, UPnP/1.0, Portable SDK for UPnP devices/1.6.22
X-User-Agent: redsonic
CONNECTION: close

<?xml version="1.0"?>
<scpd xmlns="urn:schemas-upnp-org:service-1-0">
... (all the XML document omitted)

There is not much I can do here, you have to figure out what is broken in your set-up, it is not reproducible otherwise.