Comparing version 0.1.0 to 0.1.1
24
index.js
@@ -60,29 +60,29 @@ "use strict"; | ||
// Length | ||
result.writeIntBE(htcpLen, 0, 2); | ||
result.writeInt16BE(htcpLen, 0); | ||
// Major-minor version | ||
result.writeIntBE(0, 2, 2); | ||
result.writeInt16BE(0, 2); | ||
// Data length | ||
result.writeIntBE(htcpDataLen, 4, 2); | ||
result.writeInt16BE(htcpDataLen, 4); | ||
// Op code & response | ||
result.writeIntBE(4, 6, 1); | ||
result.writeInt8(4, 6); | ||
// Reserved & flags | ||
result.writeIntBE(0, 7, 1); | ||
result.writeInt8(0, 7); | ||
// Transaction Id - seq number of a a request | ||
result.writeIntBE(self.seqReqId++, 8, 4); | ||
result.writeInt32BE(self.seqReqId++, 8); | ||
// HTCP packet contents - CLR specifier | ||
// Reserved & reason | ||
result.writeIntBE(0, 12, 2); | ||
result.writeInt16BE(0, 12); | ||
// COUNTSTR method: length + method (HEAD & GET are equivalent) | ||
result.writeIntBE(4, 14, 2); | ||
result.writeInt16BE(4, 14); | ||
result.write('HEAD', 16, 4); | ||
// COUNTSTR uri: length + URI | ||
result.writeIntBE(urlByteLen, 20, 2); | ||
result.writeInt16BE(urlByteLen, 20); | ||
result.write(url, 22, urlByteLen); | ||
// COUNTSTR version: length + http version | ||
result.writeIntBE(8, 22 + urlByteLen, 2); | ||
result.writeInt16BE(8, 22 + urlByteLen); | ||
result.write('HTTP/1.0', 24 + urlByteLen, 8); | ||
// COUNTSTR headers: empty, use just as padding | ||
result.writeIntBE(0, 32 + urlByteLen, 2); | ||
result.writeIntBE(2, 14 + htcpSpecifierLen, 2); | ||
result.writeInt16BE(0, 32 + urlByteLen); | ||
result.writeInt16BE(2, 14 + htcpSpecifierLen); | ||
@@ -89,0 +89,0 @@ return result; |
{ | ||
"name": "htcp-purge", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Varnish caches purging method", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -55,2 +55,3 @@ "use strict"; | ||
it ('should send datagrams' ,function(done) { | ||
this.timeout(5000); | ||
var purger = new HTCPPurger({ | ||
@@ -71,2 +72,3 @@ routes: [ | ||
return purger.purge(['test.com']) | ||
.delay(100) | ||
.then(function() { | ||
@@ -82,3 +84,3 @@ server.close(); | ||
host: 'localhost', | ||
port: 12345 | ||
port: 12346 | ||
} | ||
@@ -98,3 +100,3 @@ ] | ||
}); | ||
server.bind(12345); | ||
server.bind(12346); | ||
@@ -101,0 +103,0 @@ return purger.purge(['test.com']) |
9525
227