Bug 3162 - p0 in web url without a dispatch handler prevents "generateHTTPResponse"
: p0 in web url without a dispatch handler prevents "generateHTTPResponse"
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: CLI
: 6.5b1
: PC Windows (legacy)
: P2 normal (vote)
: ---
Assigned To: Dan Sully
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-03-15 14:06 UTC by KDF
Modified: 2006-04-18 00:02 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description KDF 2006-03-15 14:06:11 UTC
move up, move down, and delete fail becuase they are passed to the executeRequest, and never get passed on to the web page handler in the plugin for the custom processing.  

debug:
2006-03-15 13:48:38.9638 Request [move 1 -1]: no match in dispatchDB!

maybe for legacy support, such things should allow passing off to the web page handler if none exists? maybe it already does, and this is slipping up?
Comment 1 Fred 2006-03-15 15:19:02 UTC
I don't fully understand what is happening here, because executeRequest should return the same thing execute did, and I did not change anything in ProcessURL. I have the code here but cannot run it, and what happens to p0 escapes me...
Will look it up.
Comment 2 KDF 2006-03-15 15:22:49 UTC
can likely fix favorites by adding a dispatch handler (which I'll do tonight), but I'm still curious about backward compatibility.  The fault condition with the current build, seems to hang the http engine by never providing the response.   
could a failed dispatch still issue the $callbackf?  otherwise, perhaps Slim::Web::HTTP::processURL should check the $request return and properly end the reponse?
Comment 3 KDF 2006-03-15 15:29:10 UTC
I think the problem is here:

	if (defined($p[0])) {

		if (defined($params->{"player"}) && $params->{"player"} eq "*") {

			for my $client2 (Slim::Player::Client::clients()) {

				next if $client eq $client2;

				$client2->execute(\@p);
			}
		}

		Slim::Control::Request::executeRequest($client, \@p, \&generateHTTPResponse, \@callbackargs);

	} else {

		generateHTTPResponse(@callbackargs);
	}

if the request is not dispatchable, then given HTTP::processURL():
Slim::Control::Request::executeRequest($client, \@p, \&generateHTTPResponse, \@callbackargs);

means the generateHTTPResponse never gets called.  Favorites currently processes a custom command query via Favorites::Plugin::handleWebIndex. The page constantly shows the spiralling cursor becuase the page is expecting a response that does not come.

I think something similar was mentioned on the forum; it is a probem that ONLY happens when the url is using p0=..., since processURL traps $p[0] to determine that the url contains a 'command'
Comment 4 Fred 2006-03-15 15:49:25 UTC
Well, the callback question is a philosophical one. Should callback be called if the request failed? Given callback is mainly used for webpages, I'd say yes, even though in their current implementation they won't have a clue the request DID fail (not that they had any before; I am just saying they probably should take advantage of the additional metadata the Request mechanism provides).

Implementing command handlers for favourites is good. That makes them available from the CLI (with the addition of something to return the favourites of course, which I can take care of in due course). My current "namespace" for plugins commands is "plugin.command", f.e. "favourites.move".


Comment 5 KDF 2006-03-15 16:15:32 UTC
the problem in this case is that there is no request expected to be made.  the p0... params are intended for the handler (as is the case for a couple plugins mentioned in the dev forum: http://forums.slimdevices.com/showthread.php?t=D21527).  There is no telling how many will trip over this.

I dont think the http server should ever be blocked from sending a response, but I can see the problem of timing it so that it happens post-request.  

I've used "favorites" "move" and "favorites" "delete", since I could find no other examples.  easily changed, and I'll patch tonight.  I'll reword the summary later to better reflect the remaining issue.  I'm not sure how to solve that one.   I do wonder how many other visible symptoms arise from a failed request blocking the http response.
Comment 6 KDF 2006-03-15 19:13:11 UTC
favorites plugin fixed at change 6602. remarking summary to reflect remaining issue.  needs direction from SD.
Comment 7 Fred 2006-03-19 16:14:33 UTC
Changed 6624 to always call the callback

Also in 6625 slight rework on the favorite request handling code
Comment 8 Fred 2006-04-16 17:23:14 UTC
Fixed, no?
Comment 9 KDF 2006-04-18 00:02:00 UTC
ah yes, sorry.  missed your last note.