PDA

View Full Version : HandHeld skin problems in 6.2b2



mikeb
2005-10-19, 15:01
It's been a while since I used my PDA for SlimServer control, but I've
run in to a problem with it.

This is running on an HP iPAQ with Windows Mobile 2003 Second Edition
using Internet Explorer.

When on the status screen I click the next button and the song
advances, but when it refreshes the next time I get a 403 Forbidden.

Changing the CSRF Protection Level to None solves this but introduces
another problem.

The next time it refreshes it works fine, but the following time and
every time after that it automatically hits next.

Basically I hear 30 seconds of every song before the PDA's refreshing
of the URL advances the song without user intervention.

As you can imagine this makes the HandHeld skin pretty useless at this
point.

Does anyone have some input on how to solve this or troubleshooting I
can do to get to the root of the problem to get this fixed?

-- Mike

mherger
2005-10-19, 22:00
Mike

> This is running on an HP iPAQ with Windows Mobile 2003 Second Edition
> using Internet Explorer.

I still don't have a PocketPC to test with :-/.

> When on the status screen I click the next button and the song advances,
> but when it refreshes the next time I get a 403 Forbidden.
>
> Changing the CSRF Protection Level to None solves this but introduces
> another problem.
>
> The next time it refreshes it works fine, but the following time and
> every time after that it automatically hits next.

I can't reproduce this. Neither the CSRF problem nor the automatic skip.
But there was some redundant code in the HTML which might have caused
problems (redirect using both the meta tag and javascript). I checked in a
change for this to subversion. It should be in the 20/10 nightly. Please
report back if this fixes your problem.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

mikeb
2005-10-19, 23:26
The javascript change did not solve the problem.


I just confirmed what I had thought though. The problem is that every
web client enters the status.html args;
p0=playlist&p1=jump%p2=%2b1%player=... when you hit next.

Then they refresh to; start=0&refresh=1&player=... just like
status.html tells it to.

Except IE on Windows Mobile refreshes to the first URL.


I can confirm this was not broken in 5.6. I don't remember if it was
in 6.0 or not, but it was in 6.1.1.

So.. whatever the change in refreshing that occurred somewhere in
there is what is causing the problem.

I imagine the code at fault is in Internet Explorer, but it's easier
to code around it than get them to fix it ;-).

Let me know if I can test anything else.

-- Mike

Michael Herger wrote:
> Mike
>
>> This is running on an HP iPAQ with Windows Mobile 2003 Second Edition
>> using Internet Explorer.
>
>
> I still don't have a PocketPC to test with :-/.
>
>> When on the status screen I click the next button and the song
>> advances, but when it refreshes the next time I get a 403 Forbidden.
>>
>> Changing the CSRF Protection Level to None solves this but introduces
>> another problem.
>>
>> The next time it refreshes it works fine, but the following time and
>> every time after that it automatically hits next.
>
>
> I can't reproduce this. Neither the CSRF problem nor the automatic
> skip. But there was some redundant code in the HTML which might have
> caused problems (redirect using both the meta tag and javascript). I
> checked in a change for this to subversion. It should be in the 20/10
> nightly. Please report back if this fixes your problem.
>

mherger
2005-10-19, 23:39
> I can confirm this was not broken in 5.6. I don't remember if it was in
> 6.0 or not, but it was in 6.1.1.

Wow... hard to tell what's broken since 5.4 (I guess, 5.6 never existed?).
I'll have a look through the logs.

> I imagine the code at fault is in Internet Explorer, but it's easier to
> code around it than get them to fix it ;-).

If IE doesn't properly interpret the refresh meta tag, we'll have a
problem. :-( Let's google a bit...

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

mikeb
2005-10-20, 00:14
Michael Herger wrote:
>> I can confirm this was not broken in 5.6. I don't remember if it was
>> in 6.0 or not, but it was in 6.1.1.
>
>
> Wow... hard to tell what's broken since 5.4 (I guess, 5.6 never
> existed?). I'll have a look through the logs.

Ugh. I work on routers and have been updating a document referencing
JunOS 5.6 all day ;-). 5.4 is what I meant, yes.


