Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Serve full installer instead of stub for XP
See bug 1234874 for details
  • Loading branch information
jgmize committed Dec 24, 2015
1 parent 89bb8a7 commit 0da1236
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions handlers.go
Expand Up @@ -291,10 +291,10 @@ func (b *BouncerHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {

// HACKS
// If the user is coming from windows xp, send a sha1
// signed product.
// signed product, replacing "-stub" with "-ssl"
// HACKS
if (os == "win" || os == "win64") && isWindowsXPUserAgent(req.UserAgent()) {
product = sha1Product(product)
product = strings.Replace(sha1Product(product), "-stub", "-ssl", 1)
}

url, err := b.URL(lang, os, product)
Expand Down
12 changes: 12 additions & 0 deletions handlers_test.go
Expand Up @@ -89,6 +89,18 @@ func TestBouncerHandlerValid(t *testing.T) {
bouncerHandler.ServeHTTP(w, req)
assert.Equal(t, 302, w.Code)
assert.Equal(t, "https://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0.1/win64/en-US/Firefox%20Setup%2043.0.1.exe", w.HeaderMap.Get("Location"))

// Test Windows XP does not get stub installer
w = httptest.NewRecorder()
req, err = http.NewRequest("GET", "http://test/?product=Firefox-stub&os=win&lang=en-US", nil)
assert.NoError(t, err)

req.Header.Set("User-Agent", "Mozilla/5.0 (Windows; U; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)")

bouncerHandler.ServeHTTP(w, req)
assert.Equal(t, 302, w.Code)
assert.Equal(t, "https://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0.1/win32/en-US/Firefox%20Setup%2043.0.1.exe", w.HeaderMap.Get("Location"))

}

func TestIsWindowsXPUserAgent(t *testing.T) {
Expand Down

0 comments on commit 0da1236

Please sign in to comment.