Bug 9869 - HTTP GET with request method-body causes error from Squid proxy
: HTTP GET with request method-body causes error from Squid proxy
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Misc
: 7.2.1
: PC All
: -- minor (vote)
: 7.x
Assigned To: Michael Herger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-11-01 11:01 UTC by Kensaku Yamaguchi
Modified: 2009-07-31 10:31 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kensaku Yamaguchi 2008-11-01 11:01:10 UTC
I get many messages like this in my SqueezeCenter server log:

[08-11-02 01:30:27.0130] Slim::Networking::Discovery::Players::_players_error (140) Unable to get players: 411 Length Required

There are two SqueezeCenter instances running in my network, one on a Windows PC and another on a gateway machine that also runs the Squid Web proxy.
The messages appear in log files on the PC.
The "411 Length Required" error is being generated by Squid.

What's happening is, SqueezeCenter on the PC tries to send an HTTP GET request to SqueezeCenter on the gateway (probably to get a list of available players), and since the PC is configured to use a proxy, the request goes to Squid.
However, the HTTP request contains a non-zero Content-Length header, which is not strictly correct HTTP.

Squid denies such requests by default.  From Squid's manual:
> Squid defaults to deny GET and HEAD requests with request entities,
> as the meaning of such requests are undefined in the HTTP standard
> even if not explicitly forbidden.

I suspect the error can be fixed by simply changing line 101 of Slim/Networking/Discovery/Players.pm, and replacing $http->get() with $http->post().
Comment 1 Michael Herger 2008-11-02 14:11:02 UTC
> I suspect the error can be fixed by simply changing line 101 of
> Slim/Networking/Discovery/Players.pm, and replacing $http->get() with
> $http->post().

Could you please give this a try?
Comment 2 Kensaku Yamaguchi 2008-11-04 18:03:08 UTC
> Could you please give this a try?

At first I didn't know how, because this was on Windows.
After some unsuccessful attempts trying to use Cygwin's perl interpreter, I have installed ActivePerl and can now run scripts modified by myself.

I tried the change I suggested, and it appears to work correctly.
Before I changed the script, when I ran slimsever.pl, it was printing "411 Length Required" in the log file.
After I changed the script to use http->get() instead of http->post(), I no longer see any new error messages in the log file.

There are now two items I can select in the "Choose player" drop down menu on the SqueezeCenter Web interface: the name of the other machine (gateway box) running SqueezeCenter, and the name of the player (SqueezeBox Receiver) that is currently connected to the other machine.
I suppose this means that communication between the two SqueezeCenter instances is working properly.

(However, this may be another issue, but in the gateway machines's drop down menu, I only see the name of the SqueezeBox Receiver, and I do not see and never have seen the name of the Windows PC there.
The gateway box does not report any "411 Length Required" errors, even though it is configured to use the same Squid proxy.)

Windows PC:
  SqueezeCenter 7.2.1
  ActivePerl 5.8.8 Build 824
  Windows 2000 SP4

gateway:
  SqueezeCenter 7.2.1
  perl v5.8.8 built for i486-linux-gnu-thread-multi
  Debian GNU/Linux 4.0
Comment 3 Kensaku Yamaguchi 2008-11-04 18:08:12 UTC
> After I changed the script to use http->get() instead of http->post(), I no
> longer see any new error messages in the log file.

Sorry, this was the other way around.
I had changed the script to use http->post(), where it was using http->get().
Comment 4 Kensaku Yamaguchi 2008-11-04 18:18:10 UTC
> (However, this may be another issue, but in the gateway machines's drop down
> menu, I only see the name of the SqueezeBox Receiver, and I do not see and
> never have seen the name of the Windows PC there.
> The gateway box does not report any "411 Length Required" errors, even though
> it is configured to use the same Squid proxy.)

I should also note that, I have not applied the suggested fix to the SqueezeCenter scripts running on the gateway machine.
However, I have added a "request_entities on" line to the Squid configuration file, that should have the same effect.
(I temporarily removed the "request_entities on" line when I tested the program on Windows.)
Comment 5 Chris Owens 2008-11-10 09:23:26 UTC
Andy thinks this is a bug, it's sending a post request using 'get'
Comment 6 Michael Herger 2008-11-11 05:09:18 UTC
change 23896 - use POST instead of GET method. Please re-open if this didn't fix your issue. Thanks!
Comment 7 James Richardson 2008-12-15 12:09:04 UTC
This bug has been fixed in the 7.3.0 release version of SqueezeCenter!

Please download the new version from http://www.slimdevices.com/su_downloads.html if you haven't already.  

If you are still experiencing this problem, feel free to reopen the bug with your new comments and we'll have another look.
Comment 8 Chris Owens 2009-07-31 10:31:28 UTC
Reduce number of active targets for SC