>> I imagine the code at fault is in Internet Explorer, but it's easier
>> to code around it than get them to fix it ;-).
>
>
> If IE doesn't properly interpret the refresh meta tag, we'll have a
> problem. :-( Let's google a bit...

I just did a little test;

mikeb@pinky:/home/mikeb/public_html/tmp$ cat wrong.html
<html>
<head><meta http-equiv="refresh"
content="5;url=right.html"></head>
<body>
This is the wrong page.
</body>
</html>
mikeb@pinky:/home/mikeb/public_html/tmp$ cat right.html
<html>
<body>
This is the right page.
</body>
</html>


And it did refresh to the right.html page properly.. I haven't looked
too deeply at it, is the javascript doing anything odd that could be
causing it?

-- Mike

mherger
2005-10-20, 01:16
> I tried a handful of combinations including these and could not recreate
> it. I also tried also passing arguments to the redirecting page. They
> all work.

And if you add

<meta http-equiv="refresh" content="5;
url=right.html?start=0&refresh=1&player=a6%3Abd%3Ab8%3A7d%3Aea%3Aac">

it does not work? Then try it the other way round... start removing the
player id.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

mikeb
2005-10-20, 15:43
Michael Herger wrote:
>> I tried a handful of combinations including these and could not
>> recreate it. I also tried also passing arguments to the redirecting
>> page. They all work.
>
>
> And if you add
>
> <meta http-equiv="refresh" content="5;
> url=right.html?start=0&refresh=1&player=a6%3Abd%3Ab8%3A7d%3Aea%3Aac">
>
> it does not work? Then try it the other way round... start removing the
> player id.

Ok, I recreated it. The problem is the second page refreshing apparently.

wrong.html did;

<meta http-equiv="refresh" content="5;url=right.html">


right.html did;

<meta http-equiv="refresh" content="5;url=right.html">


And it would constantly flip between the two with every refresh.


Interestingly, when the url= is different it will refresh properly
once. This is exactly what I'm seeing with the Handheld skin.

right.html now says;

<meta http-equiv="refresh" content="5;url=right.html?different">

httpd logs read;

192.168.1.16 - - [20/Oct/2005:15:16:34 -0700] "GET
/~mikeb/tmp/wrong.html HTTP/1.1" 200 127 "-" "Mozilla/4.0 (compatible;
MSIE 4.01; Windows CE; PPC; 240x320)"
192.168.1.16 - - [20/Oct/2005:15:16:39 -0700] "GET
/~mikeb/tmp/right.html HTTP/1.1" 200 137 "-" "Mozilla/4.0 (compatible;
MSIE 4.01; Windows CE; PPC; 240x320)"
192.168.1.16 - - [20/Oct/2005:15:16:45 -0700] "GET
/~mikeb/tmp/right.html?different HTTP/1.1" 200 137 "-" "Mozilla/4.0
(compatible; MSIE 4.01; Windows CE; PPC; 240x320)"
192.168.1.16 - - [20/Oct/2005:15:16:50 -0700] "GET
/~mikeb/tmp/wrong.html HTTP/1.1" 200 127 "-" "Mozilla/4.0 (compatible;
MSIE 4.01; Windows CE; PPC; 240x320)"
192.168.1.16 - - [20/Oct/2005:15:16:55 -0700] "GET
/~mikeb/tmp/right.html HTTP/1.1" 200 137 "-" "Mozilla/4.0 (compatible;
MSIE 4.01; Windows CE; PPC; 240x320)"
192.168.1.16 - - [20/Oct/2005:15:17:01 -0700] "GET
/~mikeb/tmp/right.html?different HTTP/1.1" 200 137 "-" "Mozilla/4.0
(compatible; MSIE 4.01; Windows CE; PPC; 240x320)"

I wonder if we put a random argument that changes with every refresh
in the Handheld meta tag if it would solve the problem. I don't see
an obvious Template Toolkit function for random, am I missing one?

-- Mike

mherger
2005-10-20, 23:52
> I wonder if we put a random argument that changes with every refresh in
> the Handheld meta tag if it would solve the problem. I don't see an
> obvious Template Toolkit function for random, am I missing one?

There is: Math.rand - math the math plugin is not installed. One solution
just good enough might be adding seconds to the url. Try the following in
the Handheld/pageheader.html:

[% IF refresh && refreshurl %]<meta http-equiv="refresh" content="[%
refresh %]; [% refreshurl %]&player=[% player | uri %]&rand=[% USE Date;
Date.format(Date.now, '%M%S') %]">[% END %]

