[Pkg-privacy-commits] [flashproxy] 25/65: Imported Upstream version 1.6
Ximin Luo
infinity0 at moszumanska.debian.org
Fri Aug 21 13:49:42 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch _volatile-rc
in repository flashproxy.
commit b273399bec9f24cffa33eedf64a97b893e9488fc
Author: Ximin Luo <infinity0 at pwned.gg>
Date: Mon May 19 10:14:26 2014 +0100
Imported Upstream version 1.6
---
ChangeLog | 12 ++++++++
LICENSE | 2 +-
Makefile | 9 +++---
Makefile.client | 1 -
facilitator/Makefile.am | 2 +-
facilitator/configure.ac | 2 +-
facilitator/doc/appspot-howto.txt | 7 +++--
flashproxy-client | 46 ++++++++++++++++++++++--------
flashproxy-reg-appspot | 18 ++----------
flashproxy-reg-email | 18 ++----------
flashproxy/keys.py | 26 +++++++++++++----
flashproxy/test/test_keys.py | 17 ++++++-----
flashproxy/test/test_util.py | 59 ++++++++++++++++++++++++++++++++++++++-
flashproxy/util.py | 12 ++++++--
mkman.sh | 20 ++++++++-----
proxy/flashproxy-test.js | 23 +++++++--------
proxy/modules/nodejs/Makefile | 5 ++--
setup-common.py | 5 +++-
torrc | 2 --
version.sh | 5 +++-
20 files changed, 191 insertions(+), 100 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2fcc7b5..5c8e54d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Changes in version 1.6
+ o Allowed the --port-forwarding option to work when the remote port
+ number is given as 0.
+
+ o Fixed registration on Mac OS X when the REMOTE address had an empty
+ host part. A specification of ":9000", for example, would try to
+ register "[]:9000".
+
+ o Fixed registration on Windows with flashproxy-reg-appspot and
+ flashproxy-reg-email. The certificate pinning code used a Python
+ NamedTemporaryFile, which is not reopenable on Windows.
+
Changes in version 1.5
o Add manpages for the facilitator and nodejs proxy, automatically
generated by help2man.
diff --git a/LICENSE b/LICENSE
index 865b15d..986dda9 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
This is the license of the flash proxy software.
-Copyright 2012 David Fifield
+Copyright 2011-2013 David Fifield
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/Makefile b/Makefile
index bfe36be..922f140 100644
--- a/Makefile
+++ b/Makefile
@@ -10,9 +10,9 @@
# - common: setup-common.py
# - facilitator: facilitator/{configure.ac,Makefile.am}
#
-# Not for the faint-hearted: it is possible to build dist-exe on GNU/Linux by
-# using wine to install the windows versions of Python, py2exe, and m2crypto,
-# then running `make PYTHON_W32="wine python" dist-exe`.
+# It is possible to build dist-exe on GNU/Linux by using wine to install
+# the windows versions of Python, py2exe, and m2crypto, then running
+# `make PYTHON="wine python" dist-exe`.
PACKAGE = flashproxy-client
VERSION = $(shell sh version.sh)
@@ -20,7 +20,6 @@ DISTNAME = $(PACKAGE)-$(VERSION)
THISFILE = $(lastword $(MAKEFILE_LIST))
PYTHON = python
-PYTHON_W32 = $(PYTHON)
MAKE_CLIENT = $(MAKE) -f Makefile.client PYTHON="$(PYTHON)"
# don't rebuild man pages due to VCS giving spurious timestamps, see #9940
@@ -55,7 +54,7 @@ sign: force-dist $(DISTDIR).zip.asc
PY2EXE_TMPDIR = py2exe-tmp
export PY2EXE_TMPDIR
$(PY2EXE_TMPDIR): setup-client-exe.py
- $(PYTHON_W32) setup-client-exe.py py2exe -q
+ $(PYTHON) setup-client-exe.py py2exe -q
DISTDIR_W32 = $(DISTDIR)-win32
# below, we override DST_SCRIPT and DST_MAN1 for windows
diff --git a/Makefile.client b/Makefile.client
index efdef7c..3d25848 100644
--- a/Makefile.client
+++ b/Makefile.client
@@ -46,7 +46,6 @@ DST_DOC = $(SRC_DOC)
DST_ALL = $(DST_SCRIPT) $(DST_DOC) $(DST_MAN1)
TEST_PY = flashproxy-client-test.py
-TEST_ALL = $(TEST_PY)
REBUILD_MAN = 1
diff --git a/facilitator/Makefile.am b/facilitator/Makefile.am
index 935a197..268fec4 100644
--- a/facilitator/Makefile.am
+++ b/facilitator/Makefile.am
@@ -7,7 +7,7 @@ cgibindir = @cgibindir@
# unfortunately sysvinit does not support having initscripts in /usr/local/etc
# yet, so we have to hard code a path here. :(
initscriptdir = /etc/init.d
-exampledir = $(docdir)/examples
+exampledir = $(pkgdatadir)/examples
appenginedir = $(pkgdatadir)/appengine
pkgconfdir = $(sysconfdir)/flashproxy
appengineconfdir = $(pkgconfdir)/reg-appspot
diff --git a/facilitator/configure.ac b/facilitator/configure.ac
index cc41b8b..32fbc1f 100644
--- a/facilitator/configure.ac
+++ b/facilitator/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ([2.68])
-AC_INIT([flashproxy-facilitator], [1.4])
+AC_INIT([flashproxy-facilitator], [1.5])
AM_INIT_AUTOMAKE([-Wall foreign])
AC_ARG_VAR(fpfacilitatoruser, [the user/group for the facilitator to run as])
diff --git a/facilitator/doc/appspot-howto.txt b/facilitator/doc/appspot-howto.txt
index 8ed1284..458f1c0 100644
--- a/facilitator/doc/appspot-howto.txt
+++ b/facilitator/doc/appspot-howto.txt
@@ -13,7 +13,8 @@ this purpose, rather than a personal or organisation account. See
email-howto.txt for how to do that.
Download the SDK:
-https://developers.google.com/appengine/docs/go/gettingstarted/devenvironment
+https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Go
+This guide was written for version 1.8.9 of the SDK.
Find your facilitator appengine installation, probably in reg-appspot/
in your flashproxy config dir. Edit config.go to point to the address of
@@ -24,14 +25,14 @@ https://developers.google.com/appengine/docs/go/gettingstarted/uploading
Enter an application ID and create the application.
To run locally using the development server:
-$ ~/go_appengine/dev_appserver.py reg-appspot/
+$ ~/go_appengine/goapp serve reg-appspot/
You are advised to do this on a non-production machine, away from the main
facilitator.
Use the appcfg.py program to upload the program. It should look
something like this:
-$ torify ./google_appengine/appcfg.py --no_cookies -A <YOUR_APP_ID> update reg-appspot/
+$ torify ./go_appengine/goapp --no_cookies -A <YOUR_APP_ID> update reg-appspot/
07:25 PM Host: appengine.google.com
07:25 PM Application: application-id; version: 1
07:25 PM
diff --git a/flashproxy-client b/flashproxy-client
index ee0b068..09630b3 100755
--- a/flashproxy-client
+++ b/flashproxy-client
@@ -19,7 +19,7 @@ import threading
import time
import traceback
-from flashproxy.util import parse_addr_spec, format_addr
+from flashproxy.util import parse_addr_spec, addr_family, format_addr
from hashlib import sha1
@@ -678,6 +678,27 @@ def forward_ports(pairs):
return False
return True
+def forward_listeners(listeners):
+ """Attempt to forward the ports belonging to the given listening sockets.
+ Non-IPv4 addresses are ignored. If options.port_forwarding_external is not
+ None, only the first IPv4 address in the list will be forwarded."""
+ forward_list = []
+ for listener in remote_listen:
+ host, port = socket.getnameinfo(listener.getsockname(), socket.NI_NUMERICHOST | socket.NI_NUMERICSERV)
+ port = int(port)
+ af = addr_family(host)
+ if af != socket.AF_INET:
+ # I guess tor-fw-helper can only handle IPv4.
+ log(u"Not forwarding to %s because it is not an IPv4 address." % format_addr((host, port)))
+ continue
+ if options.port_forwarding_external is not None:
+ forward_list.append((options.port_forwarding_external, port))
+ # A fixed external address means we can forward only one port.
+ break
+ else:
+ forward_list.append((port, port))
+ forward_ports(forward_list)
+
register_condvar = threading.Condition()
# register_flag true means registration_thread_func should register at its next
# opportunity.
@@ -1092,7 +1113,7 @@ def main():
elif o == "-r" or o == "--register":
options.register = True
elif o == "--register-addr":
- if options.register_addr is not None:
+ if register_addr_spec is not None:
print >> sys.stderr, "%s: only one --register-addr is allowed." % sys.argv[0]
sys.exit(1)
options.register = True
@@ -1158,22 +1179,12 @@ def main():
options.remote_addrs.append(("0.0.0.0", remote_addr[1]))
if socket.has_ipv6:
options.remote_addrs.append(("::", remote_addr[1]))
- options.register_addr = parse_addr_spec(register_addr_spec or ":", *remote_addr)
if not register_methods:
register_methods = DEFAULT_REGISTER_METHODS
for method in register_methods:
options.register_commands.append(build_register_command(method))
- # Attempt to forward ports if requested.
- if options.port_forwarding:
- internal = remote_addr[1]
- if options.port_forwarding_external is not None:
- external = options.port_forwarding_external
- else:
- external = internal
- forward_ports(((external, internal),))
-
# Remote sockets, accepting remote WebSocket connections from proxies.
remote_listen = []
for addr in options.remote_addrs:
@@ -1184,6 +1195,13 @@ def main():
continue
remote_listen.append(listen)
log(u"Listening remote on %s." % format_sockaddr(listen.getsockname()))
+ if options.register_addr is None:
+ host, port = socket.getnameinfo(listen.getsockname(), socket.NI_NUMERICHOST | socket.NI_NUMERICSERV)
+ port = int(port)
+ if not remote_addr[0]:
+ # Make host part blank (not 0.0.0.0) if unspecified.
+ host = ""
+ options.register_addr = parse_addr_spec(register_addr_spec or ":", host, port)
if not remote_listen:
log(u"Failed to open any remote listeners, quitting.")
pt_cmethoderror("Failed to open any remote listeners.")
@@ -1206,6 +1224,10 @@ def main():
if options.managed:
pt_cmethods_done()
+ # Attempt to forward ports if requested.
+ if options.port_forwarding:
+ forward_listeners(remote_listen)
+
# New remote sockets waiting to finish their WebSocket negotiation.
websocket_pending = []
# Remote connection sockets.
diff --git a/flashproxy-reg-appspot b/flashproxy-reg-appspot
index db2fdbd..134e9ff 100755
--- a/flashproxy-reg-appspot
+++ b/flashproxy-reg-appspot
@@ -1,7 +1,6 @@
#!/usr/bin/env python
"""Register with a facilitator through Google App Engine."""
-import errno
import getopt
import httplib
import os
@@ -71,19 +70,6 @@ def safe_str(s):
def safe_format_addr(addr):
return safe_str(format_addr(addr))
-def get_state_dir():
- """Get a directory where we can put temporary files. Returns None if any
- suitable temporary directory will do."""
- pt_dir = os.environ.get("TOR_PT_STATE_LOCATION")
- if pt_dir is None:
- return None
- try:
- os.makedirs(pt_dir)
- except OSError, e:
- if e.errno != errno.EEXIST:
- raise
- return pt_dir
-
def generate_url(addr):
if getattr(sys, "frozen", False):
script_dir = os.path.dirname(sys.executable)
@@ -136,8 +122,8 @@ class PinHTTPSConnection(httplib.HTTPSConnection):
ctx = SSL.Context("tlsv1")
ctx.set_verify(SSL.verify_peer, 3)
- with temp_cert(PIN_GOOGLE_CA_CERT) as ca_file:
- ret = ctx.load_verify_locations(ca_file.name)
+ with temp_cert(PIN_GOOGLE_CA_CERT) as ca_filename:
+ ret = ctx.load_verify_locations(ca_filename)
assert ret == 1
self.sock = SSL.Connection(ctx, sock)
diff --git a/flashproxy-reg-email b/flashproxy-reg-email
index 5d38fa5..6309cec 100755
--- a/flashproxy-reg-email
+++ b/flashproxy-reg-email
@@ -1,7 +1,6 @@
#!/usr/bin/env python
"""Register with a facilitator using the email method."""
-import errno
import getopt
import os
import re
@@ -96,19 +95,6 @@ def build_reg(addr, transport):
("client-transport", transport),
))
-def get_state_dir():
- """Get a directory where we can put temporary files. Returns None if any
- suitable temporary directory will do."""
- pt_dir = os.environ.get("TOR_PT_STATE_LOCATION")
- if pt_dir is None:
- return None
- try:
- os.makedirs(pt_dir)
- except OSError, e:
- if e.errno != errno.EEXIST:
- raise
- return pt_dir
-
def get_facilitator_pubkey():
if options.facilitator_pubkey_filename is not None:
return RSA.load_pub_key(options.facilitator_pubkey_filename)
@@ -185,7 +171,7 @@ try:
ctx = SSL.Context("tlsv1")
ctx.set_verify(SSL.verify_peer, 3)
- with temp_cert(PIN_GOOGLE_CA_CERT) as ca_file:
+ with temp_cert(PIN_GOOGLE_CA_CERT) as ca_filename:
# We roll our own initial EHLO/STARTTLS because smtplib.SMTP.starttls
# doesn't allow enough certificate validation.
code, msg = smtp.docmd("EHLO", EHLO_FQDN)
@@ -194,7 +180,7 @@ try:
code, msg = smtp.docmd("STARTTLS")
if code != 220:
raise ValueError("Got code %d after STARTTLS" % code)
- ret = ctx.load_verify_locations(ca_file.name)
+ ret = ctx.load_verify_locations(ca_filename)
assert ret == 1
smtp.sock = SSL.Connection(ctx, smtp.sock)
diff --git a/flashproxy/keys.py b/flashproxy/keys.py
index ff27448..08ffc46 100644
--- a/flashproxy/keys.py
+++ b/flashproxy/keys.py
@@ -1,3 +1,5 @@
+import errno
+import os
import tempfile
from hashlib import sha1
@@ -70,17 +72,29 @@ def check_certificate_pin(sock, cert_pubkey):
expected = "(" + ", ".join(x.encode("hex") for x in cert_pubkey) + ")"
raise ValueError("Public key does not match pin: got %s but expected any of %s" % (found, expected))
+def get_state_dir():
+ """Get a directory where we can put temporary files. Returns None if any
+ suitable temporary directory will do."""
+ pt_dir = os.environ.get("TOR_PT_STATE_LOCATION")
+ if pt_dir is None:
+ return None
+ try:
+ os.makedirs(pt_dir)
+ except OSError, e:
+ if e.errno != errno.EEXIST:
+ raise
+ return pt_dir
+
class temp_cert(object):
"""Implements a with-statement over raw certificate data."""
def __init__(self, certdata):
- self.fd = tempfile.NamedTemporaryFile(prefix="fp-cert-temp-", suffix=".crt", delete=True)
- self.fd.write(certdata)
- self.fd.flush()
- self.fd.seek(0)
+ fd, self.path = tempfile.mkstemp(prefix="fp-cert-temp-", dir=get_state_dir(), suffix=".crt")
+ os.write(fd, certdata)
+ os.close(fd)
def __enter__(self):
- return self.fd
+ return self.path
def __exit__(self, type, value, traceback):
- self.fd.close()
+ os.unlink(self.path)
diff --git a/flashproxy/test/test_keys.py b/flashproxy/test/test_keys.py
index 15c4449..0adff32 100644
--- a/flashproxy/test/test_keys.py
+++ b/flashproxy/test/test_keys.py
@@ -7,19 +7,18 @@ class TempCertTest(unittest.TestCase):
def test_temp_cert_success(self):
fn = None
- with temp_cert(PIN_GOOGLE_CA_CERT) as ca_file:
- fn = ca_file.name
- self.assertTrue(os.path.exists(fn))
- lines = ca_file.readlines()
- self.assertIn("-----BEGIN CERTIFICATE-----\n", lines)
- self.assertFalse(os.path.exists(fn))
+ with temp_cert(PIN_GOOGLE_CA_CERT) as ca_filename:
+ self.assertTrue(os.path.exists(ca_filename))
+ with open(ca_filename) as f:
+ lines = f.readlines()
+ self.assertIn("-----BEGIN CERTIFICATE-----\n", lines)
+ self.assertFalse(os.path.exists(ca_filename))
def test_temp_cert_raise(self):
fn = None
try:
- with temp_cert(PIN_GOOGLE_CA_CERT) as ca_file:
- fn = ca_file.name
+ with temp_cert(PIN_GOOGLE_CA_CERT) as ca_filename:
raise ValueError()
self.fail()
except ValueError:
- self.assertFalse(os.path.exists(fn))
+ self.assertFalse(os.path.exists(ca_filename))
diff --git a/flashproxy/test/test_util.py b/flashproxy/test/test_util.py
index 935dd1f..1debcfd 100644
--- a/flashproxy/test/test_util.py
+++ b/flashproxy/test/test_util.py
@@ -1,8 +1,9 @@
#!/usr/bin/env python
+import socket
import unittest
-from flashproxy.util import parse_addr_spec, canonical_ip
+from flashproxy.util import parse_addr_spec, canonical_ip, addr_family, format_addr
class ParseAddrSpecTest(unittest.TestCase):
def test_ipv4(self):
@@ -39,5 +40,61 @@ class ParseAddrSpecTest(unittest.TestCase):
"""Test that canonical_ip does not do DNS resolution by default."""
self.assertRaises(ValueError, canonical_ip, *parse_addr_spec("example.com:80"))
+class AddrFamilyTest(unittest.TestCase):
+ def test_ipv4(self):
+ self.assertEqual(addr_family("1.2.3.4"), socket.AF_INET)
+
+ def test_ipv6(self):
+ self.assertEqual(addr_family("1:2::3:4"), socket.AF_INET6)
+
+ def test_name(self):
+ self.assertRaises(socket.gaierror, addr_family, "localhost")
+
+class FormatAddrTest(unittest.TestCase):
+ def test_none_none(self):
+ self.assertRaises(ValueError, format_addr, (None, None))
+
+ def test_none_port(self):
+ self.assertEqual(format_addr((None, 1234)), ":1234")
+
+ def test_none_invalid(self):
+ self.assertRaises(ValueError, format_addr, (None, "string"))
+
+ def test_empty_none(self):
+ self.assertRaises(ValueError, format_addr, ("", None))
+
+ def test_empty_port(self):
+ self.assertEqual(format_addr(("", 1234)), ":1234")
+
+ def test_empty_invalid(self):
+ self.assertRaises(ValueError, format_addr, ("", "string"))
+
+ def test_ipv4_none(self):
+ self.assertEqual(format_addr(("1.2.3.4", None)), "1.2.3.4")
+
+ def test_ipv4_port(self):
+ self.assertEqual(format_addr(("1.2.3.4", 1234)), "1.2.3.4:1234")
+
+ def test_ipv4_invalid(self):
+ self.assertRaises(ValueError, format_addr, ("1.2.3.4", "string"))
+
+ def test_ipv6_none(self):
+ self.assertEqual(format_addr(("1:2::3:4", None)), "[1:2::3:4]")
+
+ def test_ipv6_port(self):
+ self.assertEqual(format_addr(("1:2::3:4", 1234)), "[1:2::3:4]:1234")
+
+ def test_ipv6_invalid(self):
+ self.assertRaises(ValueError, format_addr, ("1:2::3:4", "string"))
+
+ def test_name_none(self):
+ self.assertEqual(format_addr(("localhost", None)), "localhost")
+
+ def test_name_port(self):
+ self.assertEqual(format_addr(("localhost", 1234)), "localhost:1234")
+
+ def test_name_invalid(self):
+ self.assertRaises(ValueError, format_addr, ("localhost", "string"))
+
if __name__ == "__main__":
unittest.main()
diff --git a/flashproxy/util.py b/flashproxy/util.py
index a53bdad..13cb5a4 100644
--- a/flashproxy/util.py
+++ b/flashproxy/util.py
@@ -95,15 +95,20 @@ def canonical_ip(host, port, af=0):
except that the host param must already be an IP address."""
return resolve_to_ip(host, port, af, gai_flags=socket.AI_NUMERICHOST)
+def addr_family(ip):
+ """Return the address family of an IP address. Raises socket.gaierror if ip
+ is not a numeric IP."""
+ addrs = socket.getaddrinfo(ip, 0, 0, socket.SOCK_STREAM, socket.IPPROTO_TCP, socket.AI_NUMERICHOST)
+ return addrs[0][0]
+
def format_addr(addr):
host, port = addr
host_str = u""
port_str = u""
- if host is not None:
+ if not (host is None or host == ""):
# Numeric IPv6 address?
try:
- addrs = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM, socket.IPPROTO_TCP, socket.AI_NUMERICHOST)
- af = addrs[0][0]
+ af = addr_family(host)
except socket.gaierror, e:
af = 0
if af == socket.AF_INET6:
@@ -111,6 +116,7 @@ def format_addr(addr):
else:
host_str = u"%s" % host
if port is not None:
+ port = int(port)
if not (0 < port <= 65535):
raise ValueError("port must be between 1 and 65535 (is %d)" % port)
port_str = u":%d" % port
diff --git a/mkman.sh b/mkman.sh
index 1087e41..cd4ecff 100755
--- a/mkman.sh
+++ b/mkman.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Wrapper around help2man that takes input from stdin.
set -o errexit
@@ -24,16 +24,22 @@ EOF
# Fixes some help2man quirks, see `man man`
help2man_fixup() {
- sed -re '
-# restricted to usage synopsis section
-/^\.SH SYNOPSIS$/,/^\.SH \w+$/{
+ sed -e '
+# restricted to usage parameters
+/^\.SH SYNOPSIS$/,/^\.SH [A-Z][A-Z]*$/{/^[^.]/{
# change hypenated parameters to bold, "type exactly as shown"
s/\\fI\-/\\fB\-/g;
# change ALL-CAPS parameters to italic, "replace with appropriate argument"
- s/\b([A-Z]+)\b/\\fI\1\\fR/g;
-}'
+ s/\b\([A-Z][A-Z]*\)\b/\\fI\1\\fR/g;
+};}'
}
+if stat -c "%s" . >/dev/null 2>&1; then
+ size() { stat -c "%s" "$@"; }
+else
+ size() { stat -f "%z" "$@"; }
+fi
+
prog="$1"
ver="$2"
name="${3:-$(get_description "$1")}"
@@ -46,7 +52,7 @@ mkdir -p ".tmp.$$"
echo "$shebang"
cat
} > ".tmp.$$/$prog"
-test $(stat -c "%s" ".tmp.$$/$prog") -gt $((${#shebang} + 1)) || { echo >&2 "no input received; abort"; exit 1; }
+test $(size ".tmp.$$/$prog") -gt $((${#shebang} + 1)) || { echo >&2 "no input received; abort"; exit 1; }
chmod +x ".tmp.$$/$prog"
help2man ".tmp.$$/$prog" --help-option="-q" \
diff --git a/proxy/flashproxy-test.js b/proxy/flashproxy-test.js
index dabbb8b..e004ee8 100755
--- a/proxy/flashproxy-test.js
+++ b/proxy/flashproxy-test.js
@@ -1,10 +1,9 @@
-#!/usr/bin/env rhino
+#!/usr/bin/env node
-/* To run this test program, install the Rhino JavaScript interpreter
- (apt-get install rhino). */
+/* To run this test program, install nodejs (apt-get install nodejs). */
var VERBOSE = false;
-if ("-v" in arguments)
+if (process.argv.indexOf("-v") >= 0)
VERBOSE = true;
var num_tests = 0;
@@ -13,7 +12,9 @@ var num_failed = 0;
var window = {location: {search: "?"}};
var document = {cookie: ""};
-load("flashproxy.js");
+var fs = require("fs");
+var data = fs.readFileSync("./flashproxy.js", "utf-8");
+eval(data);
function objects_equal(a, b) {
if ((a === null) != (b === null))
@@ -39,8 +40,8 @@ var top = true;
function announce(test_name) {
if (VERBOSE) {
if (!top)
- print();
- print(test_name);
+ console.log();
+ console.log(test_name);
}
top = false;
}
@@ -48,13 +49,13 @@ function announce(test_name) {
function pass(test) {
num_tests++;
if (VERBOSE)
- print("PASS " + repr(test));
+ console.log("PASS " + repr(test));
}
function fail(test, expected, actual) {
num_tests++;
num_failed++;
- print("FAIL " + repr(test) + " expected: " + repr(expected) + " actual: " + repr(actual));
+ console.log("FAIL " + repr(test) + " expected: " + repr(expected) + " actual: " + repr(actual));
}
function test_build_url() {
@@ -354,6 +355,6 @@ test_lang_keys();
test_have_websocket_binary_frames();
if (num_failed == 0)
- quit(0);
+ process.exit(0);
else
- quit(1);
+ process.exit(1);
diff --git a/proxy/modules/nodejs/Makefile b/proxy/modules/nodejs/Makefile
index 4c93948..af8f019 100644
--- a/proxy/modules/nodejs/Makefile
+++ b/proxy/modules/nodejs/Makefile
@@ -2,7 +2,7 @@
topsrcdir = ../../..
ALL_DST = flashproxy.js flashproxy.1
-VERSION = $(shell sed -nre 's/^\s*"version"\s*:\s*"([^"]+)".*/\1/gp' package.json)
+VERSION = $(shell sed -ne 's/^[[:space:]]*"version"[[:space:]]*:[[:space:]]*"\([^"][^"]*\)".*/\1/gp' package.json)
all: $(ALL_DST)
@@ -11,8 +11,7 @@ flashproxy.js: $(topsrcdir)/proxy/flashproxy.js
cp -f $< $@
flashproxy.1: main.js flashproxy.js $(topsrcdir)/mkman.sh $(topsrcdir)/mkman.inc Makefile
- ./main.js --help \
- | sed -re 's,/\S+/nodejs ./main.js,flashproxy,g' \
+ ./main.js --help | sed -e 's,node ./main.js,flashproxy,g' \
| $(topsrcdir)/mkman.sh flashproxy "$(VERSION)" "The flashproxy standalone nodejs proxy" "$(VERSION)" > "$@"
clean:
diff --git a/setup-common.py b/setup-common.py
index bcfdb71..ffe7c33 100755
--- a/setup-common.py
+++ b/setup-common.py
@@ -25,7 +25,10 @@ import sys
from setuptools import setup, find_packages
-version = subprocess.check_output(["sh", "version.sh"]).strip()
+p = subprocess.Popen(["sh", "version.sh"], stdout=subprocess.PIPE)
+output, _ = p.communicate()
+assert p.poll() == 0
+version = output.strip()
setup(
name = "flashproxy-common",
diff --git a/torrc b/torrc
index 4a66162..b8a2439 100644
--- a/torrc
+++ b/torrc
@@ -5,8 +5,6 @@
UseBridges 1
# The address and port are ignored by the client transport plugin.
Bridge flashproxy 0.0.1.0:1
-LearnCircuitBuildTimeout 0
-CircuitBuildTimeout 60
# Change the second number here (9000) to the number of a port that can
# receive connections from the Internet (the port for which you
# configured port forwarding).
diff --git a/version.sh b/version.sh
index 87cf555..fa89f47 100755
--- a/version.sh
+++ b/version.sh
@@ -1,3 +1,6 @@
#!/bin/sh
# Read version from the ChangeLog to avoid repeating in multiple build scripts
-sed -nre 's/^Changes .* version (.+)$/\1/g;tx;b;:x p;q' ChangeLog
+sed -ne 's/^Changes .* version \(..*\)$/\1/g;tx
+b
+:x
+p;q' ChangeLog
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/flashproxy.git
More information about the Pkg-privacy-commits
mailing list