Bug 8449 - web service does not respond if simple file not readable
: web service does not respond if simple file not readable
Status: RESOLVED WORKSFORME
Product: Logitech Media Server
Classification: Unclassified
Component: Web Interface
: 7.4.0
: PC Other
: P3 normal (vote)
: 7.4.0
Assigned To: Michael Herger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-06-16 19:23 UTC by Peter Watkins
Modified: 2009-01-21 16:42 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments
patch to make SC7 send 404 if bad file perms (1.05 KB, patch)
2008-06-22 07:08 UTC, Peter Watkins
Details | Diff
beter patch? doesn't discriminate against old (pre-Epoch) files (1.03 KB, patch)
2008-06-22 09:09 UTC, Peter Watkins
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Watkins 2008-06-16 19:23:13 UTC
It is possible to bundle simple files with plugins that SqueezeCenter will serve as-is by putting them in a directory like Plugins/MyPlugin/HTML/EN/plugins/MyPlugin/html/ and referencing them with URLs like /plugins/MyPlugin/html/somefile.js

But if the file is not readable by the SqueezeCenter process, SC7.2 will not respond to the request. This can lead to long delays in page rendering as the browser waits for a response. Instead of hanging, SC7 should quickly return an HTTP 500 Server Error with a helpful message stating that the file was not readable.
Comment 1 Michael Herger 2008-06-17 00:02:17 UTC
Did you get some log entries when this happened? If not, can you turn on some http (or whatever needed) debugging to see whether this issue is reported in the log?
Comment 2 Michael Herger 2008-06-20 06:07:43 UTC
I got the following message in server.log

[08-06-20 15:03:57.7439] Slim::Web::HTTP::_generateContentFromFile (2309) Error: file error - : not found

and the browser immediately displayed an empty page. What were the permissions on that file? What browser were you using?
Comment 3 Peter Watkins 2008-06-21 05:54:13 UTC
Parent directory perms are 0755. File perms when the problem occurs -- 0700 (yeah, I know, it shouldn't be executable) but owned by a diff user. Change the file perms to 0744 and it works again.
Comment 4 Peter Watkins 2008-06-22 07:08:49 UTC
Created attachment 3471 [details]
patch to make SC7 send 404 if bad file perms

Here's a patch that makes SC7 send a simple 404 error if the file is not readable, and log a WARN message suggesting the user check the file permissions.

The core problem is that Slim/Web/HTTP.pm has at least one spot where it isn't checking the return code from a call to open() -- it blindly assumes that it can read the appropriate file. So this isn't the best fix, but it's an improvement, and perhaps good enough given that only 3rd party web content should ever be installed with bad permissions.

Thanks.
Comment 5 Peter Watkins 2008-06-22 09:09:19 UTC
Created attachment 3472 [details]
beter patch? doesn't discriminate against old (pre-Epoch) files
Comment 6 Michael Herger 2008-06-22 23:44:08 UTC
will take a look at this for 7.2 - thanks!
Comment 7 Michael Herger 2008-07-24 03:48:30 UTC
Punting post 7.2
Comment 8 Michael Herger 2008-08-14 04:36:47 UTC
Peter - Could you please upload a server.log file with debugging for http enabled? I'd like to better understand why this is locking up anything for you. It doesn't do this on my system. Thanks!
Comment 9 Michael Herger 2008-09-04 00:20:52 UTC
Peter - any news?
Comment 10 Michael Herger 2008-10-17 00:05:55 UTC
No new news?