UA override not used on redirect

Bug #1509262 reported by Nicola
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical System Image
Fix Released
High
Bill Filler
Oxide
Fix Released
Medium
Olivier Tilloy
1.10
Fix Released
Medium
Olivier Tilloy
1.11
Fix Released
Medium
Olivier Tilloy
webbrowser-app (Ubuntu)
Invalid
High
Olivier Tilloy

Bug Description

How to reproduce on Aquaris E4.5:

- open the web browser
- search for a song on google
- click on a youtube video
- while page is loading turn up the volume to maximum
- when page is completely loaded tap on video to make it start

What should happen:
- music video should start at maximum volume

What really happens:
- music video don't start, even if you continue to tap on it

How to fix:

- close the web browser
- open the web browser
- wait for the page to reload
- play music video

Related branches

Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

Reproduced on stable

Changed in webbrowser-app (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Changed in canonical-devices-system-image:
assignee: nobody → Bill Filler (bfiller)
importance: Undecided → High
milestone: none → backlog
status: New → Confirmed
Revision history for this message
Olivier Tilloy (osomon) wrote :

I can’t reproduce on rc-proposed (krillin #156).

Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

I also reproduced it on mako running rc-proposed r268

The vol key does not seem to be part of the issue, the first time the youtube page loads the video will not play. Hitting refresh to reload the page will allow it to play.
When the page is reloaded the video shows "HQ" but not on first load

Revision history for this message
Nicola (jackoswebsolutions) wrote :

I have made this test with WIFI ON. I have don't check with normal network connection.

Revision history for this message
Nicola (jackoswebsolutions) wrote :

@Pat

For me problem comes up only while using the volume key, rarely without pressing it

Revision history for this message
Olivier Tilloy (osomon) wrote :

The volume key thing really sounds like a red herring.

@Nicola, can you confirm that when the video doesn’t play the original thumbnail doesn’t have the blue "HQ" icon in the bottom-left corner, whereas it has it when the video can play?

I’m able to reproduce the issue now, on krillin with the latest rc-proposed. It seems like a new symptom for bug #1499394.

Changed in webbrowser-app (Ubuntu):
assignee: nobody → Olivier Tilloy (osomon)
Revision history for this message
Olivier Tilloy (osomon) wrote :

What happens when opening a youtube video from google search results is the following:

GET /url?q=http://m.youtube.com/watch%3Fv%3D-tJYN-eG1zk&… HTTP/1.1
Host: www.google.fr

    HTTP/1.1 302 Found
    Location: http://m.youtube.com/watch?v=-tJYN-eG1zk

GET /watch?v=-tJYN-eG1zk HTTP/1.1
Host: m.youtube.com
User-Agent: Mozilla/5.0 (Linux; Ubuntu 14.04 like Android 4.4) AppleWebKit/537.36 Chromium/35.0.1870.2 Mobile Safari/537.36
Referer: http://www.google.fr/search?q=we+will+rock+you&

As can be seen from the second GET request, the UA override for youtube (http://bazaar.launchpad.net/~phablet-team/webbrowser-app/trunk/view/head:/src/Ubuntu/Web/ua-overrides-mobile.js#L23) hasn’t been applied.

Revision history for this message
Olivier Tilloy (osomon) wrote :

This appears to be a bug in oxide, where the user agent overrides are not used for redirections (e.g. HTTP 302).
I can reproduce locally with the following standalone code:

== server.py ==

#!/usr/bin/python3
# -*- coding: utf-8 -*-

import http.server as http
import threading

class HTTPRequestHandler(http.BaseHTTPRequestHandler):
    def do_GET(self):
        if self.path == "/foo":
            self.send_response(302)
            self.send_header("Location", "http://localhost:8080/bar")
            self.end_headers()
            self.wfile.write(b"foo")
        elif self.path == "/bar":
            self.send_response(200)
            self.send_header("Content-Type", "text/plain")
            self.end_headers()
            self.wfile.write(b"bar")
        else:
            self.send_error(404)

if __name__ == '__main__':
    server = http.HTTPServer(("", 8080), HTTPRequestHandler)
    server.allow_reuse_address = True
    server.serve_forever()

== client.qml ==

import QtQuick 2.4
import com.canonical.Oxide 1.9

WebView {
    url: "http://localhost:8080/foo"
    context: WebContext {
        userAgent: "default"
        userAgentOverrides: [
            ["^http:\/\/localhost:8080\/foo", "overridden1"],
            ["^http:\/\/localhost:8080\/bar", "overridden2"],
        ]
    }
}

Then run `python3 server.py` in one terminal, monitor network traffic with e.g. wireshark, and in another terminal run `qmlscene client.qml`.

The request to "/foo" has the first override as expected, but it redirects to "/bar" and the corresponding request still has the first override, instead of the second one.

Changed in webbrowser-app (Ubuntu):
status: Confirmed → Invalid
summary: - Browser stop working while watching a video on Youtube
+ UA override not used on redirect
Changed in oxide:
status: New → Confirmed
Revision history for this message
Nicola (jackoswebsolutions) wrote :

@Olivier

Confirmed ;-)

Revision history for this message
Olivier Tilloy (osomon) wrote :

The linked branch has a failing unit test for this issue. Now all that’s left to do is fix it :)

Changed in oxide:
assignee: nobody → Olivier Tilloy (osomon)
Olivier Tilloy (osomon)
Changed in oxide:
status: Confirmed → In Progress
importance: Undecided → Medium
Olivier Tilloy (osomon)
Changed in oxide:
status: In Progress → Fix Released
Olivier Tilloy (osomon)
Changed in canonical-devices-system-image:
status: Confirmed → In Progress
Changed in canonical-devices-system-image:
milestone: backlog → ww46-2015
Changed in canonical-devices-system-image:
status: In Progress → Fix Committed
Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.