tor-commits
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
April 2013
- 19 participants
- 1497 discussions
[torbrowser/master] Bug 8338: Create watch scripts for monitoring and syncing sources.
by mikeperry@torproject.org 11 Apr '13
by mikeperry@torproject.org 11 Apr '13
11 Apr '13
commit 13ec571eae82fd2f76bc07233ba8c11459f6521e
Author: Mike Perry <mikeperry-git(a)fscked.org>
Date: Mon Apr 1 14:48:14 2013 -0700
Bug 8338: Create watch scripts for monitoring and syncing sources.
These scripts allow us to keep sources on people.torproject.org so that the
build machines are not exposed to code exec via MITM.
They also allow others to verify the integrity of our mirror, to ensure
the mirror is not similarly targeted.
---
watch-scripts/fetch-thirdparty.sh | 83 +++++++++++++++++++++++++++++++
watch-scripts/verify-mirror.sh | 97 +++++++++++++++++++++++++++++++++++++
watch-scripts/versions.sh | 33 +++++++++++++
watch-scripts/watch-firefox.sh | 29 +++++++++++
4 files changed, 242 insertions(+), 0 deletions(-)
diff --git a/watch-scripts/fetch-thirdparty.sh b/watch-scripts/fetch-thirdparty.sh
new file mode 100755
index 0000000..3244671
--- /dev/null
+++ b/watch-scripts/fetch-thirdparty.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+#
+# Creates a local mirror of all third party sources. Verifies GPG signatures
+# when possible.
+#
+# Usage:
+# ./fetch-thirdparty.sh [<dir>]
+#
+# Downloads sources into a "sources" subdirectory of the current directory.
+#
+# If <dir> is specified, we change directory into that mirror dir before
+# downloading source.
+
+. ./versions.sh
+
+if [ -d $1 ]; then
+ cd $1
+fi
+
+## Location of files for download
+ZLIB_URL=http://www.zlib.net/${ZLIB_PACKAGE}
+OPENSSL_URL=http://www.openssl.org/source/${OPENSSL_PACKAGE}
+LIBPNG_URL=ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng15/${LIBPNG_PACKAGE}
+QT_URL=ftp://ftp.qt.nokia.com/qt/source/${QT_PACKAGE}
+VIDALIA_URL=https://archive.torproject.org/tor-package-archive/vidalia/${VIDALIA_PACKAGE}
+LIBEVENT_URL=https://github.com/downloads/libevent/libevent/${LIBEVENT_PACKAGE}
+TOR_URL=https://archive.torproject.org/tor-package-archive/${TOR_PACKAGE}
+PIDGIN_URL=http://sourceforge.net/projects/pidgin/files/Pidgin/${PIDGIN_PACKAGE}
+FIREFOX_URL=https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${FIREFOX_VER}/source/${FIREFOX_PACKAGE}
+MOZBUILD_URL=https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/${MOZBUILD_PACKAGE}
+TORBUTTON_URL=https://people.torproject.org/~mikeperry/${TORBUTTON_PACKAGE}
+NOSCRIPT_URL=https://addons.mozilla.org/firefox/downloads/latest/722/${NOSCRIPT_PACKAGE}
+HTTPSEVERYWHERE_URL=https://www.eff.org/files/${HTTPSEVERYWHERE_PACKAGE}
+OBFSPROXY_URL=https://archive.torproject.org/tor-package-archive/obfsproxy/${OBFSPROXY_PACKAGE}
+
+if [ ! -d sources ]; then
+ mkdir sources
+fi
+
+cd sources
+
+# Get package files
+for i in ZLIB OPENSSL LIBPNG QT VIDALIA LIBEVENT TOR FIREFOX MOZBUILD TORBUTTON NOSCRIPT HTTPSEVERYWHERE OBFSPROXY
+do
+ URL=${i}"_URL"
+ PACKAGE=${i}"_PACKAGE"
+ wget -N --no-remove-listing ${!URL} >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "$i url ${!URL} is broken!"
+ mv ${!PACKAGE} ${!PACKAGE}".removed"
+ exit 1
+ fi
+done
+
+# Get+verify sigs that exist
+# XXX: This doesn't cover everything. See #8525
+for i in TORBUTTON FIREFOX LIBEVENT TOR VIDALIA OBFSPROXY OPENSSL
+do
+ URL=${i}"_URL"
+ PACKAGE=${i}"_PACKAGE"
+ if [ ! -f ${!PACKAGE}".asc" ]; then
+ wget ${!URL}".asc" >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "$i GPG sig url ${!URL} is broken!"
+ mv ${!PACKAGE} ${!PACKAGE}".nogpg"
+ exit 1
+ fi
+ fi
+ gpg ${!PACKAGE}".asc" >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "$i GPG signature is broken for ${!URL}"
+ mv ${!PACKAGE} ${!PACKAGE}".badgpg"
+ exit 1
+ fi
+done
+
+# Record sha256sums
+rm -f sha256sums.txt
+for i in ZLIB OPENSSL LIBPNG QT VIDALIA LIBEVENT TOR FIREFOX MOZBUILD TORBUTTON NOSCRIPT HTTPSEVERYWHERE OBFSPROXY
+do
+ PACKAGE=${i}"_PACKAGE"
+ sha256sum ${!PACKAGE} >> sha256sums.txt
+done
diff --git a/watch-scripts/verify-mirror.sh b/watch-scripts/verify-mirror.sh
new file mode 100755
index 0000000..3627ab7
--- /dev/null
+++ b/watch-scripts/verify-mirror.sh
@@ -0,0 +1,97 @@
+#!/bin/bash
+#
+# verify-mirror.sh - Verifies that our source mirror matches Internet sources
+#
+# Run this script on a non-torproject.org machine to verify that
+# people.torproject.org was not subject to targeted MITM attacks on
+# unauthenticated source code.
+#
+# Usage:
+# ./verify-mirror.sh [<dir>]
+#
+# Verifies the integrity of a remote mirror against a local cache in
+# "sources/", or from the Internet.
+#
+# If <dir> is specified, change into that directory before performing
+# verification.
+
+. ./versions.sh
+
+# Always update our local cache before verifying remote mirror
+./fetch-thirdparty.sh $1
+
+if [ -d $1 ]; then
+ cd $1
+fi
+
+MIRROR_URL=https://people.torproject.org/~mikeperry/mirrors/sources/
+
+# Let's make a verification directory
+mkdir verify-sources
+cd verify-sources
+
+# Get package files from mirror
+for i in ZLIB OPENSSL LIBPNG QT VIDALIA LIBEVENT TOR FIREFOX MOZBUILD TORBUTTON NOSCRIPT HTTPSEVERYWHERE OBFSPROXY
+do
+ PACKAGE=${i}"_PACKAGE"
+ URL=${MIRROR_URL}${!PACKAGE}
+ rm -f ${!PACKAGE}
+ wget ${URL} >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "$i url ${URL} is broken!"
+ exit 1
+ fi
+done
+
+# Get+verify sigs that exist
+# XXX: This doesn't cover everything. See #8525
+for i in TORBUTTON FIREFOX LIBEVENT TOR VIDALIA OBFSPROXY OPENSSL
+do
+ PACKAGE=${i}"_PACKAGE"
+ URL=${MIRROR_URL}${!PACKAGE}
+ if [ ! -f ${!PACKAGE}".asc" ]; then
+ wget ${URL}".asc" >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "$i GPG sig url ${URL} is broken!"
+ mv ${!PACKAGE} ${!PACKAGE}".nogpg"
+ exit 1
+ fi
+ fi
+ gpg ${!PACKAGE}".asc" >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "$i GPG signature is broken for ${URL}"
+ mv ${!PACKAGE} ${!PACKAGE}".badgpg"
+ exit 1
+ fi
+done
+
+# Check remote sha256sums
+rm -f sha256sums.txt
+wget $MIRROR_URL"/sha256sums.txt" >& /dev/null
+if [ $? -ne 0 ]; then
+ echo "SHA256SUMS are absent!!"
+ exit 1
+fi
+
+sha256sum --quiet -c sha256sums.txt
+if [ $? -ne 0 ]; then
+ echo "Remote sha256sums don't match data!"
+ exit 1
+fi
+
+# Make sure our mirror matches
+REMOTE_METASUM=`sha256sum sha256sums.txt`
+
+cd ../sources/
+LOCAL_METASUM=`sha256sum sha256sums.txt`
+
+if [ "z$REMOTE_METASUM" != "z$LOCAL_METASUM" ]; then
+ echo "Remote sha256sums don't match local values!"
+ exit 1
+fi
+
+cd ..
+rm -rf ./verify-sources/
+
+exit 0
+
diff --git a/watch-scripts/versions.sh b/watch-scripts/versions.sh
new file mode 100755
index 0000000..3559c96
--- /dev/null
+++ b/watch-scripts/versions.sh
@@ -0,0 +1,33 @@
+ZLIB_VER=1.2.7
+OPENSSL_VER=1.0.0k
+LIBPNG_VER=1.5.15
+QT_VER=4.8.1
+VIDALIA_VER=0.2.21
+LIBEVENT_VER=2.0.21-stable
+TOR_VER=0.2.3.25
+PIDGIN_VER=2.6.4
+FIREFOX_VER=17.0.5esr
+MOZBUILD_VER=1.5.1
+TORBUTTON_VER=1.5.1
+NOSCRIPT_VER=2.6.5.9
+HTTPSEVERYWHERE_VER=3.1.4
+OTR_VER=3.2.0
+OBFSPROXY_VER=0.1.4
+
+## File names for the source packages
+ZLIB_PACKAGE=zlib-${ZLIB_VER}.tar.gz
+OPENSSL_PACKAGE=openssl-${OPENSSL_VER}.tar.gz
+LIBPNG_PACKAGE=libpng-${LIBPNG_VER}.tar.bz2
+QT_PACKAGE=qt-everywhere-opensource-src-${QT_VER}.tar.gz
+VIDALIA_PACKAGE=vidalia-${VIDALIA_VER}.tar.gz
+LIBEVENT_PACKAGE=libevent-${LIBEVENT_VER}.tar.gz
+TOR_PACKAGE=tor-${TOR_VER}.tar.gz
+PIDGIN_PACKAGE=pidgin-${PIDGIN_VER}.tar.bz2
+FIREFOX_PACKAGE=firefox-${FIREFOX_VER}.source.tar.bz2
+MOZBUILD_PACKAGE=MozillaBuildSetup-${MOZBUILD_VER}.exe
+TORBUTTON_PACKAGE=torbutton-${TORBUTTON_VER}.xpi
+NOSCRIPT_PACKAGE=addon-722-latest.xpi
+HTTPSEVERYWHERE_PACKAGE=https-everywhere-${HTTPSEVERYWHERE_VER}.xpi
+OBFSPROXY_PACKAGE=obfsproxy-${OBFSPROXY_VER}.tar.gz
+
+
diff --git a/watch-scripts/watch-firefox.sh b/watch-scripts/watch-firefox.sh
new file mode 100755
index 0000000..4e2b67d
--- /dev/null
+++ b/watch-scripts/watch-firefox.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+NEXTESR="17\.0\.[567]esr/"
+NEXTRAPID="17\.0/|16\.0\.[34]/"
+
+URL="https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/"
+urldump=`wget -q $URL -O -`
+
+echo $urldump | egrep $NEXTESR > /dev/null
+if [ $? -eq 0 -a ! -f ~/emailt-esr ]
+then
+ echo "New Firefox ESR release is out at $URL" | mail mikeperry(a)torproject.org -s "New Firefox 17.x ESR is out!"
+ echo "New Firefox ESR release is out at $URL" | mail erinn(a)torproject.org -s "New Firefox 17.x ESR is out!"
+ echo "New Firefox ESR release is out at $URL" | mail sebastian(a)torproject.org -s "New Firefox 17.x ESR is out!"
+ touch ~/emailt-esr
+fi
+
+exit
+
+echo $urldump | egrep $NEXTRAPID > /dev/null
+if [ $? -eq 0 -a ! -f ~/emailt-rr ]
+then
+ echo "New Firefox Rapid Release is out at $URL" | mail mikeperry(a)torproject.org -s "New Firefox Rapid Release is out!"
+ echo "New Firefox Rapid Release is out at $URL" | mail erinn(a)torproject.org -s "New Firefox Rapid Release is out"
+ echo "New Firefox Rapid Release is out at $URL" | mail sebastian(a)torproject.org -s "New Firefox Rapid Release is out!"
+ touch ~/emailt-rr
+fi
+
+
1
0
[torbrowser/master] Bug 8628: Fix key usage for image cache isolation.
by mikeperry@torproject.org 11 Apr '13
by mikeperry@torproject.org 11 Apr '13
11 Apr '13
commit 43f90f87c0671d4503e3a18a23d6e42b7789f8fc
Author: Mike Perry <mikeperry-git(a)fscked.org>
Date: Tue Apr 2 15:29:59 2013 -0700
Bug 8628: Fix key usage for image cache isolation.
May also solve some crash bugs.
---
...solate-the-Image-Cache-per-url-bar-domain.patch | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/current-patches/firefox/0024-Isolate-the-Image-Cache-per-url-bar-domain.patch b/src/current-patches/firefox/0024-Isolate-the-Image-Cache-per-url-bar-domain.patch
index 6689b66..a6e9c61 100644
--- a/src/current-patches/firefox/0024-Isolate-the-Image-Cache-per-url-bar-domain.patch
+++ b/src/current-patches/firefox/0024-Isolate-the-Image-Cache-per-url-bar-domain.patch
@@ -1,4 +1,4 @@
-From 615c1d7bc870fee55ae37fff0f52b04185c03383 Mon Sep 17 00:00:00 2001
+From f097490e5043195bb0dfc27b288ff8b485b148e6 Mon Sep 17 00:00:00 2001
From: Mike Perry <mikeperry-git(a)torproject.org>
Date: Thu, 6 Dec 2012 14:19:34 -0800
Subject: [PATCH 24/27] Isolate the Image Cache per url bar domain.
@@ -7,7 +7,7 @@ The image cache maintains its own table outside of the main cache, and does
not obey cacheKeys by default.
---
content/base/src/nsContentUtils.cpp | 13 +-
- embedding/browser/webBrowser/nsContextMenuInfo.cpp | 27 ++-
+ embedding/browser/webBrowser/nsContextMenuInfo.cpp | 27 +-
extensions/cookie/nsCookiePermission.cpp | 3 +
image/public/imgILoader.idl | 4 +-
image/src/imgLoader.cpp | 262 +++++++++++++-------
@@ -149,7 +149,7 @@ index da26463..ecff309 100644
in nsIPrincipal aLoadingPrincipal,
in nsILoadGroup aLoadGroup,
diff --git a/image/src/imgLoader.cpp b/image/src/imgLoader.cpp
-index ea51e8d..8f2e0c1 100644
+index ea51e8d..8e52af8 100644
--- a/image/src/imgLoader.cpp
+++ b/image/src/imgLoader.cpp
@@ -39,6 +39,7 @@
@@ -672,7 +672,7 @@ index ea51e8d..8f2e0c1 100644
// Try to add the new request into the cache.
- PutIntoCache(originalURI, entry);
-+ PutIntoCache(GetCacheKey(originalURI, firstPartyURI), entry);
++ PutIntoCache(GetCacheKey(firstPartyURI, originalURI), entry);
rv = CreateNewProxyForRequest(request, loadGroup, aObserver,
requestFlags, nullptr, _retval);
@@ -918,5 +918,5 @@ index e0c07c4..368df5f 100644
nullptr, getter_AddRefs(mIconRequest));
if (NS_FAILED(rv)) return rv;
--
-1.7.5.4
+1.7.9.5
1
0
[torbrowser/maint-2.4] Bug 8338: Create watch scripts for monitoring and syncing sources.
by mikeperry@torproject.org 11 Apr '13
by mikeperry@torproject.org 11 Apr '13
11 Apr '13
commit 13ec571eae82fd2f76bc07233ba8c11459f6521e
Author: Mike Perry <mikeperry-git(a)fscked.org>
Date: Mon Apr 1 14:48:14 2013 -0700
Bug 8338: Create watch scripts for monitoring and syncing sources.
These scripts allow us to keep sources on people.torproject.org so that the
build machines are not exposed to code exec via MITM.
They also allow others to verify the integrity of our mirror, to ensure
the mirror is not similarly targeted.
---
watch-scripts/fetch-thirdparty.sh | 83 +++++++++++++++++++++++++++++++
watch-scripts/verify-mirror.sh | 97 +++++++++++++++++++++++++++++++++++++
watch-scripts/versions.sh | 33 +++++++++++++
watch-scripts/watch-firefox.sh | 29 +++++++++++
4 files changed, 242 insertions(+), 0 deletions(-)
diff --git a/watch-scripts/fetch-thirdparty.sh b/watch-scripts/fetch-thirdparty.sh
new file mode 100755
index 0000000..3244671
--- /dev/null
+++ b/watch-scripts/fetch-thirdparty.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+#
+# Creates a local mirror of all third party sources. Verifies GPG signatures
+# when possible.
+#
+# Usage:
+# ./fetch-thirdparty.sh [<dir>]
+#
+# Downloads sources into a "sources" subdirectory of the current directory.
+#
+# If <dir> is specified, we change directory into that mirror dir before
+# downloading source.
+
+. ./versions.sh
+
+if [ -d $1 ]; then
+ cd $1
+fi
+
+## Location of files for download
+ZLIB_URL=http://www.zlib.net/${ZLIB_PACKAGE}
+OPENSSL_URL=http://www.openssl.org/source/${OPENSSL_PACKAGE}
+LIBPNG_URL=ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng15/${LIBPNG_PACKAGE}
+QT_URL=ftp://ftp.qt.nokia.com/qt/source/${QT_PACKAGE}
+VIDALIA_URL=https://archive.torproject.org/tor-package-archive/vidalia/${VIDALIA_PACKAGE}
+LIBEVENT_URL=https://github.com/downloads/libevent/libevent/${LIBEVENT_PACKAGE}
+TOR_URL=https://archive.torproject.org/tor-package-archive/${TOR_PACKAGE}
+PIDGIN_URL=http://sourceforge.net/projects/pidgin/files/Pidgin/${PIDGIN_PACKAGE}
+FIREFOX_URL=https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/${FIREFOX_VER}/source/${FIREFOX_PACKAGE}
+MOZBUILD_URL=https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/${MOZBUILD_PACKAGE}
+TORBUTTON_URL=https://people.torproject.org/~mikeperry/${TORBUTTON_PACKAGE}
+NOSCRIPT_URL=https://addons.mozilla.org/firefox/downloads/latest/722/${NOSCRIPT_PACKAGE}
+HTTPSEVERYWHERE_URL=https://www.eff.org/files/${HTTPSEVERYWHERE_PACKAGE}
+OBFSPROXY_URL=https://archive.torproject.org/tor-package-archive/obfsproxy/${OBFSPROXY_PACKAGE}
+
+if [ ! -d sources ]; then
+ mkdir sources
+fi
+
+cd sources
+
+# Get package files
+for i in ZLIB OPENSSL LIBPNG QT VIDALIA LIBEVENT TOR FIREFOX MOZBUILD TORBUTTON NOSCRIPT HTTPSEVERYWHERE OBFSPROXY
+do
+ URL=${i}"_URL"
+ PACKAGE=${i}"_PACKAGE"
+ wget -N --no-remove-listing ${!URL} >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "$i url ${!URL} is broken!"
+ mv ${!PACKAGE} ${!PACKAGE}".removed"
+ exit 1
+ fi
+done
+
+# Get+verify sigs that exist
+# XXX: This doesn't cover everything. See #8525
+for i in TORBUTTON FIREFOX LIBEVENT TOR VIDALIA OBFSPROXY OPENSSL
+do
+ URL=${i}"_URL"
+ PACKAGE=${i}"_PACKAGE"
+ if [ ! -f ${!PACKAGE}".asc" ]; then
+ wget ${!URL}".asc" >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "$i GPG sig url ${!URL} is broken!"
+ mv ${!PACKAGE} ${!PACKAGE}".nogpg"
+ exit 1
+ fi
+ fi
+ gpg ${!PACKAGE}".asc" >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "$i GPG signature is broken for ${!URL}"
+ mv ${!PACKAGE} ${!PACKAGE}".badgpg"
+ exit 1
+ fi
+done
+
+# Record sha256sums
+rm -f sha256sums.txt
+for i in ZLIB OPENSSL LIBPNG QT VIDALIA LIBEVENT TOR FIREFOX MOZBUILD TORBUTTON NOSCRIPT HTTPSEVERYWHERE OBFSPROXY
+do
+ PACKAGE=${i}"_PACKAGE"
+ sha256sum ${!PACKAGE} >> sha256sums.txt
+done
diff --git a/watch-scripts/verify-mirror.sh b/watch-scripts/verify-mirror.sh
new file mode 100755
index 0000000..3627ab7
--- /dev/null
+++ b/watch-scripts/verify-mirror.sh
@@ -0,0 +1,97 @@
+#!/bin/bash
+#
+# verify-mirror.sh - Verifies that our source mirror matches Internet sources
+#
+# Run this script on a non-torproject.org machine to verify that
+# people.torproject.org was not subject to targeted MITM attacks on
+# unauthenticated source code.
+#
+# Usage:
+# ./verify-mirror.sh [<dir>]
+#
+# Verifies the integrity of a remote mirror against a local cache in
+# "sources/", or from the Internet.
+#
+# If <dir> is specified, change into that directory before performing
+# verification.
+
+. ./versions.sh
+
+# Always update our local cache before verifying remote mirror
+./fetch-thirdparty.sh $1
+
+if [ -d $1 ]; then
+ cd $1
+fi
+
+MIRROR_URL=https://people.torproject.org/~mikeperry/mirrors/sources/
+
+# Let's make a verification directory
+mkdir verify-sources
+cd verify-sources
+
+# Get package files from mirror
+for i in ZLIB OPENSSL LIBPNG QT VIDALIA LIBEVENT TOR FIREFOX MOZBUILD TORBUTTON NOSCRIPT HTTPSEVERYWHERE OBFSPROXY
+do
+ PACKAGE=${i}"_PACKAGE"
+ URL=${MIRROR_URL}${!PACKAGE}
+ rm -f ${!PACKAGE}
+ wget ${URL} >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "$i url ${URL} is broken!"
+ exit 1
+ fi
+done
+
+# Get+verify sigs that exist
+# XXX: This doesn't cover everything. See #8525
+for i in TORBUTTON FIREFOX LIBEVENT TOR VIDALIA OBFSPROXY OPENSSL
+do
+ PACKAGE=${i}"_PACKAGE"
+ URL=${MIRROR_URL}${!PACKAGE}
+ if [ ! -f ${!PACKAGE}".asc" ]; then
+ wget ${URL}".asc" >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "$i GPG sig url ${URL} is broken!"
+ mv ${!PACKAGE} ${!PACKAGE}".nogpg"
+ exit 1
+ fi
+ fi
+ gpg ${!PACKAGE}".asc" >& /dev/null
+ if [ $? -ne 0 ]; then
+ echo "$i GPG signature is broken for ${URL}"
+ mv ${!PACKAGE} ${!PACKAGE}".badgpg"
+ exit 1
+ fi
+done
+
+# Check remote sha256sums
+rm -f sha256sums.txt
+wget $MIRROR_URL"/sha256sums.txt" >& /dev/null
+if [ $? -ne 0 ]; then
+ echo "SHA256SUMS are absent!!"
+ exit 1
+fi
+
+sha256sum --quiet -c sha256sums.txt
+if [ $? -ne 0 ]; then
+ echo "Remote sha256sums don't match data!"
+ exit 1
+fi
+
+# Make sure our mirror matches
+REMOTE_METASUM=`sha256sum sha256sums.txt`
+
+cd ../sources/
+LOCAL_METASUM=`sha256sum sha256sums.txt`
+
+if [ "z$REMOTE_METASUM" != "z$LOCAL_METASUM" ]; then
+ echo "Remote sha256sums don't match local values!"
+ exit 1
+fi
+
+cd ..
+rm -rf ./verify-sources/
+
+exit 0
+
diff --git a/watch-scripts/versions.sh b/watch-scripts/versions.sh
new file mode 100755
index 0000000..3559c96
--- /dev/null
+++ b/watch-scripts/versions.sh
@@ -0,0 +1,33 @@
+ZLIB_VER=1.2.7
+OPENSSL_VER=1.0.0k
+LIBPNG_VER=1.5.15
+QT_VER=4.8.1
+VIDALIA_VER=0.2.21
+LIBEVENT_VER=2.0.21-stable
+TOR_VER=0.2.3.25
+PIDGIN_VER=2.6.4
+FIREFOX_VER=17.0.5esr
+MOZBUILD_VER=1.5.1
+TORBUTTON_VER=1.5.1
+NOSCRIPT_VER=2.6.5.9
+HTTPSEVERYWHERE_VER=3.1.4
+OTR_VER=3.2.0
+OBFSPROXY_VER=0.1.4
+
+## File names for the source packages
+ZLIB_PACKAGE=zlib-${ZLIB_VER}.tar.gz
+OPENSSL_PACKAGE=openssl-${OPENSSL_VER}.tar.gz
+LIBPNG_PACKAGE=libpng-${LIBPNG_VER}.tar.bz2
+QT_PACKAGE=qt-everywhere-opensource-src-${QT_VER}.tar.gz
+VIDALIA_PACKAGE=vidalia-${VIDALIA_VER}.tar.gz
+LIBEVENT_PACKAGE=libevent-${LIBEVENT_VER}.tar.gz
+TOR_PACKAGE=tor-${TOR_VER}.tar.gz
+PIDGIN_PACKAGE=pidgin-${PIDGIN_VER}.tar.bz2
+FIREFOX_PACKAGE=firefox-${FIREFOX_VER}.source.tar.bz2
+MOZBUILD_PACKAGE=MozillaBuildSetup-${MOZBUILD_VER}.exe
+TORBUTTON_PACKAGE=torbutton-${TORBUTTON_VER}.xpi
+NOSCRIPT_PACKAGE=addon-722-latest.xpi
+HTTPSEVERYWHERE_PACKAGE=https-everywhere-${HTTPSEVERYWHERE_VER}.xpi
+OBFSPROXY_PACKAGE=obfsproxy-${OBFSPROXY_VER}.tar.gz
+
+
diff --git a/watch-scripts/watch-firefox.sh b/watch-scripts/watch-firefox.sh
new file mode 100755
index 0000000..4e2b67d
--- /dev/null
+++ b/watch-scripts/watch-firefox.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+NEXTESR="17\.0\.[567]esr/"
+NEXTRAPID="17\.0/|16\.0\.[34]/"
+
+URL="https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/"
+urldump=`wget -q $URL -O -`
+
+echo $urldump | egrep $NEXTESR > /dev/null
+if [ $? -eq 0 -a ! -f ~/emailt-esr ]
+then
+ echo "New Firefox ESR release is out at $URL" | mail mikeperry(a)torproject.org -s "New Firefox 17.x ESR is out!"
+ echo "New Firefox ESR release is out at $URL" | mail erinn(a)torproject.org -s "New Firefox 17.x ESR is out!"
+ echo "New Firefox ESR release is out at $URL" | mail sebastian(a)torproject.org -s "New Firefox 17.x ESR is out!"
+ touch ~/emailt-esr
+fi
+
+exit
+
+echo $urldump | egrep $NEXTRAPID > /dev/null
+if [ $? -eq 0 -a ! -f ~/emailt-rr ]
+then
+ echo "New Firefox Rapid Release is out at $URL" | mail mikeperry(a)torproject.org -s "New Firefox Rapid Release is out!"
+ echo "New Firefox Rapid Release is out at $URL" | mail erinn(a)torproject.org -s "New Firefox Rapid Release is out"
+ echo "New Firefox Rapid Release is out at $URL" | mail sebastian(a)torproject.org -s "New Firefox Rapid Release is out!"
+ touch ~/emailt-rr
+fi
+
+
1
0
[torbrowser/maint-2.4] Bug 8628: Fix key usage for image cache isolation.
by mikeperry@torproject.org 11 Apr '13
by mikeperry@torproject.org 11 Apr '13
11 Apr '13
commit 43f90f87c0671d4503e3a18a23d6e42b7789f8fc
Author: Mike Perry <mikeperry-git(a)fscked.org>
Date: Tue Apr 2 15:29:59 2013 -0700
Bug 8628: Fix key usage for image cache isolation.
May also solve some crash bugs.
---
...solate-the-Image-Cache-per-url-bar-domain.patch | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/current-patches/firefox/0024-Isolate-the-Image-Cache-per-url-bar-domain.patch b/src/current-patches/firefox/0024-Isolate-the-Image-Cache-per-url-bar-domain.patch
index 6689b66..a6e9c61 100644
--- a/src/current-patches/firefox/0024-Isolate-the-Image-Cache-per-url-bar-domain.patch
+++ b/src/current-patches/firefox/0024-Isolate-the-Image-Cache-per-url-bar-domain.patch
@@ -1,4 +1,4 @@
-From 615c1d7bc870fee55ae37fff0f52b04185c03383 Mon Sep 17 00:00:00 2001
+From f097490e5043195bb0dfc27b288ff8b485b148e6 Mon Sep 17 00:00:00 2001
From: Mike Perry <mikeperry-git(a)torproject.org>
Date: Thu, 6 Dec 2012 14:19:34 -0800
Subject: [PATCH 24/27] Isolate the Image Cache per url bar domain.
@@ -7,7 +7,7 @@ The image cache maintains its own table outside of the main cache, and does
not obey cacheKeys by default.
---
content/base/src/nsContentUtils.cpp | 13 +-
- embedding/browser/webBrowser/nsContextMenuInfo.cpp | 27 ++-
+ embedding/browser/webBrowser/nsContextMenuInfo.cpp | 27 +-
extensions/cookie/nsCookiePermission.cpp | 3 +
image/public/imgILoader.idl | 4 +-
image/src/imgLoader.cpp | 262 +++++++++++++-------
@@ -149,7 +149,7 @@ index da26463..ecff309 100644
in nsIPrincipal aLoadingPrincipal,
in nsILoadGroup aLoadGroup,
diff --git a/image/src/imgLoader.cpp b/image/src/imgLoader.cpp
-index ea51e8d..8f2e0c1 100644
+index ea51e8d..8e52af8 100644
--- a/image/src/imgLoader.cpp
+++ b/image/src/imgLoader.cpp
@@ -39,6 +39,7 @@
@@ -672,7 +672,7 @@ index ea51e8d..8f2e0c1 100644
// Try to add the new request into the cache.
- PutIntoCache(originalURI, entry);
-+ PutIntoCache(GetCacheKey(originalURI, firstPartyURI), entry);
++ PutIntoCache(GetCacheKey(firstPartyURI, originalURI), entry);
rv = CreateNewProxyForRequest(request, loadGroup, aObserver,
requestFlags, nullptr, _retval);
@@ -918,5 +918,5 @@ index e0c07c4..368df5f 100644
nullptr, getter_AddRefs(mIconRequest));
if (NS_FAILED(rv)) return rv;
--
-1.7.5.4
+1.7.9.5
1
0
[torbrowser/maint-2.4] Bug 7920: Honor the Windows theme for inverse text colors
by mikeperry@torproject.org 11 Apr '13
by mikeperry@torproject.org 11 Apr '13
11 Apr '13
commit f6325cc47656445f729c4426246154733e4bf6df
Author: Mike Perry <mikeperry-git(a)fscked.org>
Date: Tue Apr 2 16:03:44 2013 -0700
Bug 7920: Honor the Windows theme for inverse text colors
---
...not-expose-system-colors-to-CSS-or-canvas.patch | 195 ++++++++++++++++++--
1 files changed, 180 insertions(+), 15 deletions(-)
diff --git a/src/current-patches/firefox/0023-Do-not-expose-system-colors-to-CSS-or-canvas.patch b/src/current-patches/firefox/0023-Do-not-expose-system-colors-to-CSS-or-canvas.patch
index 1db7290..2bd9ffc 100644
--- a/src/current-patches/firefox/0023-Do-not-expose-system-colors-to-CSS-or-canvas.patch
+++ b/src/current-patches/firefox/0023-Do-not-expose-system-colors-to-CSS-or-canvas.patch
@@ -1,17 +1,24 @@
-From 6cf784929d122dd2b83536bdd742e9a718027376 Mon Sep 17 00:00:00 2001
+From 6f70c68258eb81dc898622f1f2629d71441fb1d3 Mon Sep 17 00:00:00 2001
From: Kathleen Brade <brade(a)pearlcrescent.com>
Date: Wed, 28 Nov 2012 15:08:40 -0500
-Subject: [PATCH 23/27] Do not expose system colors to CSS or canvas.
+Subject: [PATCH 23/28] Do not expose system colors to CSS or canvas.
+This patch also contains a hack to use properly contrasting colors if the
+desktop theme specifies white on black for text colors (see
+https://trac.torproject.org/projects/tor/ticket/7920). These color choices are
+also not exposed to content.
---
- content/canvas/src/nsCanvasRenderingContext2D.cpp | 28 +++-
+ content/canvas/src/nsCanvasRenderingContext2D.cpp | 28 ++-
.../canvas/src/nsCanvasRenderingContext2DAzure.cpp | 34 +++-
.../canvas/src/nsCanvasRenderingContext2DAzure.h | 5 +-
+ layout/base/nsLayoutUtils.cpp | 50 +++++
+ layout/base/nsLayoutUtils.h | 4 +
+ layout/generic/nsFrame.cpp | 6 +-
layout/style/nsRuleNode.cpp | 5 +-
- widget/LookAndFeel.h | 9 +
- widget/xpwidgets/nsXPLookAndFeel.cpp | 173 +++++++++++++++++++-
+ widget/LookAndFeel.h | 12 ++
+ widget/xpwidgets/nsXPLookAndFeel.cpp | 214 +++++++++++++++++++-
widget/xpwidgets/nsXPLookAndFeel.h | 5 +-
- 7 files changed, 239 insertions(+), 20 deletions(-)
+ 10 files changed, 342 insertions(+), 21 deletions(-)
diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp
index 0dec654..7132e4f 100644
@@ -190,6 +197,113 @@ index 05ccf61..629d78a 100644
Type mType;
virtual ~nsCanvasGradientAzure() {}
};
+diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
+index 87b0d34..65515d9 100644
+--- a/layout/base/nsLayoutUtils.cpp
++++ b/layout/base/nsLayoutUtils.cpp
+@@ -76,6 +76,7 @@
+ #include "nsSVGForeignObjectFrame.h"
+ #include "nsSVGOuterSVGFrame.h"
+ #include "nsStyleStructInlines.h"
++#include "mozilla/LookAndFeel.h"
+
+ #include "mozilla/Preferences.h"
+
+@@ -3134,13 +3135,62 @@ ShouldDarkenColors(nsPresContext* aPresContext)
+ nscolor
+ nsLayoutUtils::GetColor(nsIFrame* aFrame, nsCSSProperty aProperty)
+ {
++ if (aProperty == eCSSProperty_color)
++ {
++ nscolor nativeColor = NS_RGB(0, 0, 0);
++ if (GetNativeTextColor(aFrame, nativeColor))
++ return nativeColor;
++ }
++
+ nscolor color = aFrame->GetVisitedDependentColor(aProperty);
+ if (ShouldDarkenColors(aFrame->PresContext())) {
+ color = DarkenColor(color);
+ }
++
+ return color;
+ }
+
++bool
++nsLayoutUtils::GetNativeTextColor(nsIFrame* aFrame, nscolor& aColor)
++{
++ nsPresContext *presContext = aFrame->PresContext();
++ if (!presContext->IsChrome()) {
++ // If native appearance was used to draw the background of the containing
++ // frame, return a contrasting native foreground color instead of the
++ // color from the element's style. This avoids a problem where black
++ // text was displayed on a black background when a Windows theme such as
++ // "High Contrast Black" was used. The background is drawn inside
++ // nsNativeThemeWin::ClassicDrawWidgetBackground().
++ //
++ // Because both the background color and this foreground color are used
++ // directly without exposing the colors via CSS computed styles, the
++ // native colors are not leaked to content.
++ nsIFrame* bgFrame =
++ nsCSSRendering::FindNonTransparentBackgroundFrame(aFrame);
++ if (bgFrame) {
++ const nsStyleDisplay* displayData = bgFrame->GetStyleDisplay();
++ uint8_t widgetType = displayData->mAppearance;
++ nsITheme *theme = presContext->GetTheme();
++ if (widgetType && theme->ThemeSupportsWidget(presContext, bgFrame,
++ widgetType)) {
++ bool isDisabled = false;
++ nsIContent* frameContent = bgFrame->GetContent();
++ if (frameContent && frameContent->IsElement()) {
++ nsEventStates es = frameContent->AsElement()->State();
++ isDisabled = es.HasState(NS_EVENT_STATE_DISABLED);
++ }
++
++ if (NS_SUCCEEDED(LookAndFeel::GetColorForNativeAppearance(widgetType,
++ isDisabled, &aColor))) {
++ return true;
++ }
++ }
++ }
++ }
++
++ return false;
++}
++
+ gfxFloat
+ nsLayoutUtils::GetSnappedBaselineY(nsIFrame* aFrame, gfxContext* aContext,
+ nscoord aY, nscoord aAscent)
+diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
+index 4fb1f93..6552f04 100644
+--- a/layout/base/nsLayoutUtils.h
++++ b/layout/base/nsLayoutUtils.h
+@@ -989,6 +989,10 @@ public:
+ // Get a suitable foreground color for painting aProperty for aFrame.
+ static nscolor GetColor(nsIFrame* aFrame, nsCSSProperty aProperty);
+
++ // Get the native text color if appropriate. If false is returned, callers
++ // should fallback to the CSS color.
++ static bool GetNativeTextColor(nsIFrame* aFrame, nscolor& aColor);
++
+ // Get a baseline y position in app units that is snapped to device pixels.
+ static gfxFloat GetSnappedBaselineY(nsIFrame* aFrame, gfxContext* aContext,
+ nscoord aY, nscoord aAscent);
+diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp
+index 75a2bb9..d684a62 100644
+--- a/layout/generic/nsFrame.cpp
++++ b/layout/generic/nsFrame.cpp
+@@ -1446,7 +1446,11 @@ nsIFrame::DisplayCaret(nsDisplayListBuilder* aBuilder,
+ nscolor
+ nsIFrame::GetCaretColorAt(int32_t aOffset)
+ {
+- // Use text color.
++ nscolor color = NS_RGB(0, 0, 0);
++ if (nsLayoutUtils::GetNativeTextColor(this, color))
++ return color;
++
++ // Use CSS text color.
+ return GetStyleColor()->mColor;
+ }
+
diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp
index 86eff1f..732b1fe 100644
--- a/layout/style/nsRuleNode.cpp
@@ -207,10 +321,10 @@ index 86eff1f..732b1fe 100644
}
}
diff --git a/widget/LookAndFeel.h b/widget/LookAndFeel.h
-index e46bb13..59f00f5 100644
+index e46bb13..f947084 100644
--- a/widget/LookAndFeel.h
+++ b/widget/LookAndFeel.h
-@@ -446,6 +446,15 @@ public:
+@@ -446,6 +446,18 @@ public:
static nsresult GetColor(ColorID aID, nscolor* aResult);
/**
@@ -222,15 +336,26 @@ index e46bb13..59f00f5 100644
+ static nsresult GetColor(ColorID aID, bool aUseStandinsForNativeColors,
+ nscolor* aResult);
+
++ static nsresult GetColorForNativeAppearance(uint8_t aWidgetType,
++ bool aIsDisabled, nscolor* aResult);
++
+ /**
* GetInt() and GetFloat() return a int or float value for aID. The result
* might be distance, time, some flags or a int value which has particular
* meaning. See each document at definition of each ID for the detail.
diff --git a/widget/xpwidgets/nsXPLookAndFeel.cpp b/widget/xpwidgets/nsXPLookAndFeel.cpp
-index 50c2c86..20ccfef 100644
+index 50c2c86..704963a 100644
--- a/widget/xpwidgets/nsXPLookAndFeel.cpp
+++ b/widget/xpwidgets/nsXPLookAndFeel.cpp
-@@ -476,6 +476,155 @@ nsXPLookAndFeel::IsSpecialColor(ColorID aID, nscolor &aColor)
+@@ -11,6 +11,7 @@
+ #include "nsLookAndFeel.h"
+ #include "nsCRT.h"
+ #include "nsFont.h"
++#include "nsThemeConstants.h"
+ #include "mozilla/Preferences.h"
+
+ #include "gfxPlatform.h"
+@@ -476,6 +477,155 @@ nsXPLookAndFeel::IsSpecialColor(ColorID aID, nscolor &aColor)
return false;
}
@@ -386,7 +511,7 @@ index 50c2c86..20ccfef 100644
//
// All these routines will return NS_OK if they have a value,
// in which case the nsLookAndFeel should use that value;
-@@ -483,7 +632,8 @@ nsXPLookAndFeel::IsSpecialColor(ColorID aID, nscolor &aColor)
+@@ -483,7 +633,8 @@ nsXPLookAndFeel::IsSpecialColor(ColorID aID, nscolor &aColor)
// platform-specific nsLookAndFeel should use its own values instead.
//
nsresult
@@ -396,7 +521,7 @@ index 50c2c86..20ccfef 100644
{
if (!sInitialized)
Init();
-@@ -569,7 +719,10 @@ nsXPLookAndFeel::GetColorImpl(ColorID aID, nscolor &aResult)
+@@ -569,7 +720,10 @@ nsXPLookAndFeel::GetColorImpl(ColorID aID, nscolor &aResult)
}
#endif // DEBUG_SYSTEM_COLOR_USE
@@ -408,7 +533,7 @@ index 50c2c86..20ccfef 100644
aResult = sCachedColors[aID];
return NS_OK;
}
-@@ -603,6 +756,12 @@ nsXPLookAndFeel::GetColorImpl(ColorID aID, nscolor &aResult)
+@@ -603,6 +757,12 @@ nsXPLookAndFeel::GetColorImpl(ColorID aID, nscolor &aResult)
return NS_OK;
}
@@ -421,7 +546,7 @@ index 50c2c86..20ccfef 100644
if (sUseNativeColors && NS_SUCCEEDED(NativeGetColor(aID, aResult))) {
if ((gfxPlatform::GetCMSMode() == eCMSMode_All) &&
!IsSpecialColor(aID, aResult)) {
-@@ -693,7 +852,15 @@ namespace mozilla {
+@@ -693,7 +853,55 @@ namespace mozilla {
nsresult
LookAndFeel::GetColor(ColorID aID, nscolor* aResult)
{
@@ -435,6 +560,46 @@ index 50c2c86..20ccfef 100644
+{
+ return nsLookAndFeel::GetInstance()->GetColorImpl(aID,
+ aUseStandinsForNativeColors, *aResult);
++}
++
++// static
++nsresult
++LookAndFeel::GetColorForNativeAppearance(uint8_t aWidgetType, bool aIsDisabled,
++ nscolor* aResult)
++{
++ NS_ENSURE_ARG_POINTER(aResult);
++
++ ColorID colorID = eColorID_LAST_COLOR;
++ switch (aWidgetType) {
++ case NS_THEME_TEXTFIELD:
++ case NS_THEME_TEXTFIELD_MULTILINE:
++ case NS_THEME_LISTBOX:
++ case NS_THEME_DROPDOWN:
++ case NS_THEME_DROPDOWN_TEXTFIELD:
++ case NS_THEME_TREEVIEW:
++ colorID = (aIsDisabled) ? eColorID_graytext : eColorID__moz_fieldtext;
++ break;
++
++ case NS_THEME_TOOLTIP:
++ colorID = eColorID_infotext;
++ break;
++
++ case NS_THEME_BUTTON:
++ case NS_THEME_GROUPBOX:
++ case NS_THEME_PROGRESSBAR:
++ case NS_THEME_PROGRESSBAR_VERTICAL:
++ case NS_THEME_TAB_PANEL:
++ case NS_THEME_STATUSBAR:
++ case NS_THEME_STATUSBAR_RESIZER_PANEL:
++ colorID = (aIsDisabled) ? eColorID_graytext : eColorID_buttontext;
++ break;
++ }
++
++ if (LookAndFeel::eColorID_LAST_COLOR == colorID)
++ return NS_ERROR_FAILURE;
++
++ *aResult = NS_RGB(0, 0, 0);
++ return nsLookAndFeel::GetInstance()->NativeGetColor(colorID, *aResult);
}
// static
@@ -462,5 +627,5 @@ index 69627d2..2729803 100644
static int OnPrefChanged(const char* aPref, void* aClosure);
--
-1.7.5.4
+1.7.9.5
1
0
[torbrowser/maint-2.4] Bug 8470: Increase pipeline randomization.
by mikeperry@torproject.org 11 Apr '13
by mikeperry@torproject.org 11 Apr '13
11 Apr '13
commit f520a5037c96de05f208552158802fa4840055af
Author: Mike Perry <mikeperry-git(a)fscked.org>
Date: Tue Apr 2 16:02:56 2013 -0700
Bug 8470: Increase pipeline randomization.
---
build-scripts/config/pound_tor.js | 3 +
...ize-HTTP-request-order-and-pipeline-depth.patch | 708 +++++++++++++++++---
2 files changed, 623 insertions(+), 88 deletions(-)
diff --git a/build-scripts/config/pound_tor.js b/build-scripts/config/pound_tor.js
index ab98b46..db382a6 100644
--- a/build-scripts/config/pound_tor.js
+++ b/build-scripts/config/pound_tor.js
@@ -97,6 +97,9 @@ pref("network.http.proxy.pipelining", true);
pref("security.ssl.enable_false_start", true);
pref("network.http.keep-alive.timeout", 20);
pref("network.http.connection-retry-timeout", 0);
+pref("network.http.max-persistent-connections-per-proxy", 256);
+// Hacked pref: Now means "Attempt to pipeline at least this many requests together"
+pref("network.http.pipelining.max-optimistic-requests", 3);
// Extension support
pref("extensions.autoDisableScopes", 0);
diff --git a/src/current-patches/firefox/0017-Randomize-HTTP-request-order-and-pipeline-depth.patch b/src/current-patches/firefox/0017-Randomize-HTTP-request-order-and-pipeline-depth.patch
index ddfb184..a5d2957 100644
--- a/src/current-patches/firefox/0017-Randomize-HTTP-request-order-and-pipeline-depth.patch
+++ b/src/current-patches/firefox/0017-Randomize-HTTP-request-order-and-pipeline-depth.patch
@@ -1,7 +1,7 @@
-From cd87b7f64f035f67ec883c1b1ed4746454892781 Mon Sep 17 00:00:00 2001
+From a88adc5c3000c3e2a18b1065da77dd83d2b3ae7b Mon Sep 17 00:00:00 2001
From: Mike Perry <mikeperry-git(a)torproject.org>
Date: Tue, 4 Dec 2012 17:38:51 -0800
-Subject: [PATCH 17/27] Randomize HTTP request order and pipeline depth.
+Subject: [PATCH 17/28] Randomize HTTP request order and pipeline depth.
This is an experimental defense against
http://lorre.uni.lu/~andriy/papers/acmccs-wpes11-fingerprinting.pdf
@@ -13,18 +13,21 @@ This defense has been improved since that blog post to additionally randomize
the order and concurrency of non-pipelined HTTP requests.
This patch is also different from the 10.x ESR patch, as the pipelining
-code has changed. We may want to set network.http.pipelining.aggressive to get
-similar behavior...
+code has changed significantly.
-The good news is we now randomize SPDY request order as well as pipeline
-request order (though SPDY is still disabled by default in TBB).
+This patch may have some minor impact on SPDY request order, but the SPDY
+implementation has not been altered directly. It has several stream queues
+that may also benefit from reordering.
---
- netwerk/protocol/http/nsHttpConnectionMgr.cpp | 67 +++++++++++++++++++++++--
- netwerk/protocol/http/nsHttpConnectionMgr.h | 3 +
- 2 files changed, 65 insertions(+), 5 deletions(-)
+ netwerk/protocol/http/nsHttpConnectionMgr.cpp | 288 +++++++++++++++++--------
+ netwerk/protocol/http/nsHttpConnectionMgr.h | 15 +-
+ netwerk/protocol/http/nsHttpHandler.h | 2 +
+ netwerk/protocol/http/nsHttpPipeline.cpp | 62 +++++-
+ netwerk/protocol/http/nsHttpPipeline.h | 3 +
+ 5 files changed, 272 insertions(+), 98 deletions(-)
diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
-index 133c301..59d03c0 100644
+index 133c301..872d505 100644
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -20,6 +20,8 @@
@@ -36,108 +39,465 @@ index 133c301..59d03c0 100644
using namespace mozilla;
using namespace mozilla::net;
-@@ -39,15 +41,46 @@ InsertTransactionSorted(nsTArray<nsHttpTransaction*> &pendingQ, nsHttpTransactio
+@@ -39,15 +41,26 @@ InsertTransactionSorted(nsTArray<nsHttpTransaction*> &pendingQ, nsHttpTransactio
// insert into queue with smallest valued number first. search in reverse
// order under the assumption that many of the existing transactions will
// have the same priority (usually 0).
+ uint32_t len = pendingQ.Length();
-+ uint32_t begin = 0, end = len+1;
-+ int found_begin = 0;
- for (int32_t i=pendingQ.Length()-1; i>=0; --i) {
+- nsHttpTransaction *t = pendingQ[i];
+- if (trans->Priority() >= t->Priority()) {
+- pendingQ.InsertElementAt(i+1, trans);
+- return;
+- }
+ if (pendingQ.IsEmpty()) {
+ pendingQ.InsertElementAt(0, trans);
+ return;
-+ }
+ }
+
-+// #define PRESERVE_PRIORITY_ORDER
-+#ifdef PRESERVE_PRIORITY_ORDER
-+ // XXX: Untested
-+ for (uint32_t i=0; i < len; ++i) {
- nsHttpTransaction *t = pendingQ[i];
-- if (trans->Priority() >= t->Priority()) {
-- pendingQ.InsertElementAt(i+1, trans);
-- return;
+ pendingQ.InsertElementAt(0, trans);
+
-+ /* As soon as we see a priority >= us, our insertion
-+ * range starts there */
-+ if (!found_begin && t->Priority() >= trans->Priority()) {
-+ begin = i;
-+ found_begin = 1;
-+ }
-+ /* As soon as we see a priority > us, our insertion
-+ * range ends there */
-+ if (t->Priority() > trans->Priority()) {
-+ end = i;
-+ break;
++ // FIXME: Refactor into standalone helper (for nsHttpPipeline)
++ // Or at least simplify this function if this shuffle ends up
++ // being an improvement.
++ uint32_t i = 0;
++ for (i=0; i < len; ++i) {
++ uint32_t ridx = rand() % len;
++
++ nsHttpTransaction *tmp = pendingQ[i];
++ pendingQ[i] = pendingQ[ridx];
++ pendingQ[ridx] = tmp;
++ }
+ }
+
+ //-----------------------------------------------------------------------------
+@@ -919,6 +932,8 @@ nsHttpConnectionMgr::ProcessPendingQForEntry(nsConnectionEntry *ent)
+ nsHttpTransaction *trans;
+ nsresult rv;
+ bool dispatchedSuccessfully = false;
++ int dispatchCount = 0;
++ int total = count;
+
+ // iterate the pending list until one is dispatched successfully. Keep
+ // iterating afterwards only until a transaction fails to dispatch.
+@@ -953,16 +968,29 @@ nsHttpConnectionMgr::ProcessPendingQForEntry(nsConnectionEntry *ent)
+ dispatchedSuccessfully = true;
+ count = ent->mPendingQ.Length();
+ --i;
++ dispatchCount++;
+ continue;
}
+
+- if (dispatchedSuccessfully)
+- return true;
++ // We want to keep walking the dispatch table to ensure requests
++ // get combined properly.
++ //if (dispatchedSuccessfully) {
++ // return true;
++ //}
+
+ NS_ABORT_IF_FALSE(count == ((int32_t) ent->mPendingQ.Length()),
+ "something mutated pending queue from "
+ "GetConnection()");
}
-- pendingQ.InsertElementAt(0, trans);
+
-+ // XXX Verify that begin..end are all == trans->Priority()
++#ifdef WTF_DEBUG
++ if (dispatchedSuccessfully) {
++ fprintf(stderr, "WTF-queue: Dispatched %d/%d pending transactions for %s\n",
++ dispatchCount, total, ent->mConnInfo->Host());
++ return true;
++ }
+#endif
+
-+ // Choose random destination begin..end
-+ uint32_t count = end - begin;
-+ if (count == 0) count = 1;
-+
-+ // FIXME: rand() is not crypto-secure.. but meh, this code will probably
-+ // change like 2 dozen more times before merge, and rand() is probably
-+ // good enough for our purposes anyways.
-+ pendingQ.InsertElementAt(begin + (rand()%count), trans);
+ return false;
}
- //-----------------------------------------------------------------------------
-@@ -68,6 +101,12 @@ nsHttpConnectionMgr::nsHttpConnectionMgr()
- mCT.Init();
- mAlternateProtocolHash.Init(16);
- mSpdyPreferredHash.Init();
-+
-+ nsresult rv;
-+ mRandomGenerator = do_GetService("@mozilla.org/security/random-generator;1", &rv);
-+ if (NS_FAILED(rv)) {
-+ mRandomGenerator = nullptr;
-+ }
+@@ -1263,7 +1291,7 @@ nsHttpConnectionMgr::MakeNewConnection(nsConnectionEntry *ent,
}
- nsHttpConnectionMgr::~nsHttpConnectionMgr()
-@@ -1120,6 +1159,19 @@ nsHttpConnectionMgr::AtActiveConnectionLimit(nsConnectionEntry *ent, uint8_t cap
+ bool
+-nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent,
++nsHttpConnectionMgr::AddToBestPipeline(nsConnectionEntry *ent,
+ nsHttpTransaction *trans,
+ nsHttpTransaction::Classifier classification,
+ uint16_t depthLimit)
+@@ -1300,40 +1328,92 @@ nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent,
+ if (maxdepth < 2)
+ return false;
+
+- nsAHttpTransaction *activeTrans;
++ // Find out how many requests of this class we have
++ uint32_t sameClass = 0;
++ uint32_t allClasses = ent->mPendingQ.Length();
++ for (uint32_t i = 0; i < allClasses; ++i) {
++ if (trans != ent->mPendingQ[i] &&
++ classification == ent->mPendingQ[i]->Classification()) {
++ sameClass++;
++ }
++ }
+
++ nsAHttpTransaction *activeTrans;
++ nsHttpPipeline *pipeline;
+ nsHttpConnection *bestConn = nullptr;
+ uint32_t activeCount = ent->mActiveConns.Length();
+- uint32_t bestConnLength = 0;
+- uint32_t connLength;
++ uint32_t pipelineDepth;
++ uint32_t requestLen;
++ uint32_t totalDepth = 0;
++
++ // Now, try to find the best pipeline
++ nsTArray<nsHttpConnection *> validConns;
++ nsTArray<nsHttpConnection *> betterConns;
++ nsTArray<nsHttpConnection *> bestConns;
++ uint32_t numPipelines = 0;
+
+ for (uint32_t i = 0; i < activeCount; ++i) {
+ nsHttpConnection *conn = ent->mActiveConns[i];
+- if (!conn->SupportsPipelining())
+- continue;
- LOG((" connection count = %d, limit %d\n", totalCount, maxPersistConns));
+- if (conn->Classification() != classification)
++ if (!conn->SupportsPipelining())
+ continue;
-+ // Fuzz maxConns for website fingerprinting attack
-+ // We create a range of maxConns/5 up to 6*maxConns/5
-+ // because this function is called repeatedly, and we'll
-+ // end up converging on the high side of concurrent connections
-+ // after a short while.
-+ PRUint8 *bytes = nullptr;
-+ nsresult rv = mRandomGenerator->GenerateRandomBytes(1, &bytes);
-+ NS_ENSURE_SUCCESS(rv, rv);
+ activeTrans = conn->Transaction();
+
-+ bytes[0] = bytes[0] % (maxPersistConns + 1);
-+ maxPersistConns = (maxPersistConns/5) + bytes[0];
-+ NS_Free(bytes);
+ if (!activeTrans ||
+ activeTrans->IsDone() ||
+ NS_FAILED(activeTrans->Status()))
+ continue;
+
+- connLength = activeTrans->PipelineDepth();
++ pipeline = activeTrans->QueryPipeline();
++ if (!pipeline)
++ continue;
++
++ numPipelines++;
+
- // use >= just to be safe
- bool result = (totalCount >= maxPersistConns);
- LOG((" result: %s", result ? "true" : "false"));
-@@ -1297,6 +1349,11 @@ nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent,
++ pipelineDepth = activeTrans->PipelineDepth();
++ requestLen = pipeline->RequestDepth();
- maxdepth = PR_MIN(maxdepth, depthLimit);
+- if (maxdepth <= connLength)
++ totalDepth += pipelineDepth;
++
++ // Only count in-flight requests towards maxdepth.
++ if (maxdepth <= (pipelineDepth - requestLen))
+ continue;
-+ if (maxdepth/2 > 1) {
-+ // This is a crazy hack to randomize pipeline depth a bit more..
-+ maxdepth = 1 + maxdepth/2 + (rand() % (maxdepth/2));
+- if (!bestConn || (connLength < bestConnLength)) {
+- bestConn = conn;
+- bestConnLength = connLength;
+- }
+- }
++ validConns.AppendElement(conn);
++
++ // Prefer a pipeline that either has at least two requests
++ // queued already, or for which we can add multiple requests
++ if (requestLen + allClasses < mMaxOptimisticPipelinedRequests)
++ continue;
+
+- if (!bestConn)
++ betterConns.AppendElement(conn);
++
++ // Prefer a pipeline with the same classification if
++ // our current classes will put it over the line
++ if (conn->Classification() != classification)
++ continue;
++ if (requestLen + sameClass < mMaxOptimisticPipelinedRequests)
++ continue;
++
++ bestConns.AppendElement(conn);
+ }
+
- if (maxdepth < 2)
++ const char *type;
++ if (bestConns.Length()) {
++ type = "best";
++ bestConn = bestConns[rand()%bestConns.Length()];
++ } else if (betterConns.Length()) {
++ type = "better";
++ bestConn = betterConns[rand()%betterConns.Length()];
++ } else if (validConns.Length() && totalDepth == 0) {
++ // We only use valid conns if it's a last resort
++ // (No other requests are pending or in flight)
++ type = "valid";
++ bestConn = validConns[rand()%validConns.Length()];
++ } else {
return false;
++ }
+
+ activeTrans = bestConn->Transaction();
+ nsresult rv = activeTrans->AddTransaction(trans);
+@@ -1343,6 +1423,14 @@ nsHttpConnectionMgr::AddToShortestPipeline(nsConnectionEntry *ent,
+ LOG((" scheduling trans %p on pipeline at position %d\n",
+ trans, trans->PipelinePosition()));
+
++#ifdef WTF_DEBUG
++ pipeline = activeTrans->QueryPipeline();
++ fprintf(stderr, "WTF-depth: Added trans to %s of %d/%d/%d/%d pipelines. Request len %d/%d for %s\n",
++ type, bestConns.Length(), betterConns.Length(), validConns.Length(),
++ numPipelines, pipeline->RequestDepth(), activeTrans->PipelineDepth(),
++ ent->mConnInfo->Host());
++#endif
++
+ if ((ent->PipelineState() == PS_YELLOW) && (trans->PipelinePosition() > 1))
+ ent->SetYellowConnection(bestConn);
+ return true;
+@@ -1403,26 +1491,12 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
+ nsHttpTransaction::Classifier classification = trans->Classification();
+ uint8_t caps = trans->Caps();
+
++ bool allowNewPipelines = true;
++
+ // no keep-alive means no pipelines either
+ if (!(caps & NS_HTTP_ALLOW_KEEPALIVE))
+ caps = caps & ~NS_HTTP_ALLOW_PIPELINING;
+
+- // 0 - If this should use spdy then dispatch it post haste.
+- // 1 - If there is connection pressure then see if we can pipeline this on
+- // a connection of a matching type instead of using a new conn
+- // 2 - If there is an idle connection, use it!
+- // 3 - if class == reval or script and there is an open conn of that type
+- // then pipeline onto shortest pipeline of that class if limits allow
+- // 4 - If we aren't up against our connection limit,
+- // then open a new one
+- // 5 - Try a pipeline if we haven't already - this will be unusual because
+- // it implies a low connection pressure situation where
+- // MakeNewConnection() failed.. that is possible, but unlikely, due to
+- // global limits
+- // 6 - no connection is available - queue it
+-
+- bool attemptedOptimisticPipeline = !(caps & NS_HTTP_ALLOW_PIPELINING);
+-
+ // step 0
+ // look for existing spdy connection - that's always best because it is
+ // essentially pipelining without head of line blocking
+@@ -1436,20 +1510,27 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
+ }
+ }
+
+- // step 1
+- // If connection pressure, then we want to favor pipelining of any kind
+- if (IsUnderPressure(ent, classification) && !attemptedOptimisticPipeline) {
+- attemptedOptimisticPipeline = true;
+- if (AddToShortestPipeline(ent, trans,
+- classification,
+- mMaxOptimisticPipelinedRequests)) {
+- return NS_OK;
+- }
++ // step 1: Try a pipeline
++ if (caps & NS_HTTP_ALLOW_PIPELINING &&
++ AddToBestPipeline(ent, trans, classification,
++ mMaxPipelinedRequests)) {
++ return NS_OK;
+ }
+
+- // step 2
+- // consider an idle persistent connection
+- if (caps & NS_HTTP_ALLOW_KEEPALIVE) {
++ // Step 2: Decide if we should forbid new pipeline creation.
++ //
++ // FIXME: We repurposed mMaxOptimisticPipelinedRequests here to mean:
++ // "Don't make a new pipeline until you have this many requests pending and
++ // no potential connections to put them on". It might be nice to give this
++ // its own pref..
++ if (HasPipelines(ent) &&
++ ent->mPendingQ.Length() < mMaxOptimisticPipelinedRequests &&
++ trans->Classification() != nsAHttpTransaction::CLASS_SOLO &&
++ caps & NS_HTTP_ALLOW_PIPELINING)
++ allowNewPipelines = false;
++
++ // step 3: consider an idle persistent connection
++ if (allowNewPipelines && (caps & NS_HTTP_ALLOW_KEEPALIVE)) {
+ nsRefPtr<nsHttpConnection> conn;
+ while (!conn && (ent->mIdleConns.Length() > 0)) {
+ conn = ent->mIdleConns[0];
+@@ -1483,21 +1564,8 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
+ }
+ }
+
+- // step 3
+- // consider pipelining scripts and revalidations
+- if (!attemptedOptimisticPipeline &&
+- (classification == nsHttpTransaction::CLASS_REVALIDATION ||
+- classification == nsHttpTransaction::CLASS_SCRIPT)) {
+- attemptedOptimisticPipeline = true;
+- if (AddToShortestPipeline(ent, trans,
+- classification,
+- mMaxOptimisticPipelinedRequests)) {
+- return NS_OK;
+- }
+- }
+-
+- // step 4
+- if (!onlyReusedConnection) {
++ // step 4: Maybe make a connection?
++ if (!onlyReusedConnection && allowNewPipelines) {
+ nsresult rv = MakeNewConnection(ent, trans);
+ if (NS_SUCCEEDED(rv)) {
+ // this function returns NOT_AVAILABLE for asynchronous connects
+@@ -1510,17 +1578,16 @@ nsHttpConnectionMgr::TryDispatchTransaction(nsConnectionEntry *ent,
+ return rv;
+ }
+ }
++
++ // XXX: We dequeue and queue the same url here sometimes..
++#ifdef WTF_DEBUG
++ nsHttpRequestHead *head = trans->RequestHead();
++ fprintf(stderr, "WTF: Queuing url %s%s\n",
++ ent->mConnInfo->Host(),
++ head ? head->RequestURI().BeginReading() : "<unknown?>");
++#endif
+
+- // step 5
+- if (caps & NS_HTTP_ALLOW_PIPELINING) {
+- if (AddToShortestPipeline(ent, trans,
+- classification,
+- mMaxPipelinedRequests)) {
+- return NS_OK;
+- }
+- }
+-
+- // step 6
++ // step 6: Queue it
+ return NS_ERROR_NOT_AVAILABLE; /* queue it */
+ }
+
+@@ -1590,10 +1657,20 @@ nsHttpConnectionMgr::DispatchAbstractTransaction(nsConnectionEntry *ent,
+ if (!NS_SUCCEEDED(rv))
+ return rv;
+ transaction = pipeline;
++#ifdef WTF_DEBUG
++ fprintf(stderr, "WTF: New pipeline created from %d idle conns for host %s\n",
++ ent->mIdleConns.Length(), ent->mConnInfo->Host());
++#endif
+ }
+ else {
+ LOG((" not using pipeline datastructure due to class solo.\n"));
+ transaction = aTrans;
++#ifdef WTF_TEST
++ nsHttpRequestHead *head = transaction->RequestHead();
++ fprintf(stderr, "WTF-order: Pipeline forbidden for url %s%s\n",
++ ent->mConnInfo->Host(),
++ head ? head->RequestURI().BeginReading() : "<unknown?>");
++#endif
+ }
+
+ nsRefPtr<nsConnectionHandle> handle = new nsConnectionHandle(conn);
+@@ -1692,27 +1769,15 @@ nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans)
+ "Sticky Connection Not In Active List");
+ trans->SetConnection(nullptr);
+ rv = DispatchTransaction(ent, trans, conn);
+- }
+- else
+- rv = TryDispatchTransaction(ent, false, trans);
+-
+- if (NS_SUCCEEDED(rv)) {
+- LOG((" ProcessNewTransaction Dispatch Immediately trans=%p\n", trans));
+ return rv;
+ }
+-
+- if (rv == NS_ERROR_NOT_AVAILABLE) {
+- LOG((" adding transaction to pending queue "
+- "[trans=%p pending-count=%u]\n",
+- trans, ent->mPendingQ.Length()+1));
+- // put this transaction on the pending queue...
++ else {
++ // XXX: maybe check the queue first and directly call TryDispatch?
+ InsertTransactionSorted(ent->mPendingQ, trans);
+ NS_ADDREF(trans);
++ ProcessPendingQForEntry(ent);
+ return NS_OK;
+ }
+-
+- LOG((" ProcessNewTransaction Hard Error trans=%p rv=%x\n", trans, rv));
+- return rv;
+ }
+
+
+@@ -2311,13 +2376,37 @@ nsHttpConnectionMgr::OnMsgSpeculativeConnect(int32_t, void *param)
+ if (preferredEntry)
+ ent = preferredEntry;
++ /* Only speculative connect if we're not pipelining */
+ if (!ent->mIdleConns.Length() && !RestrictConnections(ent) &&
+- !AtActiveConnectionLimit(ent, trans->Caps())) {
++ !HasPipelines(ent) && !AtActiveConnectionLimit(ent, trans->Caps())) {
+ CreateTransport(ent, trans, trans->Caps(), true);
+ }
+ }
+
+ bool
++nsHttpConnectionMgr::HasPipelines(nsConnectionEntry *ent)
++{
++ uint32_t activeCount = ent->mActiveConns.Length();
++
++ if (!ent->SupportsPipelining()) {
++ return false;
++ }
++
++ for (uint32_t i = 0; i < activeCount; ++i) {
++ nsHttpConnection *conn = ent->mActiveConns[i];
++ if (!conn->SupportsPipelining())
++ continue;
++
++ nsAHttpTransaction *activeTrans = conn->Transaction();
++
++ if (activeTrans && !activeTrans->IsDone() &&
++ !NS_FAILED(activeTrans->Status()))
++ return true;
++ }
++ return false;
++}
++
++bool
+ nsHttpConnectionMgr::nsConnectionHandle::IsPersistent()
+ {
+ return mConn->IsPersistent();
+@@ -2852,9 +2941,12 @@ nsConnectionEntry::nsConnectionEntry(nsHttpConnectionInfo *ci)
+ {
+ NS_ADDREF(mConnInfo);
+ if (gHttpHandler->GetPipelineAggressive()) {
+- mGreenDepth = kPipelineUnlimited;
++ // Randomize the pipeline depth (3..32)
++ mGreenDepth = gHttpHandler->GetMaxOptimisticPipelinedRequests()
++ + rand() % gHttpHandler->GetMaxPipelinedRequests();
+ mPipelineState = PS_GREEN;
+ }
++
+ mInitialGreenDepth = mGreenDepth;
+ memset(mPipeliningClassPenalty, 0, sizeof(int16_t) * nsAHttpTransaction::CLASS_MAX);
+ }
+@@ -2892,8 +2984,9 @@ nsConnectionEntry::OnPipelineFeedbackInfo(
+ LOG(("Transaction completed at pipeline depth of %d. Host = %s\n",
+ depth, mConnInfo->Host()));
+
+- if (depth >= 3)
+- mGreenDepth = kPipelineUnlimited;
++ // Don't set this. We want to keep our initial random value..
++ //if (depth >= 3)
++ // mGreenDepth = kPipelineUnlimited;
+ }
+
+ nsAHttpTransaction::Classifier classification;
+@@ -2921,6 +3014,11 @@ nsConnectionEntry::OnPipelineFeedbackInfo(
+ mPipelineState, mConnInfo->Host()));
+ mPipelineState = PS_RED;
+ mPipeliningPenalty = 0;
++#ifdef WTF_TEST
++ fprintf(stderr, "WTF-bad: Red pipeline status disabled host %s\n",
++ mConnInfo->Host());
++#endif
++
+ }
+
+ if (mLastCreditTime.IsNull())
diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.h b/netwerk/protocol/http/nsHttpConnectionMgr.h
-index 580710a..b22c669 100644
+index 580710a..7aecb68 100644
--- a/netwerk/protocol/http/nsHttpConnectionMgr.h
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.h
-@@ -23,6 +23,7 @@
+@@ -23,11 +23,23 @@
#include "nsIObserver.h"
#include "nsITimer.h"
#include "nsIX509Cert3.h"
@@ -145,15 +505,187 @@ index 580710a..b22c669 100644
class nsHttpPipeline;
-@@ -585,6 +586,8 @@ private:
- uint64_t mTimeOfNextWakeUp;
- // Timer for next pruning of dead connections.
- nsCOMPtr<nsITimer> mTimer;
-+ // Random number generator for reordering HTTP pipeline
-+ nsCOMPtr<nsIRandomGenerator> mRandomGenerator;
+ class nsIHttpUpgradeListener;
+
++// We need our own optional debug define because pipelining behavior
++// is significantly altered by rendering speed (which is abysmal on
++// debug builds)
++#ifdef DEBUG
++# define WTF_DEBUG
++#endif
++
++#ifdef WTF_DEBUG
++# define WTF_TEST
++#endif
++
+ //-----------------------------------------------------------------------------
+
+ class nsHttpConnectionMgr : public nsIObserver
+@@ -478,6 +490,7 @@ private:
+ nsresult BuildPipeline(nsConnectionEntry *,
+ nsAHttpTransaction *,
+ nsHttpPipeline **);
++ bool HasPipelines(nsConnectionEntry *);
+ bool RestrictConnections(nsConnectionEntry *);
+ nsresult ProcessNewTransaction(nsHttpTransaction *);
+ nsresult EnsureSocketThreadTargetIfOnline();
+@@ -492,7 +505,7 @@ private:
+
+ nsresult MakeNewConnection(nsConnectionEntry *ent,
+ nsHttpTransaction *trans);
+- bool AddToShortestPipeline(nsConnectionEntry *ent,
++ bool AddToBestPipeline(nsConnectionEntry *ent,
+ nsHttpTransaction *trans,
+ nsHttpTransaction::Classifier classification,
+ uint16_t depthLimit);
+diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h
+index 2963195..cd79069 100644
+--- a/netwerk/protocol/http/nsHttpHandler.h
++++ b/netwerk/protocol/http/nsHttpHandler.h
+@@ -215,6 +215,8 @@ public:
+ nsCString& hostLine);
+
+ bool GetPipelineAggressive() { return mPipelineAggressive; }
++ uint32_t GetMaxPipelinedRequests() { return mMaxPipelinedRequests; }
++ uint32_t GetMaxOptimisticPipelinedRequests() { return mMaxOptimisticPipelinedRequests; }
+ void GetMaxPipelineObjectSize(int64_t *outVal)
+ {
+ *outVal = mMaxPipelineObjectSize;
+diff --git a/netwerk/protocol/http/nsHttpPipeline.cpp b/netwerk/protocol/http/nsHttpPipeline.cpp
+index 9e59878..a9e9911 100644
+--- a/netwerk/protocol/http/nsHttpPipeline.cpp
++++ b/netwerk/protocol/http/nsHttpPipeline.cpp
+@@ -87,6 +87,32 @@ nsHttpPipeline::~nsHttpPipeline()
+ free(mPushBackBuf);
+ }
+
++// Generate a shuffled request ordering sequence
++void
++nsHttpPipeline::ShuffleTransOrder(uint32_t count)
++{
++ if (count < 2)
++ return;
++
++ uint32_t pos = mRequestQ[0]->PipelinePosition();
++ uint32_t i = 0;
++
++ for (i=0; i < count; ++i) {
++ uint32_t ridx = rand() % count;
++
++ nsAHttpTransaction *tmp = mRequestQ[i];
++ mRequestQ[i] = mRequestQ[ridx];
++ mRequestQ[ridx] = tmp;
++ }
++
++ for (i=0; i < count; ++i) {
++ mRequestQ[i]->SetPipelinePosition(pos);
++ pos++;
++ }
++
++ LOG(("nsHttpPipeline::ShuffleTransOrder: Shuffled %d transactions.\n", count));
++}
++
+ nsresult
+ nsHttpPipeline::AddTransaction(nsAHttpTransaction *trans)
+ {
+@@ -112,6 +138,8 @@ nsHttpPipeline::AddTransaction(nsAHttpTransaction *trans)
+ // the pipeline object.
+ trans->SetConnection(this);
+
++ ShuffleTransOrder(mRequestQ.Length());
++
+ if (mConnection && !mClosed && mRequestQ.Length() == 1)
+ mConnection->ResumeSend();
+
+@@ -760,8 +788,11 @@ nsHttpPipeline::CancelPipeline(nsresult originalReason)
+ if (respLen > 1)
+ mResponseQ.TruncateLength(1);
+
+- DontReuse();
+- Classify(nsAHttpTransaction::CLASS_SOLO);
++ /* Don't flag timed out connections as unreusable.. Tor is just slow :( */
++ if (originalReason != NS_ERROR_NET_TIMEOUT) {
++ DontReuse();
++ Classify(nsAHttpTransaction::CLASS_SOLO);
++ }
+
+ return total;
+ }
+@@ -842,8 +873,19 @@ nsHttpPipeline::FillSendBuf()
+
+ uint32_t n;
+ uint64_t avail;
++ uint64_t totalAvailable = Available();
++ uint64_t totalSent = 0;
++ uint64_t reqsSent = 0;
++ uint64_t alreadyPending = 0;
++
++ mSendBufIn->Available(&alreadyPending);
++
+ nsAHttpTransaction *trans;
+ nsITransport *transport = Transport();
++#ifdef WTF_TEST
++ nsRefPtr<nsHttpConnectionInfo> ci;
++ GetConnectionInfo(getter_AddRefs(ci));
++#endif
+
+ while ((trans = Request(0)) != nullptr) {
+ avail = trans->Available();
+@@ -864,6 +906,7 @@ nsHttpPipeline::FillSendBuf()
+ }
+
+ mSendingToProgress += n;
++ totalSent += n;
+ if (!mSuppressSendEvents && transport) {
+ // Simulate a SENDING_TO event
+ trans->OnTransportStatus(transport,
+@@ -874,6 +917,14 @@ nsHttpPipeline::FillSendBuf()
+
+ avail = trans->Available();
+ if (avail == 0) {
++#ifdef WTF_TEST
++ nsHttpRequestHead *head = trans->RequestHead();
++ fprintf(stderr, "WTF-order: Pipelined req %d/%d (%dB). Url: %s%s\n",
++ trans->PipelinePosition(), PipelineDepth(), n,
++ ci->Host(), head ? head->RequestURI().BeginReading() : "<unknown?>");
++#endif
++ reqsSent++;
++
+ // move transaction from request queue to response queue
+ mRequestQ.RemoveElementAt(0);
+ mResponseQ.AppendElement(trans);
+@@ -893,5 +944,12 @@ nsHttpPipeline::FillSendBuf()
+ else
+ mRequestIsPartial = true;
+ }
++
++#ifdef WTF_TEST
++ if (totalSent)
++ fprintf(stderr, "WTF-combine: Sent %d/%d bytes of %d combined pipelined requests for host %s\n",
++ alreadyPending+totalSent, totalAvailable, reqsSent, ci->Host());
++#endif
++
+ return NS_OK;
+ }
+diff --git a/netwerk/protocol/http/nsHttpPipeline.h b/netwerk/protocol/http/nsHttpPipeline.h
+index 746a196..4dc06c1 100644
+--- a/netwerk/protocol/http/nsHttpPipeline.h
++++ b/netwerk/protocol/http/nsHttpPipeline.h
+@@ -27,11 +27,14 @@ public:
+ nsHttpPipeline();
+ virtual ~nsHttpPipeline();
+
++ uint32_t RequestDepth() { return mRequestQ.Length(); }
++
+ private:
+ nsresult FillSendBuf();
+
+ static NS_METHOD ReadFromPipe(nsIInputStream *, void *, const char *,
+ uint32_t, uint32_t, uint32_t *);
++ void ShuffleTransOrder(uint32_t);
- // A 1s tick to call nsHttpConnection::ReadTimeoutTick on
- // active http/1 connections and check for orphaned half opens.
+ // convenience functions
+ nsAHttpTransaction *Request(int32_t i)
--
-1.7.5.4
+1.7.9.5
1
0
[torbrowser/maint-2.4] Bug 3875: Use Optimistic Data SOCKS handshake.
by mikeperry@torproject.org 11 Apr '13
by mikeperry@torproject.org 11 Apr '13
11 Apr '13
commit 01c866ea4171ef8d974d89cb16efbcc5e06f8d15
Author: Mike Perry <mikeperry-git(a)fscked.org>
Date: Tue Apr 2 16:04:33 2013 -0700
Bug 3875: Use Optimistic Data SOCKS handshake.
---
.../0028-Use-Optimistic-Data-SOCKS-variant.patch | 82 ++++++++++++++++++++
1 files changed, 82 insertions(+), 0 deletions(-)
diff --git a/src/current-patches/firefox/0028-Use-Optimistic-Data-SOCKS-variant.patch b/src/current-patches/firefox/0028-Use-Optimistic-Data-SOCKS-variant.patch
new file mode 100644
index 0000000..b6d43c1
--- /dev/null
+++ b/src/current-patches/firefox/0028-Use-Optimistic-Data-SOCKS-variant.patch
@@ -0,0 +1,82 @@
+From 64548e75e1cb68a2449b001629c0ee0d10636d90 Mon Sep 17 00:00:00 2001
+From: Tao Wang <t55wang(a)uwaterloo.ca>
+Date: Tue, 2 Apr 2013 15:56:49 -0700
+Subject: [PATCH 28/28] Use Optimistic Data SOCKS variant.
+
+This patch alters Firefox's SOCKS handshake to preemptively send data before
+it is actually connected. This allows us to save a round trip during
+connection setup.
+
+See:
+https://gitweb.torproject.org/torspec.git/blob/HEAD:/proposals/181-optimistic-data-client.txt
+---
+ netwerk/base/src/nsSocketTransport2.cpp | 20 ++++++++++++++++++--
+ netwerk/base/src/nsSocketTransport2.h | 4 +++-
+ netwerk/socket/nsSOCKSIOLayer.cpp | 4 +++-
+ 3 files changed, 24 insertions(+), 4 deletions(-)
+
+diff --git a/netwerk/base/src/nsSocketTransport2.cpp b/netwerk/base/src/nsSocketTransport2.cpp
+index 15870bb..668d18f 100644
+--- a/netwerk/base/src/nsSocketTransport2.cpp
++++ b/netwerk/base/src/nsSocketTransport2.cpp
+@@ -1543,9 +1543,25 @@ nsSocketTransport::OnSocketReady(PRFileDesc *fd, int16_t outFlags)
+ // Update poll timeout in case it was changed
+ mPollTimeout = mTimeouts[TIMEOUT_READ_WRITE];
+ }
+- else if (mState == STATE_CONNECTING) {
++
++//STATE_SENDINGGET: handshake proceeded to state "sent connect"
++//one more poll to OnSocketReady will trigger the get request, and state STATE_SENTGET
++//STATE_SENTGET: continue and finish handshake
++ else if (mState == STATE_SENDINGGET) {
++ if ((mPollFlags & PR_POLL_WRITE) && (outFlags & ~PR_POLL_READ)) {
++ mOutput.OnSocketReady(NS_OK);
++ }
++ mPollTimeout = mTimeouts[TIMEOUT_READ_WRITE];
++ mState = STATE_SENTGET;
++ }
++
++ else if (mState == STATE_CONNECTING || mState == STATE_SENTGET) {
+ PRStatus status = PR_ConnectContinue(fd, outFlags);
+- if (status == PR_SUCCESS) {
++ if (status == PR_SUCCESS && mState == STATE_CONNECTING) {
++ OnSocketConnected();
++ mState = STATE_SENDINGGET;
++ }
++ else if (status == PR_SUCCESS && mState == STATE_SENTGET) {
+ //
+ // we are connected!
+ //
+diff --git a/netwerk/base/src/nsSocketTransport2.h b/netwerk/base/src/nsSocketTransport2.h
+index d9ac3d3..0c92d0a 100644
+--- a/netwerk/base/src/nsSocketTransport2.h
++++ b/netwerk/base/src/nsSocketTransport2.h
+@@ -154,7 +154,9 @@ private:
+ STATE_IDLE,
+ STATE_RESOLVING,
+ STATE_CONNECTING,
+- STATE_TRANSFERRING
++ STATE_TRANSFERRING,
++ STATE_SENDINGGET,
++ STATE_SENTGET
+ };
+
+ //-------------------------------------------------------------------------
+diff --git a/netwerk/socket/nsSOCKSIOLayer.cpp b/netwerk/socket/nsSOCKSIOLayer.cpp
+index 24edc78..64f6001 100644
+--- a/netwerk/socket/nsSOCKSIOLayer.cpp
++++ b/netwerk/socket/nsSOCKSIOLayer.cpp
+@@ -77,7 +77,9 @@ public:
+ void SetConnectTimeout(PRIntervalTime to);
+ PRStatus DoHandshake(PRFileDesc *fd, int16_t oflags = -1);
+ int16_t GetPollFlags() const;
+- bool IsConnected() const { return mState == SOCKS_CONNECTED; }
++ bool IsConnected() const { return (mState == SOCKS_CONNECTED ||
++ mState == SOCKS5_READ_CONNECT_RESPONSE_TOP); }
++
+ void ForgetFD() { mFD = nullptr; }
+
+ private:
+--
+1.7.9.5
+
1
0
[torbrowser/maint-2.4] Bug 8286: Fetch our source deps from an https mirror
by mikeperry@torproject.org 11 Apr '13
by mikeperry@torproject.org 11 Apr '13
11 Apr '13
commit 1307692dcd6129321b21f3e261346a94486b9642
Author: Mike Perry <mikeperry-git(a)fscked.org>
Date: Thu Apr 4 19:31:27 2013 -0700
Bug 8286: Fetch our source deps from an https mirror
Also check the certificate on downloads...
---
build-scripts/versions-alpha.mk | 62 +++++++++++++++++++-------------------
build-scripts/versions.mk | 60 +++++++++++++++++++-------------------
2 files changed, 61 insertions(+), 61 deletions(-)
diff --git a/build-scripts/versions-alpha.mk b/build-scripts/versions-alpha.mk
index c4ed4e0..aaa3057 100644
--- a/build-scripts/versions-alpha.mk
+++ b/build-scripts/versions-alpha.mk
@@ -39,22 +39,22 @@ HTTPSEVERYWHERE_PACKAGE=https-everywhere-$(HTTPSEVERYWHERE_VER).xpi
PDFJS_PACKAGE=addon-352704-latest.xpi
OBFSPROXY_PACKAGE=obfsproxy-$(OBFSPROXY_VER).tar.gz
-## Location of files for download
-ZLIB_URL=http://www.zlib.net/$(ZLIB_PACKAGE)
-OPENSSL_URL=http://www.openssl.org/source/$(OPENSSL_PACKAGE)
-LIBPNG_URL=ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng15/$(LIBPNG_PACKAGE)
-QT_URL=ftp://ftp.qt.nokia.com/qt/source/$(QT_PACKAGE)
-VIDALIA_URL=https://archive.torproject.org/tor-package-archive/vidalia/$(VIDALIA_PACKAGE)
-LIBEVENT_URL=https://github.com/downloads/libevent/libevent/$(LIBEVENT_PACKAGE)
-TOR_URL=https://archive.torproject.org/tor-package-archive/$(TOR_PACKAGE)
-PIDGIN_URL=http://sourceforge.net/projects/pidgin/files/Pidgin/$(PIDGIN_PACKAGE)
-FIREFOX_URL=https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/$(FIREFOX_VER)/source/$(FIREFOX_PACKAGE)
-MOZBUILD_URL=https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/$(MOZBUILD_PACKAGE)
-#TORBUTTON_URL=https://archive.torproject.org/tor-package-archive/torbutton/$(TORBUTTON_PACKAGE)
-TORBUTTON_URL=https://people.torproject.org/~mikeperry/$(TORBUTTON_PACKAGE)
-NOSCRIPT_URL=https://addons.mozilla.org/firefox/downloads/latest/722/$(NOSCRIPT_PACKAGE)
-HTTPSEVERYWHERE_URL=https://eff.org/files/$(HTTPSEVERYWHERE_PACKAGE)
-OBFSPROXY_URL=https://archive.torproject.org/tor-package-archive/obfsproxy/$(OBFSPROXY_PACKAGE)
+## Location of files for download over HTTPS
+TBB_THIRD_PARTY_MIRROR=https://people.torproject.org/~mikeperry/mirrors/sources/
+ZLIB_URL=$(TBB_THIRD_PARTY_MIRROR)$(ZLIB_PACKAGE)
+OPENSSL_URL=$(TBB_THIRD_PARTY_MIRROR)$(OPENSSL_PACKAGE)
+LIBPNG_URL=$(TBB_THIRD_PARTY_MIRROR)$(LIBPNG_PACKAGE)
+QT_URL=$(TBB_THIRD_PARTY_MIRROR)$(QT_PACKAGE)
+VIDALIA_URL=$(TBB_THIRD_PARTY_MIRROR)$(VIDALIA_PACKAGE)
+LIBEVENT_URL=$(TBB_THIRD_PARTY_MIRROR)$(LIBEVENT_PACKAGE)
+TOR_URL=$(TBB_THIRD_PARTY_MIRROR)$(TOR_PACKAGE)
+PIDGIN_URL=$(TBB_THIRD_PARTY_MIRROR)$(PIDGIN_PACKAGE)
+FIREFOX_URL=$(TBB_THIRD_PARTY_MIRROR)$(FIREFOX_PACKAGE)
+MOZBUILD_URL=$(TBB_THIRD_PARTY_MIRROR)$(MOZBUILD_PACKAGE)
+TORBUTTON_URL=$(TBB_THIRD_PARTY_MIRROR)$(TORBUTTON_PACKAGE)
+NOSCRIPT_URL=$(TBB_THIRD_PARTY_MIRROR)$(NOSCRIPT_PACKAGE)
+HTTPSEVERYWHERE_URL=$(TBB_THIRD_PARTY_MIRROR)$(HTTPSEVERYWHERE_PACKAGE)
+OBFSPROXY_URL=$(TBB_THIRD_PARTY_MIRROR)$(OBFSPROXY_PACKAGE)
# Provide some mappings between lower and upper case, which means we don't need
# to rely on shell shenanigans when we need the upper case version. This is
@@ -111,54 +111,54 @@ $(BUILD_DIR):
# at least for those packages that support it.
$(FETCH_DIR)/$(ZLIB_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(ZLIB_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(ZLIB_URL)
$(FETCH_DIR)/$(LIBPNG_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(LIBPNG_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(LIBPNG_URL)
$(FETCH_DIR)/$(QT_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(QT_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(QT_URL)
$(FETCH_DIR)/$(OPENSSL_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(OPENSSL_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(OPENSSL_URL)
$(FETCH_DIR)/$(VIDALIA_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(VIDALIA_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(VIDALIA_URL)
$(FETCH_DIR)/$(LIBEVENT_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(LIBEVENT_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(LIBEVENT_URL)
$(FETCH_DIR)/$(TOR_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(TOR_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(TOR_URL)
$(FETCH_DIR)/$(FIREFOX_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(FIREFOX_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(FIREFOX_URL)
$(FETCH_DIR)/$(MOZBUILD_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(MOZBUILD_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(MOZBUILD_URL)
torbutton.xpi:
- $(WGET) --no-check-certificate -O $@ $(TORBUTTON_URL)
+ $(WGET) -O $@ $(TORBUTTON_URL)
noscript.xpi:
- $(WGET) --no-check-certificate -O $@ $(NOSCRIPT_URL)
+ $(WGET) -O $@ $(NOSCRIPT_URL)
httpseverywhere.xpi:
- $(WGET) --no-check-certificate -O $@ $(HTTPSEVERYWHERE_URL)
+ $(WGET) -O $@ $(HTTPSEVERYWHERE_URL)
pdfjs.xpi:
- $(WGET) --no-check-certificate -O $@ $(PDFJS_URL)
+ $(WGET) -O $@ $(PDFJS_URL)
## Generic language pack rule, needs OS-specific MOZILLA_LANGUAGE
langpack_%.xpi:
- $(WGET) --no-check-certificate -O $@ $(MOZILLA_LANGUAGE)/$*.xpi
+ $(WGET) -O $@ $(MOZILLA_LANGUAGE)/$*.xpi
## English comes as default, so nothing to do here for the language packe
langpack_en-US.xpi:
touch $@
$(FETCH_DIR)/$(OBFSPROXY_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(OBFSPROXY_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(OBFSPROXY_URL)
unpack-source: $(ZLIB_DIR) $(OPENSSL_DIR) $(LIBPNG_DIR) $(QT_DIR) $(VIDALIA_DIR) $(LIBEVENT_DIR) $(TOR_DIR) $(FIREFOX_DIR) $(OBFSPROXY_DIR)
diff --git a/build-scripts/versions.mk b/build-scripts/versions.mk
index d226473..d3a85a3 100644
--- a/build-scripts/versions.mk
+++ b/build-scripts/versions.mk
@@ -37,22 +37,22 @@ NOSCRIPT_PACKAGE=addon-722-latest.xpi
HTTPSEVERYWHERE_PACKAGE=https-everywhere-$(HTTPSEVERYWHERE_VER).xpi
OBFSPROXY_PACKAGE=obfsproxy-$(OBFSPROXY_VER).tar.gz
-## Location of files for download
-ZLIB_URL=http://www.zlib.net/$(ZLIB_PACKAGE)
-OPENSSL_URL=http://www.openssl.org/source/$(OPENSSL_PACKAGE)
-LIBPNG_URL=ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng15/$(LIBPNG_PACKAGE)
-QT_URL=ftp://ftp.qt.nokia.com/qt/source/$(QT_PACKAGE)
-VIDALIA_URL=https://archive.torproject.org/tor-package-archive/vidalia/$(VIDALIA_PACKAGE)
-LIBEVENT_URL=https://github.com/downloads/libevent/libevent/$(LIBEVENT_PACKAGE)
-TOR_URL=https://archive.torproject.org/tor-package-archive/$(TOR_PACKAGE)
-PIDGIN_URL=http://sourceforge.net/projects/pidgin/files/Pidgin/$(PIDGIN_PACKAGE)
-FIREFOX_URL=https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/$(FIREFOX_VER)/source/$(FIREFOX_PACKAGE)
-MOZBUILD_URL=https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/$(MOZBUILD_PACKAGE)
-#TORBUTTON_URL=https://archive.torproject.org/tor-package-archive/torbutton/$(TORBUTTON_PACKAGE)
-TORBUTTON_URL=https://people.torproject.org/~mikeperry/$(TORBUTTON_PACKAGE)
-NOSCRIPT_URL=https://addons.mozilla.org/firefox/downloads/latest/722/$(NOSCRIPT_PACKAGE)
-HTTPSEVERYWHERE_URL=https://eff.org/files/$(HTTPSEVERYWHERE_PACKAGE)
-OBFSPROXY_URL=https://archive.torproject.org/tor-package-archive/obfsproxy/$(OBFSPROXY_PACKAGE)
+## Location of files for download over HTTPS
+TBB_THIRD_PARTY_MIRROR=https://people.torproject.org/~mikeperry/mirrors/sources/
+ZLIB_URL=$(TBB_THIRD_PARTY_MIRROR)$(ZLIB_PACKAGE)
+OPENSSL_URL=$(TBB_THIRD_PARTY_MIRROR)$(OPENSSL_PACKAGE)
+LIBPNG_URL=$(TBB_THIRD_PARTY_MIRROR)$(LIBPNG_PACKAGE)
+QT_URL=$(TBB_THIRD_PARTY_MIRROR)$(QT_PACKAGE)
+VIDALIA_URL=$(TBB_THIRD_PARTY_MIRROR)$(VIDALIA_PACKAGE)
+LIBEVENT_URL=$(TBB_THIRD_PARTY_MIRROR)$(LIBEVENT_PACKAGE)
+TOR_URL=$(TBB_THIRD_PARTY_MIRROR)$(TOR_PACKAGE)
+PIDGIN_URL=$(TBB_THIRD_PARTY_MIRROR)$(PIDGIN_PACKAGE)
+FIREFOX_URL=$(TBB_THIRD_PARTY_MIRROR)$(FIREFOX_PACKAGE)
+MOZBUILD_URL=$(TBB_THIRD_PARTY_MIRROR)$(MOZBUILD_PACKAGE)
+TORBUTTON_URL=$(TBB_THIRD_PARTY_MIRROR)$(TORBUTTON_PACKAGE)
+NOSCRIPT_URL=$(TBB_THIRD_PARTY_MIRROR)$(NOSCRIPT_PACKAGE)
+HTTPSEVERYWHERE_URL=$(TBB_THIRD_PARTY_MIRROR)$(HTTPSEVERYWHERE_PACKAGE)
+OBFSPROXY_URL=$(TBB_THIRD_PARTY_MIRROR)$(OBFSPROXY_PACKAGE)
# Provide some mappings between lower and upper case, which means we don't need
# to rely on shell shenanigans when we need the upper case version. This is
@@ -109,51 +109,51 @@ $(BUILD_DIR):
# at least for those packages that support it.
$(FETCH_DIR)/$(ZLIB_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(ZLIB_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(ZLIB_URL)
$(FETCH_DIR)/$(LIBPNG_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(LIBPNG_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(LIBPNG_URL)
$(FETCH_DIR)/$(QT_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(QT_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(QT_URL)
$(FETCH_DIR)/$(OPENSSL_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(OPENSSL_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(OPENSSL_URL)
$(FETCH_DIR)/$(VIDALIA_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(VIDALIA_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(VIDALIA_URL)
$(FETCH_DIR)/$(LIBEVENT_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(LIBEVENT_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(LIBEVENT_URL)
$(FETCH_DIR)/$(TOR_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(TOR_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(TOR_URL)
$(FETCH_DIR)/$(FIREFOX_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(FIREFOX_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(FIREFOX_URL)
$(FETCH_DIR)/$(MOZBUILD_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(MOZBUILD_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(MOZBUILD_URL)
torbutton.xpi:
- $(WGET) --no-check-certificate -O $@ $(TORBUTTON_URL)
+ $(WGET) -O $@ $(TORBUTTON_URL)
noscript.xpi:
- $(WGET) --no-check-certificate -O $@ $(NOSCRIPT_URL)
+ $(WGET) -O $@ $(NOSCRIPT_URL)
httpseverywhere.xpi:
- $(WGET) --no-check-certificate -O $@ $(HTTPSEVERYWHERE_URL)
+ $(WGET) -O $@ $(HTTPSEVERYWHERE_URL)
## Generic language pack rule, needs OS-specific MOZILLA_LANGUAGE
langpack_%.xpi:
- $(WGET) --no-check-certificate -O $@ $(MOZILLA_LANGUAGE)/$*.xpi
+ $(WGET) -O $@ $(MOZILLA_LANGUAGE)/$*.xpi
## English comes as default, so nothing to do here for the language packe
langpack_en-US.xpi:
touch $@
$(FETCH_DIR)/$(OBFSPROXY_PACKAGE): | $(FETCH_DIR)
- $(WGET) --no-check-certificate --directory-prefix=$(FETCH_DIR) $(OBFSPROXY_URL)
+ $(WGET) --directory-prefix=$(FETCH_DIR) $(OBFSPROXY_URL)
unpack-source: $(ZLIB_DIR) $(OPENSSL_DIR) $(LIBPNG_DIR) $(QT_DIR) $(VIDALIA_DIR) $(LIBEVENT_DIR) $(TOR_DIR) $(FIREFOX_DIR) $(OBFSPROXY_DIR)
1
0
[torbrowser/maint-2.4] Bug 8455: Fix @font-face handling of local() fonts.
by mikeperry@torproject.org 11 Apr '13
by mikeperry@torproject.org 11 Apr '13
11 Apr '13
commit b0e19e9a7e94dcbd6e50ea3739c5b3ce218fe57c
Author: Mike Perry <mikeperry-git(a)fscked.org>
Date: Thu Apr 4 23:25:54 2013 -0700
Bug 8455: Fix @font-face handling of local() fonts.
Also disable fallback font rendering.
---
build-scripts/config/pound_tor.js | 1 +
...11-Limit-the-number-of-fonts-per-document.patch | 149 ++++++++++++++++++--
2 files changed, 141 insertions(+), 9 deletions(-)
diff --git a/build-scripts/config/pound_tor.js b/build-scripts/config/pound_tor.js
index db382a6..1cbf0fd 100644
--- a/build-scripts/config/pound_tor.js
+++ b/build-scripts/config/pound_tor.js
@@ -46,6 +46,7 @@ pref("dom.battery.enabled", false); // fingerprinting due to differing OS implem
pref("dom.network.enabled",false); // fingerprinting due to differing OS implementations
pref("browser.display.max_font_attempts",10);
pref("browser.display.max_font_count",10);
+pref("gfx.downloadable_fonts.fallback_delay", -1);
pref("general.appname.override", "Netscape");
pref("general.appversion.override", "5.0 (Windows)");
pref("general.buildID.override", "0");
diff --git a/src/current-patches/firefox/0011-Limit-the-number-of-fonts-per-document.patch b/src/current-patches/firefox/0011-Limit-the-number-of-fonts-per-document.patch
index f02926a..163968a 100644
--- a/src/current-patches/firefox/0011-Limit-the-number-of-fonts-per-document.patch
+++ b/src/current-patches/firefox/0011-Limit-the-number-of-fonts-per-document.patch
@@ -1,7 +1,7 @@
-From 094f1e4c33656e3f0922d6fcb941deb672fa44a8 Mon Sep 17 00:00:00 2001
+From 81fde0b8f4af7bae20c49ac0ce0ea4df046a6701 Mon Sep 17 00:00:00 2001
From: Mike Perry <mikeperry-git(a)torproject.org>
Date: Wed, 5 Dec 2012 12:25:21 -0800
-Subject: [PATCH 11/27] Limit the number of fonts per document.
+Subject: [PATCH 11/28] Limit the number of fonts per document.
We create two prefs:
browser.display.max_font_count and browser.display.max_font_attempts.
@@ -22,13 +22,38 @@ otherwise hit these limits.
This is done to address:
https://www.torproject.org/projects/torbrowser/design/#fingerprinting-linka…
---
- gfx/thebes/gfxPangoFonts.cpp | 1 +
- layout/base/nsPresContext.cpp | 100 +++++++++++++++++++++++++++++++++++++++++
- layout/base/nsPresContext.h | 9 ++++
- layout/style/nsCSSParser.cpp | 1 +
- layout/style/nsRuleNode.cpp | 56 ++++++++++++++++++++++-
- 5 files changed, 164 insertions(+), 3 deletions(-)
+ gfx/thebes/gfxFont.cpp | 2 +
+ gfx/thebes/gfxPangoFonts.cpp | 1 +
+ gfx/thebes/gfxUserFontSet.cpp | 28 ++++++++++-
+ gfx/thebes/gfxUserFontSet.h | 3 ++
+ layout/base/nsPresContext.cpp | 100 +++++++++++++++++++++++++++++++++++++
+ layout/base/nsPresContext.h | 9 ++++
+ layout/style/nsCSSParser.cpp | 1 +
+ layout/style/nsFontFaceLoader.cpp | 4 +-
+ layout/style/nsFontFaceLoader.h | 2 +-
+ layout/style/nsRuleNode.cpp | 56 +++++++++++++++++++--
+ 10 files changed, 198 insertions(+), 8 deletions(-)
+diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp
+index e8392e0..af5c1c8 100644
+--- a/gfx/thebes/gfxFont.cpp
++++ b/gfx/thebes/gfxFont.cpp
+@@ -3045,6 +3045,7 @@ gfxFontGroup::FindPlatformFont(const nsAString& aName,
+ }
+
+ // Not known in the user font set ==> check system fonts
++ // XXX: Fallback is bad..
+ if (!foundFamily) {
+ fe = gfxPlatformFontList::PlatformFontList()->
+ FindFontForFamily(aName, fontStyle, needsBold);
+@@ -3260,6 +3261,7 @@ gfxFontGroup::ForEachFontInternal(const nsAString& aFamilies,
+ }
+ if (!foundFamily) {
+ gfxPlatform *pf = gfxPlatform::GetPlatform();
++ // XXX: Fallback is bad
+ rv = pf->ResolveFontName(family,
+ gfxFontGroup::FontResolverProc,
+ &data, aborted);
diff --git a/gfx/thebes/gfxPangoFonts.cpp b/gfx/thebes/gfxPangoFonts.cpp
index c94a299..88c8b8e 100644
--- a/gfx/thebes/gfxPangoFonts.cpp
@@ -41,6 +66,83 @@ index c94a299..88c8b8e 100644
bool isUserFont = false;
if (mUserFontSet) {
// Have some @font-face definitions
+diff --git a/gfx/thebes/gfxUserFontSet.cpp b/gfx/thebes/gfxUserFontSet.cpp
+index 020c35a..161b52f 100644
+--- a/gfx/thebes/gfxUserFontSet.cpp
++++ b/gfx/thebes/gfxUserFontSet.cpp
+@@ -15,6 +15,7 @@
+ #include "prlong.h"
+ #include "nsNetUtil.h"
+ #include "nsIProtocolHandler.h"
++#include "nsFont.h"
+
+ #include "woff.h"
+
+@@ -517,18 +518,41 @@ gfxUserFontSet::LoadNext(gfxProxyFontEntry *aProxyEntry)
+ aProxyEntry->mSrcIndex++;
+ }
+
++ /* If there are any urls, prefer them to local */
++ bool listHasURL = false;
++ for (uint32_t i = aProxyEntry->mSrcIndex; i < numSrc; i++) {
++ const gfxFontFaceSrc& currSrc = aProxyEntry->mSrcList[i];
++ if (!currSrc.mIsLocal) {
++ listHasURL = true;
++ break;
++ }
++ }
++ nsPresContext *pres = GetPresContext();
++ /* If we have no pres context, simply fail this load */
++ if (!pres) listHasURL = true;
++
+ // load each src entry in turn, until a local face is found
+ // or a download begins successfully
+ while (aProxyEntry->mSrcIndex < numSrc) {
+ const gfxFontFaceSrc& currSrc = aProxyEntry->mSrcList[aProxyEntry->mSrcIndex];
+
+ // src local ==> lookup and load immediately
+-
+- if (currSrc.mIsLocal) {
++ if (!listHasURL && currSrc.mIsLocal) {
++ nsFont font;
++ font.name = currSrc.mLocalName;
+ gfxFontEntry *fe =
+ gfxPlatform::GetPlatform()->LookupLocalFont(aProxyEntry,
+ currSrc.mLocalName);
++ pres->AddFontAttempt(font);
++
++ /* No more fonts for you */
++ if (pres->FontAttemptCountReached(font) ||
++ pres->FontUseCountReached(font)) {
++ break;
++ }
++
+ if (fe) {
++ pres->AddFontUse(font);
+ LOG(("userfonts (%p) [src %d] loaded local: (%s) for (%s) gen: %8.8x\n",
+ this, aProxyEntry->mSrcIndex,
+ NS_ConvertUTF16toUTF8(currSrc.mLocalName).get(),
+diff --git a/gfx/thebes/gfxUserFontSet.h b/gfx/thebes/gfxUserFontSet.h
+index 1781a37..d6f7292 100644
+--- a/gfx/thebes/gfxUserFontSet.h
++++ b/gfx/thebes/gfxUserFontSet.h
+@@ -9,6 +9,7 @@
+ #include "gfxTypes.h"
+ #include "gfxFont.h"
+ #include "gfxFontUtils.h"
++#include "nsPresContext.h"
+ #include "nsRefPtrHashtable.h"
+ #include "nsAutoPtr.h"
+ #include "nsCOMPtr.h"
+@@ -230,6 +231,8 @@ public:
+
+ // increment the generation on font load
+ void IncrementGeneration();
++
++ virtual nsPresContext *GetPresContext() { return NULL; }
+
+ protected:
+ // for a given proxy font entry, attempt to load the next resource
diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp
index d47460a..8064fb4 100644
--- a/layout/base/nsPresContext.cpp
@@ -205,6 +307,35 @@ index 37a19c4..30fd021 100644
// the style parameters to the nsFont constructor are ignored,
// because it's only being used to call EnumerateFamilies
nsFont font(family, 0, 0, 0, 0, 0, 0);
+diff --git a/layout/style/nsFontFaceLoader.cpp b/layout/style/nsFontFaceLoader.cpp
+index 26c8a8d..2a803ae 100644
+--- a/layout/style/nsFontFaceLoader.cpp
++++ b/layout/style/nsFontFaceLoader.cpp
+@@ -86,9 +86,9 @@ nsFontFaceLoader::StartedLoading(nsIStreamLoader *aStreamLoader)
+ loadTimeout,
+ nsITimer::TYPE_ONE_SHOT);
+ }
+- } else {
++ } else if (loadTimeout == 0) {
+ mFontEntry->mLoadingState = gfxProxyFontEntry::LOADING_SLOWLY;
+- }
++ } // -1 disables fallback
+ mStreamLoader = aStreamLoader;
+ }
+
+diff --git a/layout/style/nsFontFaceLoader.h b/layout/style/nsFontFaceLoader.h
+index 9cd218d..0c7473d 100644
+--- a/layout/style/nsFontFaceLoader.h
++++ b/layout/style/nsFontFaceLoader.h
+@@ -48,7 +48,7 @@ public:
+
+ bool UpdateRules(const nsTArray<nsFontFaceRuleContainer>& aRules);
+
+- nsPresContext *GetPresContext() { return mPresContext; }
++ virtual nsPresContext *GetPresContext() { return mPresContext; }
+
+ virtual void ReplaceFontEntry(gfxProxyFontEntry *aProxy,
+ gfxFontEntry *aFontEntry);
diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp
index 64504fb..86eff1f 100644
--- a/layout/style/nsRuleNode.cpp
@@ -316,5 +447,5 @@ index 64504fb..86eff1f 100644
}
--
-1.7.5.4
+1.7.9.5
1
0
commit 7d1ade251bad76c82b3f1288097587e0fbd1c4ae
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Tue Mar 19 17:00:40 2013 -0400
Debugging log for bug 8185
If the bug recurs, log the filename and line number that triggered it
---
changes/bug8185_diagnostic | 3 +++
src/or/relay.c | 22 +++++++++++++++-------
src/or/relay.h | 10 ++++++++--
3 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/changes/bug8185_diagnostic b/changes/bug8185_diagnostic
new file mode 100644
index 0000000..b0f8884
--- /dev/null
+++ b/changes/bug8185_diagnostic
@@ -0,0 +1,3 @@
+ o Minor features:
+ - Improve debugging output to attempt to diagnose the underlying
+ cause of bug 8185.
diff --git a/src/or/relay.c b/src/or/relay.c
index 1da9932..c71fe2a 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -379,15 +379,22 @@ relay_crypt(circuit_t *circ, cell_t *cell, cell_direction_t cell_direction,
static int
circuit_package_relay_cell(cell_t *cell, circuit_t *circ,
cell_direction_t cell_direction,
- crypt_path_t *layer_hint, streamid_t on_stream)
+ crypt_path_t *layer_hint, streamid_t on_stream,
+ const char *filename, int lineno)
{
channel_t *chan; /* where to send the cell */
if (cell_direction == CELL_DIRECTION_OUT) {
crypt_path_t *thishop; /* counter for repeated crypts */
chan = circ->n_chan;
- if (!CIRCUIT_IS_ORIGIN(circ) || !chan) {
- log_warn(LD_BUG,"outgoing relay cell has n_chan==NULL. Dropping.");
+ if (!chan) {
+ log_warn(LD_BUG,"outgoing relay cell sent from %s:%d has n_chan==NULL."
+ " Dropping.", filename, lineno);
+ return 0; /* just drop it */
+ }
+ if (!CIRCUIT_IS_ORIGIN(circ)) {
+ log_warn(LD_BUG,"outgoing relay cell sent from %s:%d on non-origin "
+ "circ. Dropping.", filename, lineno);
return 0; /* just drop it */
}
@@ -548,9 +555,10 @@ relay_command_to_string(uint8_t command)
* return 0.
*/
int
-relay_send_command_from_edge(streamid_t stream_id, circuit_t *circ,
- uint8_t relay_command, const char *payload,
- size_t payload_len, crypt_path_t *cpath_layer)
+relay_send_command_from_edge_(streamid_t stream_id, circuit_t *circ,
+ uint8_t relay_command, const char *payload,
+ size_t payload_len, crypt_path_t *cpath_layer,
+ const char *filename, int lineno)
{
cell_t cell;
relay_header_t rh;
@@ -633,7 +641,7 @@ relay_send_command_from_edge(streamid_t stream_id, circuit_t *circ,
}
if (circuit_package_relay_cell(&cell, circ, cell_direction, cpath_layer,
- stream_id) < 0) {
+ stream_id, filename, lineno) < 0) {
log_warn(LD_BUG,"circuit_package_relay_cell failed. Closing.");
circuit_mark_for_close(circ, END_CIRC_REASON_INTERNAL);
return -1;
diff --git a/src/or/relay.h b/src/or/relay.h
index 7e59838..229fb4f 100644
--- a/src/or/relay.h
+++ b/src/or/relay.h
@@ -20,9 +20,15 @@ int circuit_receive_relay_cell(cell_t *cell, circuit_t *circ,
void relay_header_pack(uint8_t *dest, const relay_header_t *src);
void relay_header_unpack(relay_header_t *dest, const uint8_t *src);
-int relay_send_command_from_edge(streamid_t stream_id, circuit_t *circ,
+int relay_send_command_from_edge_(streamid_t stream_id, circuit_t *circ,
uint8_t relay_command, const char *payload,
- size_t payload_len, crypt_path_t *cpath_layer);
+ size_t payload_len, crypt_path_t *cpath_layer,
+ const char *filename, int lineno);
+#define relay_send_command_from_edge(stream_id, circ, relay_command, payload, \
+ payload_len, cpath_layer) \
+ relay_send_command_from_edge_((stream_id), (circ), (relay_command), \
+ (payload), (payload_len), (cpath_layer), \
+ __FILE__, __LINE__)
int connection_edge_send_command(edge_connection_t *fromconn,
uint8_t relay_command, const char *payload,
size_t payload_len);
1
0