Skip to content

Commit

Permalink
fix: Upgrade package dependencies
Browse files Browse the repository at this point in the history
* Fix the test for an unreachable host, so that it doesn't fail, if
  a local service runs listening on 0.0.0.0.
* Update source code formatting to the newest standard.
* Update licencing years.
  • Loading branch information
prantlf committed Mar 16, 2018
1 parent 11f61b8 commit 02a440c
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 212 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -15,7 +15,7 @@ before_script:
- npm prune
after_success:
- npm run coverage
- npm run semantic-release
- npm run travis-deploy-once "npm run semantic-release"
branches:
except:
- /^v\d+\.\d+\.\d+$/
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Ferdinand Prantl
Copyright (c) 2017-2018 Ferdinand Prantl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -139,6 +139,7 @@ In lieu of a formal styleguide, take care to maintain the existing coding style.

## Release History

* 2018-03-16 v1.1.1 Upgrade package dependencies
* 2017-11-11 v1.1.0 Support HTTP/2 requests
* 2017-11-06 v1.0.0 Make command-line options compatible with [curl]
* 2017-11-06 v0.5.0 Add support for the [curl] options "iIXdo"
Expand All @@ -152,7 +153,7 @@ In lieu of a formal styleguide, take care to maintain the existing coding style.

## License

Copyright (c) 2017 Ferdinand Prantl
Copyright (c) 2017-2018 Ferdinand Prantl

Licensed under the MIT license.

Expand Down
30 changes: 15 additions & 15 deletions bin/nettime
Expand Up @@ -14,21 +14,21 @@ function collect (value, result) {
}

commander.version(pkg.version)
.description(pkg.description)
.usage('[options] <URL>')
.option('-0, --http1.0', 'use HTTP 1.0')
.option('--http1.1', 'use HTTP 1.1 (default)')
.option('--http2', 'use HTTP 2')
.option('-d, --data <data>', 'data to be sent using the POST verb')
.option('-f, --format <format>', 'set output format: text, json')
.option('-H, --header <header>', 'send specific HTTP header', collect, [])
.option('-i, --include', 'include response headers in the output')
.option('-I, --head', 'use HEAD verb to get document info only')
.option('-k, --insecure', 'ignore certificate errors')
.option('-o, --output <file>', 'write the received data to a file')
.option('-t, --time-unit <unit>', 'set time unit: ms, s+ns')
.option('-u, --user <credentials>', 'credentials for Basic Authentication')
.option('-X, --request <verb>', 'specify HTTP verb to use for the request')
.description(pkg.description)
.usage('[options] <URL>')
.option('-0, --http1.0', 'use HTTP 1.0')
.option('--http1.1', 'use HTTP 1.1 (default)')
.option('--http2', 'use HTTP 2')
.option('-d, --data <data>', 'data to be sent using the POST verb')
.option('-f, --format <format>', 'set output format: text, json')
.option('-H, --header <header>', 'send specific HTTP header', collect, [])
.option('-i, --include', 'include response headers in the output')
.option('-I, --head', 'use HEAD verb to get document info only')
.option('-k, --insecure', 'ignore certificate errors')
.option('-o, --output <file>', 'write the received data to a file')
.option('-t, --time-unit <unit>', 'set time unit: ms, s+ns')
.option('-u, --user <credentials>', 'credentials for Basic Authentication')
.option('-X, --request <verb>', 'specify HTTP verb to use for the request')

commander.on('--help', function () {
console.log()
Expand Down
48 changes: 24 additions & 24 deletions lib/nettime.js
Expand Up @@ -66,33 +66,33 @@ function nettime (options) {
socket.on('lookup', () => {
timings.dnsLookup = getTiming()
})
.on('connect', () => {
timings.tcpConnection = getTiming()
})
.on('secureConnect', () => {
timings.tlsHandshake = getTiming()
})
.on('close', () => {
timings.socketClose = getTiming()
if (outputFile && data) {
writeOutputFile().then(returnResult)
} else {
returnResult()
}
})
.on('connect', () => {
timings.tcpConnection = getTiming()
})
.on('secureConnect', () => {
timings.tlsHandshake = getTiming()
})
.on('close', () => {
timings.socketClose = getTiming()
if (outputFile && data) {
writeOutputFile().then(returnResult)
} else {
returnResult()
}
})
}

function listenToResponse (response) {
response.on('readable', checkFirstByte)
.on('data', chunk => {
checkFirstByte()
if (data) {
data = Buffer.concat([data, Buffer.from(chunk)])
}
})
.on('end', () => {
timings.contentTransfer = getTiming()
})
.on('data', chunk => {
checkFirstByte()
if (data) {
data = Buffer.concat([data, Buffer.from(chunk)])
}
})
.on('end', () => {
timings.contentTransfer = getTiming()
})
}

let firstByte
Expand Down Expand Up @@ -149,7 +149,7 @@ function nettime (options) {
})
listenToResponse(request)
request.on('end', () => client.destroy())
.setEncoding('utf8')
.setEncoding('utf8')
} else {
request = protocol.request(parameters, (localResponse) => {
listenToResponse(response = localResponse)
Expand Down
14 changes: 8 additions & 6 deletions package.json
Expand Up @@ -39,21 +39,23 @@
"codeclimate:download": "curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && chmod +x ./cc-test-reporter",
"codeclimate:execute": "CC_TEST_REPORTER_ID=261ca831f78e96f538d8f77ed64b9835b040ed666fe54dd136b6e6c466a55e35 ./cc-test-reporter before-build && cat coverage/lcov.info | CC_TEST_REPORTER_ID=261ca831f78e96f538d8f77ed64b9835b040ed666fe54dd136b6e6c466a55e35 ./cc-test-reporter after-build",
"coverage": "test `node --version | cut -c 2` -eq 8 && npm run coveralls && npm run codacy && npm run codecov && npm run codeclimate:download && npm run codeclimate:execute",
"semantic-release": "semantic-release"
"semantic-release": "semantic-release",
"travis-deploy-once": "travis-deploy-once"
},
"dependencies": {
"commander": "^2.12.2",
"readline-sync": "^1.4.7",
"commander": "^2.15.0",
"readline-sync": "^1.4.9",
"safe-buffer": "^5.1.1",
"sprintf-js": "^1.1.1"
},
"devDependencies": {
"codacy-coverage": "^2.0.3",
"codacy-coverage": "^2.1.0",
"codecov": "^3.0.0",
"coveralls": "^3.0.0",
"semantic-release": "^15.0.0",
"semantic-release": "^15.0.3",
"standard": "^11.0.1",
"tap": "^11.0.0"
"tap": "^11.1.2",
"travis-deploy-once": "^4.4.1"
},
"keywords": [
"nettime",
Expand Down

0 comments on commit 02a440c

Please sign in to comment.