Skip to content

Commit

Permalink
delete agent from the request, if we are going to serialise it.
Browse files Browse the repository at this point in the history
  • Loading branch information
squaremo committed Jun 28, 2012
1 parent 0c36ec5 commit c08ba39
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/scheduler.js
Expand Up @@ -94,7 +94,14 @@ exports.TimerScheduler = TimerScheduler;
}
}
delete state.nextRequest;

// Using a request object may mutate it; and in particular, may
// mutate it into a cyclical structure. As a hack, we make sure
// it doesn't have the bit that could be circular. Better might
// be to create a fresh request.

var req = PROTOCOLS[request.protocol].get(request, function(res) {
delete request.agent;
var status = res.statusCode;

// be optimistic
Expand All @@ -117,6 +124,7 @@ exports.TimerScheduler = TimerScheduler;
state.request.headers = state.request.headers || {};
state.lastModified = res.headers['last-modified'];
}

ok(state);
// %%%FIXME Perhaps not most efficient. Benchmark? Also,
// do I really want to assume utf8, or just forward
Expand Down

0 comments on commit c08ba39

Please sign in to comment.