Skip to content

Instantly share code, notes, and snippets.

@inimino
Created April 24, 2010 02:55
Show Gist options
  • Select an option

  • Save inimino/377412 to your computer and use it in GitHub Desktop.

Select an option

Save inimino/377412 to your computer and use it in GitHub Desktop.
testing with curl:
inimino@kat:~$ curl -sv -m3 http://boshi.inimino.org:8080/ >/dev/null
* About to connect() to boshi.inimino.org port 8080 (#0)
* Trying 69.164.198.129... connected
* Connected to boshi.inimino.org (69.164.198.129) port 8080 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8m zlib/1.2.3.4 libidn/1.18 libssh2/1.2.1
> Host: boshi.inimino.org:8080
> Accept: */*
>
< HTTP/1.1 200 OK
< content-type: text/plain
< content-length: 66560
< Connection: keep-alive
<
{ [data not shown]
* Operation timed out after 3000 milliseconds with 64664 out of 66560 bytes received
* Closing connection #0
var http=require('http')
, data=chunks()
, len=data.join('').length
http.createServer(function(req,resp){
resp.writeHead(200,{'content-type':'text/plain','content-length':len})
for(var i=0;i<data.length;i++) resp.write(data[i],'binary')
resp.end()})
.listen(8080)
function chunks(){var x=[],s
s=Array(1025).join('x') // 1024 'x's in a string
for(var i=0;i<65;i++) x[i]=s
return x}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment