Permalink
Browse files

Merge remote branch 'origin/master'

Conflicts:
	http_trace
	package.json
  • Loading branch information...
2 parents 1abc761 + 9f07199 commit 734b3b2c66e0b42d20cdae5d22c97efea9e2c737 @mranney committed Jan 31, 2011
Showing with 15 additions and 3 deletions.
  1. +14 −3 http_trace
  2. +1 −0 package.json
View
@@ -329,6 +329,15 @@ function start_drop_watcher() {
}, 1000);
}
+function binary_body_check(headers) {
+ var ct = headers["Content-Type"];
+ if (ct && (/^(image|video)/.test(ct))) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
function setup_listeners() {
var tcp_tracker = new pcap.TCP_tracker();
@@ -396,6 +405,7 @@ function setup_listeners() {
ANSI(ANSI(http.request.method, "bold") + " " + http.request.url, "yellow"));
format_headers(http.request.headers);
+ http.request.binary_body = binary_body_check(http.request.headers);
});
tcp_tracker.on('http request body', function (session, http, data) {
@@ -407,8 +417,8 @@ function setup_listeners() {
" #" + session.http_request_count + " HTTP " + http.request.http_version + " request body: " +
format_size(data.length));
- if (options.bodies) {
- // TODO - this is not at all what you want for gzipped or binary data
+ if (options.bodies && !http.request.binary_body) {
+ // TODO - this is not at all what you want for gzipped data
console.log(ANSI(data.toString("utf8"), "green"));
}
});
@@ -435,6 +445,7 @@ function setup_listeners() {
ANSI(http.response.status_code + " " + node_http.STATUS_CODES[http.response.status_code], "yellow"));
format_headers(http.response.headers);
+ http.response.binary_body = binary_body_check(http.response.headers);
});
tcp_tracker.on('http response body', function (session, http, data) {
@@ -446,7 +457,7 @@ function setup_listeners() {
" #" + session.http_request_count + " HTTP " + http.response.http_version + " response body: " +
format_size(data.length));
- if (options.bodies) {
+ if (options.bodies && !http.response.binary_body) {
// TODO - this is not at all what you want for gzipped or binary data
console.log(ANSI(data.toString("utf8"), "green"));
}
View
@@ -1,5 +1,6 @@
{ "name" : "http_trace",
"version" : "0.3.0",
+ "version" : "0.2.5",
"description" : "Live HTTP and WebSocket packet capture and protocol decoding",
"author": "Matt Ranney <mjr@ranney.com>",
"main": "./http_trace",

0 comments on commit 734b3b2

Please sign in to comment.