~ubuntu-branches/ubuntu/precise/nodejs/precise

« back to all changes in this revision

Viewing changes to test/disabled/test-http-big-proxy-responses.js

  • Committer: Bazaar Package Importer
  • Author(s): Jérémy Lal
  • Date: 2010-08-20 11:49:04 UTC
  • mfrom: (7.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100820114904-lz22w6fkth7yh179
Tags: 0.2.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require('../common');
 
1
common = require("../common");
 
2
assert = common.assert
2
3
var sys = require("sys"),
3
4
fs = require("fs"),
4
5
http = require("http"),
12
13
  assert.ok(len > 0);
13
14
  res.writeHead(200, {"transfer-encoding":"chunked"});
14
15
  for (var i=0; i<len; i++) {
15
 
    if (i % 1000 == 0) print(',');
 
16
    if (i % 1000 == 0) common.print(',');
16
17
    res.write(chunk);
17
18
  }
18
19
  res.end();
30
31
 
31
32
 
32
33
  c.addListener('error', function (e) {
33
 
    puts('proxy client error. sent ' + sent);
 
34
    console.log('proxy client error. sent ' + sent);
34
35
    throw e;
35
36
  });
36
37
 
41
42
    var count = 0;
42
43
 
43
44
    proxy_res.addListener('data', function(d) {
44
 
      if (count++ % 1000 == 0) print('.');
 
45
      if (count++ % 1000 == 0) common.print('.');
45
46
      res.write(d);
46
47
      sent += d.length;
47
48
      assert.ok(sent <= (len*chunk.length));
63
64
  if (list.length > 0) {
64
65
    var len = list.shift();
65
66
 
66
 
    sys.debug("calling chargen for " + len + " chunks.");
 
67
    common.debug("calling chargen for " + len + " chunks.");
67
68
 
68
69
    var recved = 0;
69
70
 
78
79
 
79
80
      res.addListener('end', function() {
80
81
        assert.ok(recved <= (len*chunk.length));
81
 
        sys.debug("end for " + len + " chunks.");
 
82
        common.debug("end for " + len + " chunks.");
82
83
        call_chargen(list);
83
84
      });
84
85
 
86
87
    req.end();
87
88
 
88
89
  } else {
89
 
    sys.puts("End of list. closing servers");
 
90
    console.log("End of list. closing servers");
90
91
    proxy.close();
91
92
    chargen.close();
92
93
    done = true;