summaryrefslogtreecommitdiffstats
path: root/gold
diff options
context:
space:
mode:
authorEUcancER <root@euer.krebsco.de>2011-08-25 18:43:50 +0200
committerEUcancER <root@euer.krebsco.de>2011-08-25 18:43:50 +0200
commit7499b82d0d8be67079c91e6d3b277dd65142c8ba (patch)
treec729ce62e9a12af2f399b60f284bef2d4dca1e81 /gold
parentb56137d875f43026aeabcc4403252e5e7008b93a (diff)
parent561f37e4a24061bd70113ebc7951175e0d3e116f (diff)
Merge branch 'master' of https://github.com/krebscode/painload
Diffstat (limited to 'gold')
-rw-r--r--gold/Makefile3
-rw-r--r--gold/btcguild/index.js20
-rwxr-xr-xgold/json/render/ticker7
-rw-r--r--gold/mining/CONFIGURE8
-rw-r--r--gold/mining/Makefile20
-rw-r--r--gold/mining/README9
-rw-r--r--gold/mining/TODO2
-rwxr-xr-xgold/mining/bin/archlinux-cruise-control70
-rwxr-xr-xgold/mining/bin/ati_temper5
-rwxr-xr-xgold/mining/bin/cleanup_tmp4
-rwxr-xr-xgold/mining/bin/ensure-router36
-rwxr-xr-xgold/mining/bin/ensure-wlan041
-rw-r--r--gold/mining/poll_btcguild2
-rw-r--r--gold/mining/user/.config/autostart/startup.desktop6
-rw-r--r--gold/mining/user/mining.ovdr16
-rwxr-xr-xgold/mining/user/startup.sh13
-rwxr-xr-xgold/mtgox/mtgox.getDepth3
-rwxr-xr-xgold/mtgox/mtgox.getTrades3
-rwxr-xr-xgold/mtgox/mtgox.ticker4
-rwxr-xr-xgold/mtgox/ticker_text.sh4
-rwxr-xr-xgold/scex/ticker2
-rwxr-xr-xgold/scex/ticker_text.sh4
-rw-r--r--gold/scex/tracer/index.js89
-rw-r--r--gold/scex/tracer/slurp.js38
24 files changed, 409 insertions, 0 deletions
diff --git a/gold/Makefile b/gold/Makefile
new file mode 100644
index 00000000..ff553def
--- /dev/null
+++ b/gold/Makefile
@@ -0,0 +1,3 @@
+install:
+ ln -snf $$PWD/mtgox/ticker_text.sh ../bin/mtgox_ticker
+ ln -snf $$PWD/scex/ticker_text.sh ../bin/scex_ticker
diff --git a/gold/btcguild/index.js b/gold/btcguild/index.js
new file mode 100644
index 00000000..1f33db06
--- /dev/null
+++ b/gold/btcguild/index.js
@@ -0,0 +1,20 @@
+api_key = process.env.api_key;
+
+var options = {
+ host: 'www.btcguild.com',
+ port: 80,
+ path: '/api.php?api_key=' + api_key
+};
+
+http = require('http');
+http.get(options, function(res) {
+ var data = '';
+ res.on('data', function (chunk) {
+ data += chunk;
+ });
+ res.on('end', function () {
+ console.log(JSON.parse(data));
+ });
+}).on('error', function(e) {
+ console.error('Error: ' + e.message);
+});
diff --git a/gold/json/render/ticker b/gold/json/render/ticker
new file mode 100755
index 00000000..727dd594
--- /dev/null
+++ b/gold/json/render/ticker
@@ -0,0 +1,7 @@
+#!/usr/bin/python
+
+import json,sys
+
+result = json.load(sys.stdin)
+
+print "High: " + str(result["ticker"]["high"]) + " Low: " + str(result["ticker"]["low"]) + " Last: " + str(result["ticker"]["last"])
diff --git a/gold/mining/CONFIGURE b/gold/mining/CONFIGURE
new file mode 100644
index 00000000..299cbd53
--- /dev/null
+++ b/gold/mining/CONFIGURE
@@ -0,0 +1,8 @@
+How to Configure
+===============
+
+1. change the mining-url in ~/startup.sh
+2. in KDE - 'AMDOverdriveCtrl - configure profile
+3. in KDE-Autostart - activate the startup script
+2. sudo /etc/init.d/gdm restart
+
diff --git a/gold/mining/Makefile b/gold/mining/Makefile
new file mode 100644
index 00000000..8701920f
--- /dev/null
+++ b/gold/mining/Makefile
@@ -0,0 +1,20 @@
+.PHONY: all format install configure
+select-target:
+ @echo "You are made of stupid!"
+ echo "look here"
+ @cat Makefile
+format:
+ cat README
+fix-linucCoin: configure
+ apt-get install --yes lm-sensors tmux
+ echo '#!/bin/bash' > /usr/bin/ati_license
+ echo '#!/bin/sh' > /etc/init.d/live-boot
+ echo 'wall "going down"' >> /etc/init.d/live-boot
+ chmod 755 /etc/init.d/live-boot
+ echo 'sudo tar xvf /opt/AMD-APP-SDK-v2.4-lnx64/icd-registration.tgz -C /' >> /usr/bin/ati_license
+ cp -r user /home
+configure:
+ yes '' | sensors-detect
+ @cat CONFIGURE
+archlinux:
+ bin/archlinux-cruise-control
diff --git a/gold/mining/README b/gold/mining/README
new file mode 100644
index 00000000..ad8c3468
--- /dev/null
+++ b/gold/mining/README
@@ -0,0 +1,9 @@
+What to do:
+format the usb-stick:
+Device Boot Start End Blocks Id System
+/dev/sda1 * 1 254 976345 c W95 FAT32 (LBA)
+/dev/sda2 255 1017 2932972 83 Linux
+
+1. install coinlinux live system on sda1.
+2. mkfs.ext3 /dev/sda2 -L live-rw
+3. install grub on /dev/sda
diff --git a/gold/mining/TODO b/gold/mining/TODO
new file mode 100644
index 00000000..bafaa72a
--- /dev/null
+++ b/gold/mining/TODO
@@ -0,0 +1,2 @@
+- fix the sed script in "make archlinux" to replace only the first occurrence
+- test the amdoverdrive stuff from the home dir (user)
diff --git a/gold/mining/bin/archlinux-cruise-control b/gold/mining/bin/archlinux-cruise-control
new file mode 100755
index 00000000..de5a0fa4
--- /dev/null
+++ b/gold/mining/bin/archlinux-cruise-control
@@ -0,0 +1,70 @@
+#!/bin/bash
+set -euf
+export EDITOR=vim
+echo "!! ARCHLINUX Cruise Control Mining installer !!"
+echo "** adding main network profile"
+cp /etc/network.d/examples/ethernet-dhcp /etc/network.d/main
+echo 'POST_UP="sed -i \"1i nameserver 8.8.8.8\" /etc/resolv.conf"' >> /etc/network.d/main
+echo "** adding worker account"
+grep -q worker /etc/passwd || adduser worker
+gpasswd -a worker wheel
+gpasswd -a worker tty
+gpasswd -a worker audio
+gpasswd -a worker video
+gpasswd -a worker network
+gpasswd -a worker power
+
+echo "** adding archlinuxfr to pacman.conf"
+grep -q archlinuxfr /etc/pacman.conf || echo "[archlinuxfr]" >> /etc/pacman.conf && echo "Server = http://repo.archlinux.fr/x86_64" >> /etc/pacman.conf
+echo "** installing all the required parts"
+pacman --needed --noconfirm -Syu rsync git openssh yajl sudo tmux lm_sensors vim yaourt kernel26-headers beep
+echo "** doing some tweaks"
+rm /usr/bin/python -f
+ln -s /usr/bin/python2 /usr/bin/python
+echo "syntax on" > /home/worker/.vimrc
+echo "syntax on" > /root/.vimrc
+echo "** installing tinc"
+[ "`yaourt -Q tinc`" ] || yaourt -S --noconfirm tinc
+sed -i -e 's/.*\%wheel.*/%wheel ALL=(ALL) NOPASSWD: ALL/1' /etc/sudoers
+echo "** Installing ATI drivers"
+[ "`yaourt -Q catalyst-utils`" ] || yaourt -S --noconfirm catalyst-utils
+[ "`yaourt -Q catalyst-hook`" ] || yaourt -S --noconfirm catalyst-hook
+[ "`yaourt -Q amdstream`" ] || yaourt -S --noconfirm amdstream
+echo "** installing X"
+pacman --needed -S --noconfirm xorg-server xorg-apps xorg-appres xorg-xinit xautolock xlockmore xorg-fonts xorg-xhost xorg-xauth xterm rxvt-unicode fluxbox slim
+echo "** editing slim configuration"
+sed -i 's/.*default_user.*/default_user worker/' /etc/slim.conf
+sed -i 's/.*auto_login.*/auto_login yes/' /etc/slim.conf
+echo "** Installing mining tools and overclocking stuff"
+[ "`yaourt -Q phoenix-miner-svn`" ] || yaourt -S --noconfirm phoenix-miner-svn
+echo "!! warning, you might need to adjust the version number of AMDOverdriveCTRL !!"
+[ "`yaourt -Q amdoverdrivectrl`" ] || yaourt -S amdoverdrivectrl
+echo "** copying bin folder"
+cp -r $(readlink -f `dirname $0`)/ /home/worker
+echo "** creating new .Xauthority for worker"
+sudo -u worker /home/worker/bin/newkey.sh
+mkdir -p /home/worker/.fluxbox
+cp /krebs/mining/user/startup.sh /home/worker/startup.sh
+chmod a+x /home/worker/startup.sh
+cp /krebs/mining/user/startup.sh /home/worker/.fluxbox/startup
+chmod a+x /home/worker/.fluxbox/startup
+cp /krebs/mining/user/mining.ovdr /home/worker/
+chown -R worker:users /home/worker
+echo "configuring X"
+echo "!! ACTION REQUIRED, write down the first number of your ATI Graphics Adapter."
+echo "!! i will open /etc/X11/xorg.conf for you, change the BusID of every Device to the numbers you see here"
+echo "!! press enter to continue"
+lspci|grep VGA
+read
+aticonfig --initial=dual-head
+vim /etc/X11/xorg.conf
+echo "** creating xinitrc and start x"
+echo 'setxkbmap -option terminate:ctrl_alt_bksp' > /home/worker/.xinitrc
+echo 'xautolock -corners +-+- -locker "xlock -mode blank"&' >> /home/worker/.xinitrc
+echo '/home/worker/startup.sh &' >> /home/worker/.xinitrc
+echo 'xterm &' >> /home/worker/.xinitrc
+echo 'exec fluxbox' >> /home/worker/.xinitrc
+echo '!! start x with `xinit `'
+echo 'add "x:5:respawn:/usr/bin/slim >/dev/null 2>&1" to /etc/inittab to start slim"
+
+
diff --git a/gold/mining/bin/ati_temper b/gold/mining/bin/ati_temper
new file mode 100755
index 00000000..283a6024
--- /dev/null
+++ b/gold/mining/bin/ati_temper
@@ -0,0 +1,5 @@
+#displays: CARD1TEMP CARD2TEMP CPUTEMP OUTSIDE
+echo -n "`DISPLAY=:0 aticonfig --adapter=1 --od-gettemperature | grep Temperature | sed -n 's/.*Temperature - \([0-9.]*\) C/\1/;p'` "
+echo -n "`DISPLAY=:0 aticonfig --adapter=2 --od-gettemperature | grep Temperature | sed -n 's/.*Temperature - \([0-9.]*\) C/\1/;p'` "
+echo -n "`sensors | grep temp1 | sed -e 's/temp1: *+\([0-9.]*\).*/\1/'` "
+echo "`temper`"
diff --git a/gold/mining/bin/cleanup_tmp b/gold/mining/bin/cleanup_tmp
new file mode 100755
index 00000000..e1395b19
--- /dev/null
+++ b/gold/mining/bin/cleanup_tmp
@@ -0,0 +1,4 @@
+#! /bin/sh
+ls -lAtr /tmp/ | sed -rn '
+ /\.so$/{$!{s/.* ([A-Za-z0-9]+\.so)$/rm -v \/tmp\/\1/p}}
+' | sudo sh
diff --git a/gold/mining/bin/ensure-router b/gold/mining/bin/ensure-router
new file mode 100755
index 00000000..5eedabc9
--- /dev/null
+++ b/gold/mining/bin/ensure-router
@@ -0,0 +1,36 @@
+#! /bin/sh
+
+if test "${nosudo-false}" != true -a `id -u` != 0; then
+ echo "we're going sudo..." >&2
+ exec sudo "$0" "$@"
+ exit 23 # go to hell
+fi
+
+if=eth2
+
+rc() {
+ for x in /etc/init.d/$1 /etc/rc.d/$1; do
+ if test -x $x; then
+ $x restart
+ break
+ fi
+ done
+}
+
+if ! ifconfig $if | grep -q 'inet addr'; then
+ beep -l 50 -f 2500; ifconfig $if 0.0.0.0 down || :
+ beep -l 50 -f 2500; ifconfig $if 23.0.0.1/8 up || :
+ beep -l 50 -f 2500; rc dnsmasq restart
+ beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
+ beep -l 50 -f 2500; iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
+ if ifconfig $if | grep -q 'inet addr'; then
+ beep -l 50 -f 2500 -n -l 100 -f 3000
+ else
+ beep -l 50 -f 2500 -n -l 100 -f 1000
+ fi
+else
+ case "${1-}" in
+ (--quiet) : ;;
+ (*) beep -l 50 -f 2500 -n -l 100 -f 2500 ;;
+ esac
+fi
diff --git a/gold/mining/bin/ensure-wlan0 b/gold/mining/bin/ensure-wlan0
new file mode 100755
index 00000000..fa92c4f5
--- /dev/null
+++ b/gold/mining/bin/ensure-wlan0
@@ -0,0 +1,41 @@
+#! /bin/sh
+
+if test "${nosudo-false}" != true -a `id -u` != 0; then
+ echo "we're going sudo..." >&2
+ exec sudo -E "$0" "$@"
+ exit 23 # go to hell
+fi
+
+has_internet() {
+ curl -sS google.com >/dev/null
+}
+
+if test "${force-false}" = true || ! has_internet; then
+
+ ## get rid of the fuckers
+ for fucker in NetworkManager nm-applet; do
+ pkill -9 $fucker
+ (IFS=:; for dir in $PATH; do rm -vf $dir/$fucker; done)
+ done
+
+ beep -l 50 -f 2000; pkill wpa
+ beep -l 50 -f 2000; rm -vf /var/run/wpa_supplicant/*
+ beep -l 50 -f 2000; wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf &
+ while ! wpa_cli status | grep -q wpa_state=COMPLETED; do
+ beep -l 50 -f 2000 -D 50 -n -l 50 -f 2000
+ sleep 1
+ done
+ beep -l 50 -f 2000; dhcpcd -x wlan0
+ beep -l 50 -f 2000; dhcpcd wlan0
+ #echo nameserver 8.8.8.8 >/etc/resolv.conf
+ if has_internet; then
+ beep -l 50 -f 2000 -n -l 100 -f 3000
+ else
+ beep -l 50 -f 2000 -n -l 100 -f 1000
+ fi
+else
+ case "${1-}" in
+ (--quiet) : ;;
+ (*) beep -l 50 -f 2000 -n -l 100 -f 2000 ;;
+ esac
+fi
diff --git a/gold/mining/poll_btcguild b/gold/mining/poll_btcguild
new file mode 100644
index 00000000..92a02657
--- /dev/null
+++ b/gold/mining/poll_btcguild
@@ -0,0 +1,2 @@
+API_KEY=
+curl http://www.btcguild.com/api.php\?api_key\=${API_KEY} | python -mjson.tool
diff --git a/gold/mining/user/.config/autostart/startup.desktop b/gold/mining/user/.config/autostart/startup.desktop
new file mode 100644
index 00000000..67c35ef8
--- /dev/null
+++ b/gold/mining/user/.config/autostart/startup.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=LXDE Autostart
+Exec=/home/user/startup.sh
+Terminal=true
+Type=Application
+Categories=Configuration
diff --git a/gold/mining/user/mining.ovdr b/gold/mining/user/mining.ovdr
new file mode 100644
index 00000000..d6cf6fec
--- /dev/null
+++ b/gold/mining/user/mining.ovdr
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<OVERDRIVE_PROFILE>
+ <PERFORMANCE_LEVEL level="2" gpu="90000" mem="30000" voltage="1040"/>
+ <PERFORMANCE_LEVEL level="1" gpu="55000" mem="30000" voltage="1000"/>
+ <PERFORMANCE_LEVEL level="0" gpu="15700" mem="30000" voltage="950"/>
+ <FAN_SETTING percentage="AUTO"/>
+ <FAN_CTRL enabled="yes"/>
+ <FAN_CTRL_CURVE type="0"/>
+ <FAN_CTRL_POINT nr="0" temperature="2000" percentage="0"/>
+ <FAN_CTRL_POINT nr="1" temperature="3400" percentage="9300"/>
+ <FAN_CTRL_POINT nr="2" temperature="4800" percentage="10000"/>
+ <FAN_CTRL_POINT nr="3" temperature="7000" percentage="10100"/>
+ <FAN_CTRL_POINT nr="4" temperature="10000" percentage="10100"/>
+ <MONITOR_SAMPLE_TIME interval="10"/>
+ <COLOR_PROFILE enabled="no" longitude="-13.000000" latitude="52.000000" color_temp_day="0" color_temp_night="0" transition="30"/>
+</OVERDRIVE_PROFILE>
diff --git a/gold/mining/user/startup.sh b/gold/mining/user/startup.sh
new file mode 100755
index 00000000..6274a892
--- /dev/null
+++ b/gold/mining/user/startup.sh
@@ -0,0 +1,13 @@
+sudo pkill tmux
+sleep 5
+source ~/.profile
+export DISPLAY=:0
+export URL="${URL-http://txgen_chinaman:lolwut@uk.btcguild.com:8332}"
+#export URL="http://txgen:qJrXefWX@bitcoinpool.com:8334"
+tmux start-server
+tmux new-session -d -s mining -n mining
+tmux new-window -t mining:1 'cd ~;AMDOverdriveCtrl -i 0 mining.ovdr'
+tmux new-window -t mining:2 'cd ~;AMDOverdriveCtrl -i 3 mining.ovdr'
+sleep 5
+tmux new-window -t mining:3 "cd /usr/src/phoenix-miner/; while sleep 1; do sudo ./phoenix.py -u $URL -k phatk DEVICE=0 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=12 FASTLOOPS=false;done"
+tmux new-window -t mining:4 "cd /usr/src/phoenix-miner/; while sleep 1; do sudo ./phoenix.py -u $URL -k phatk DEVICE=1 VECTORS BFI_INT WORKSIZE=256 AGGRESSION=12 FASTLOOPS=false;done"
diff --git a/gold/mtgox/mtgox.getDepth b/gold/mtgox/mtgox.getDepth
new file mode 100755
index 00000000..9a607979
--- /dev/null
+++ b/gold/mtgox/mtgox.getDepth
@@ -0,0 +1,3 @@
+#! /bin/sh
+# get mtgox market depth
+$ curl -ksS https://mtgox.com/code/data/getDepth.php
diff --git a/gold/mtgox/mtgox.getTrades b/gold/mtgox/mtgox.getTrades
new file mode 100755
index 00000000..73e5a68d
--- /dev/null
+++ b/gold/mtgox/mtgox.getTrades
@@ -0,0 +1,3 @@
+#! /bin/sh
+# get mtgox last trades
+$ curl -ksS https://mtgox.com/code/data/getTrades.phl
diff --git a/gold/mtgox/mtgox.ticker b/gold/mtgox/mtgox.ticker
new file mode 100755
index 00000000..b24dfb35
--- /dev/null
+++ b/gold/mtgox/mtgox.ticker
@@ -0,0 +1,4 @@
+#! /bin/sh
+# get mtgox ticker data
+set -euf
+curl -ksS https://mtgox.com/code/data/ticker.php
diff --git a/gold/mtgox/ticker_text.sh b/gold/mtgox/ticker_text.sh
new file mode 100755
index 00000000..f585ffea
--- /dev/null
+++ b/gold/mtgox/ticker_text.sh
@@ -0,0 +1,4 @@
+#! /bin/sh
+set -euf
+cd $(dirname `readlink -f $0`)
+./mtgox.ticker | ../json/render/ticker
diff --git a/gold/scex/ticker b/gold/scex/ticker
new file mode 100755
index 00000000..a95d5910
--- /dev/null
+++ b/gold/scex/ticker
@@ -0,0 +1,2 @@
+#! /bin/sh
+exec curl -ksS http://scexchange.bitparking.com:8080/api/ticker
diff --git a/gold/scex/ticker_text.sh b/gold/scex/ticker_text.sh
new file mode 100755
index 00000000..fbaff55b
--- /dev/null
+++ b/gold/scex/ticker_text.sh
@@ -0,0 +1,4 @@
+#! /bin/sh
+set -euf
+cd $(dirname `readlink -f $0`)
+./ticker | ../json/render/ticker
diff --git a/gold/scex/tracer/index.js b/gold/scex/tracer/index.js
new file mode 100644
index 00000000..7ee6de1b
--- /dev/null
+++ b/gold/scex/tracer/index.js
@@ -0,0 +1,89 @@
+#! /usr/bin/env node
+//
+// usage: [idle_mark=N] tracer
+//
+// Where the optional idle_mark tells the tracer to output idle marks every N
+// seconds.
+//
+var http = require('http');
+var slurp = require('./slurp');
+
+var options = {
+ host: 'scexchange.bitparking.com',
+ port: 8080,
+ path: '/api/t2'
+};
+
+var interval = 1000;
+var idle_mark = Number(process.env.idle_mark) * interval;
+
+var last_id = 0;
+var last_price = 0;
+var last_output = new Date(0);
+function t2 () {
+ var now = new Date()
+ http.get(options, function(res) {
+ slurp(res, function (data) {
+ try {
+ data = JSON.parse(data);
+ } catch (exn) {
+ return console.error('' + exn.stack + '');
+ };
+ data = data.sort(function (a, b) {
+ return a.id - b.id;
+ }).filter(function (x) {
+ return x.id > last_id;
+ });
+ if (data.length > 0) {
+ data.forEach(function (x) {
+ last_id = x.id;
+
+ x.date = new Date(Number(x.date) * 1000);
+
+ var price = render_price(x.price, last_price);
+ last_price = x.price;
+
+ var c = ({ buy: '', sell: '' })[x.type];
+ var m = '';
+ m += x.id
+ m += ' ' + JSON.parse(JSON.stringify(x.date))
+ m += ' ' + price
+ m += ' ' + c + x.amount + ''
+ console.log(m);
+ last_output = now;
+ });
+ } else {
+ if (idle_mark) {
+ if (now - last_output >= idle_mark) {
+ var price = render_price(last_price);
+ var m = last_id
+ m += ' ' + JSON.parse(JSON.stringify(now));
+ m += ' ' + price
+ console.log(m);
+ last_output = now;
+ };
+ };
+ };
+ });
+ }).on('error', function(e) {
+ console.log("Got error: " + e.message);
+ });
+};
+
+function render_price(price, last_price) {
+ var rendered_price = price.toString();
+ while (rendered_price.length < 'x.xxxxxxxx'.length) {
+ rendered_price += 0;
+ };
+ if (last_price) {
+ if (price > last_price) {
+ rendered_price = '' + rendered_price + ''
+ };
+ if (price < last_price) {
+ rendered_price = '' + rendered_price + ''
+ };
+ };
+ return rendered_price;
+};
+
+setInterval(t2, interval);
diff --git a/gold/scex/tracer/slurp.js b/gold/scex/tracer/slurp.js
new file mode 100644
index 00000000..70319743
--- /dev/null
+++ b/gold/scex/tracer/slurp.js
@@ -0,0 +1,38 @@
+module.exports = (function () {
+
+ function join_buffers (buffers, length) {
+ var buffer = new Buffer(length);
+ var targetStart = 0;
+ buffers.forEach(function (x) {
+ x.copy(buffer, targetStart);
+ targetStart += x.length;
+ });
+ return buffer;
+ };
+
+ function finish_it (req, buffers, length, callback) {
+ req.content = join_buffers(buffers, length);
+ return callback(req.content);
+ };
+
+ function nop () {};
+
+ return function (req, callback) {
+ if (req.hasOwnProperty('content')) {
+ return callback(req.content);
+ };
+ var content = [];
+ var length = 0;
+ var end_handler = finish_it;
+ req.on('data', function (data) {
+ content.push(data);
+ length += data.length;
+ });
+ [ 'end', 'close' ].forEach(function (event) {
+ req.on(event, function () {
+ finish_it(req, content, length, callback);
+ end_handler = nop;
+ });
+ });
+ };
+})();