This should add a parameter rand=2345 to the url (minutes and seconds).

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

mikeb
2005-10-21, 01:14
Michael Herger wrote:
>> I wonder if we put a random argument that changes with every refresh
>> in the Handheld meta tag if it would solve the problem. I don't see
>> an obvious Template Toolkit function for random, am I missing one?
>
>
> There is: Math.rand - math the math plugin is not installed. One
> solution just good enough might be adding seconds to the url. Try the
> following in the Handheld/pageheader.html:
>
> [% IF refresh && refreshurl %]<meta http-equiv="refresh" content="[%
> refresh %]; [% refreshurl %]&player=[% player | uri %]&rand=[% USE
> Date; Date.format(Date.now, '%M%S') %]">[% END %]
>
> This should add a parameter rand=2345 to the url (minutes and seconds).
>

Sweet, this worked.

I actually made it %s as that should always be unique, and added a
semicolon after Date.format();

[% IF refresh && refreshurl %]<meta http-equiv="refresh"
content="[% refresh %]; [% refreshurl %]&player=[% player | uri
%]&rand=[% USE Date; Date.format(Date.now, '%s'); %]">[% END %]

Nasty hack to get around it.. but at least it works.

Thanks Michael.

-- Mike

mherger
2005-10-21, 01:41
> I actually made it %s as that should always be unique, and added a
> semicolon after Date.format();

Are you on Linux? On my Windows %s does not return a value :-/. I checked
in my '%M%S' version - does the job, too.

> Nasty hack to get around it.. but at least it works.

Yeah! Thanks a lot for the testing! In fact, there was bug 2084
(http://bugs.slimdevices.com/show_bug.cgi?id=2084) which we were never
able to reproduce. You tracked it down. Thanks!

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

mikeb
2005-10-21, 02:05
Michael Herger wrote:
>> I actually made it %s as that should always be unique, and added a
>> semicolon after Date.format();
>
>
> Are you on Linux? On my Windows %s does not return a value :-/. I checked
> in my '%M%S' version - does the job, too.

I'm actually in FreeBSD, but I was worried about that. I remembered
that Solaris strftime() doesn't have a %s as soon as I sent that. I
would make it %Y%m%d%M%S then.. just to ensure uniqueness. I just
confirmed that works with a;

perl -e 'use POSIX; print strftime("%Y%m%d%M%S", localtime) . "\n";'

in FreeBSD, Linux, Solaris, and MacOS X. If that works for you in
Windows it looks like we have a winner.


>> Nasty hack to get around it.. but at least it works.
>
>
> Yeah! Thanks a lot for the testing! In fact, there was bug 2084
> (http://bugs.slimdevices.com/show_bug.cgi?id=2084) which we were never
> able to reproduce. You tracked it down. Thanks!

Very cool to hunt down odd bugs, I'm glad to help. Unfortunately
there are still some features which require CSRF to be turned off, but
nothing that seems to get in the way of it functioning as expected.
Hopefully Microsoft can fix the buggy browser in the next Windows
Mobile release.

--mikeb

oreillymj
2005-10-21, 02:44
Michael,

Personnaly I've run the handheld skin on my PSP and never had any problem with it, so the change you've made is just a work-around for IE.

Can I suggest you add a comment to change 4917 to explain why you need to make a random change to the URL.

Otherwise you run the risk of someone thinking this is unnecessary and removing it while cleaning up the code.

mherger
2005-10-21, 02:48
> I'm actually in FreeBSD, but I was worried about that. I remembered
> that Solaris strftime() doesn't have a %s as soon as I sent that. I
> would make it %Y%m%d%M%S then.. just to ensure uniqueness.

I checked it in. Thanks a lot! This should be in tomorrow's nightly build.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

mherger
2005-10-21, 03:07
> Personnaly I've run the handheld skin on my PSP and never had any
> problem with it, so the change you've made is just a work-around for
> IE.

Correct. My good, old Zaurus and it's Opera 7.x work perfectly well, too
:-)

> Can I suggest you add a comment to change 4917 to explain why you need
> to make a random change to the URL.

Good idea. I'll do this. Thanks!

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)