Produced by Araxis Merge on 7/26/2017 10:13:36 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\AraxisMergeCompare\Pri_un\TGZ\request-2.71.0 | request-2.71.0.tar | Sat Feb 18 15:03:58 2017 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\TGZ\request-2.71.0 | request-2.71.0.tar | Wed Jul 26 13:25:08 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 9588 |
| Changed | 2 | 6 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | package/pa ckage.json \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 000664 \x000000 1750 \x00000017 50 \x0000000000 3714 \x00001270 3171102\x000001 3020 \x00000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000ust ar\x000000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x00000 00000 \x0000000 000 \x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000{ | |
| 2 | "name": "request", | |
| 3 | "descrip tion": "Si mplified H TTP reques t client." , | |
| 4 | "tags": [ | |
| 5 | "http" , | |
| 6 | "simpl e", | |
| 7 | "util" , | |
| 8 | "utili ty" | |
| 9 | ], | |
| 10 | "version ": "2.71.0 ", | |
| 11 | "author" : "Mikeal Rogers <mi keal.roger s@gmail.co m>", | |
| 12 | "reposit ory": { | |
| 13 | "type" : "git", | |
| 14 | "url": "https:// github.com /request/r equest.git " | |
| 15 | }, | |
| 16 | "bugs": { | |
| 17 | "url": "http://g ithub.com/ request/re quest/issu es" | |
| 18 | }, | |
| 19 | "license ": "Apache -2.0", | |
| 20 | "engines ": { | |
| 21 | "node" : ">=0.8.0 " | |
| 22 | }, | |
| 23 | "main": "index.js" , | |
| 24 | "depende ncies": { | |
| 25 | "aws-s ign2": "~0 .6.0", | |
| 26 | "aws4" : "^1.2.1" , | |
| 27 | "bl": "~1.1.2", | |
| 28 | "casel ess": "~0. 11.0", | |
| 29 | "combi ned-stream ": "~1.0.5 ", | |
| 30 | "exten d": "~3.0. 0", | |
| 31 | "forev er-agent": "~0.6.1", | |
| 32 | "form- data": "~1 .0.0-rc3", | |
| 33 | "har-v alidator": "~2.0.6", | |
| 34 | "hawk" : "~3.1.3" , | |
| 35 | "http- signature" : "~1.1.0" , | |
| 36 | "is-ty pedarray": "~1.0.0", | |
| 37 | "isstr eam": "~0. 1.2", | |
| 38 | "json- stringify- safe": "~5 .0.1", | |
| 39 | "mime- types": "~ 2.1.7", | |
| 40 | "node- uuid": "~1 .4.7", | |
| 41 | "oauth -sign": "~ 0.8.1", | |
| 42 | "qs": "~6.1.0", | |
| 43 | "strin gstream": "~0.0.4", | |
| 44 | "tough -cookie": "~2.2.0", | |
| 45 | "tunne l-agent": "~0.4.1" | |
| 46 | }, | |
| 47 | "scripts ": { | |
| 48 | "test" : "npm run lint && n pm run tes t-ci && np m run test -browser", | |
| 49 | "test- ci": "tape r tests/te st-*.js", | |
| 50 | "test- cov": "ist anbul cove r tape tes ts/test-*. js", | |
| 51 | "test- browser": "node test s/browser/ start.js", | |
| 52 | "lint" : "eslint lib/ *.js tests/ && echo Lint passed." | |
| 53 | }, | |
| 54 | "devDepe ndencies": { | |
| 55 | "blueb ird": "^3. 2.1", | |
| 56 | "brows erify": "^ 12.0.2", | |
| 57 | "brows erify-ista nbul": "^2 .0.0", | |
| 58 | "buffe r-equal": "^1.0.0", | |
| 59 | "codec ov.io": "^ 0.1.6", | |
| 60 | "cover alls": "^2 .11.4", | |
| 61 | "eslin t": "^2.5. 3", | |
| 62 | "funct ion-bind": "^1.0.2", | |
| 63 | "istan bul": "^0. 4.0", | |
| 64 | "karma ": "^0.13. 10", | |
| 65 | "karma -browserif y": "^5.0. 1", | |
| 66 | "karma -cli": "^0 .1.1", | |
| 67 | "karma -coverage" : "^0.5.3" , | |
| 68 | "karma -phantomjs -launcher" : "^1.0.0" , | |
| 69 | "karma -tap": "^1 .0.3", | |
| 70 | "phant omjs-prebu ilt": "^2. 1.3", | |
| 71 | "rimra f": "^2.2. 8", | |
| 72 | "serve r-destroy" : "^1.0.1" , | |
| 73 | "tape" : "^4.2.0" , | |
| 74 | "taper ": "^0.4.0 " | |
| 75 | } | |
| 76 | } | |
| 77 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000package/ .npmignore \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000000664 \x0000 001750 \x000000 1750 \x00000000 000106 \x000012 676423610\x0000 012536 \x00000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000u star\x000000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000000000 \x00000 00000 \x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000covera ge | |
| 78 | tests | |
| 79 | node_modul es | |
| 80 | examples | |
| 81 | release.sh | |
| 82 | disabled.a ppveyor.ym l | |
| 83 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000package/ README.md\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000000664 \x0000 001750 \x000000 1750 \x00000000 120377 \x000012 676423610\x0000 012033 \x00000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000u star\x000000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000000000 \x00000 00000 \x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000 | |
| 84 | # Request - Simplifi ed HTTP cl ient | |
| 85 | ||
| 86 | [](https ://nodei.c o/npm/requ est/) | |
| 87 | ||
| 88 | [](htt ps://travi s-ci.org/r equest/req uest) | |
| 89 | [](https:/ /codecov.i o/github/r equest/req uest?branc h=master) | |
| 90 | [](http s://covera lls.io/r/r equest/req uest) | |
| 91 | [] (https://d avid-dm.or g/request/ request) | |
| 92 | [](h ttps://sny k.io/test/ npm/reques t) | |
| 93 | [![Gitter] (https://i mg.shields .io/badge/ gitter-joi n_chat-blu e.svg?styl e=flat-squ are)](http s://gitter .im/reques t/request? utm_source =badge) | |
| 94 | ||
| 95 | ||
| 96 | ## Super s imple to u se | |
| 97 | ||
| 98 | Request is designed to be the simplest w ay possibl e to make http calls . It suppo rts HTTPS and follow s redirect s by defau lt. | |
| 99 | ||
| 100 | ```js | |
| 101 | var reques t = requir e('request '); | |
| 102 | request('h ttp://www. google.com ', functio n (error, response, body) { | |
| 103 | if (!err or && resp onse.statu sCode == 2 00) { | |
| 104 | consol e.log(body ) // Show the HTML f or the Goo gle homepa ge. | |
| 105 | } | |
| 106 | }) | |
| 107 | ``` | |
| 108 | ||
| 109 | ||
| 110 | ## Table o f contents | |
| 111 | ||
| 112 | - [Streami ng](#strea ming) | |
| 113 | - [Forms]( #forms) | |
| 114 | - [HTTP Au thenticati on](#http- authentica tion) | |
| 115 | - [Custom HTTP Heade rs](#custo m-http-hea ders) | |
| 116 | - [OAuth S igning](#o auth-signi ng) | |
| 117 | - [Proxies ](#proxies ) | |
| 118 | - [Unix Do main Socke ts](#unix- domain-soc kets) | |
| 119 | - [TLS/SSL Protocol] (#tlsssl-p rotocol) | |
| 120 | - [Support for HAR 1 .2](#suppo rt-for-har -12) | |
| 121 | - [**All A vailable O ptions**]( #requestop tions-call back) | |
| 122 | ||
| 123 | Request al so offers [convenien ce methods ](#conveni ence-metho ds) like | |
| 124 | `request.d efaults` a nd `reques t.post`, a nd there a re | |
| 125 | lots of [u sage examp les](#exam ples) and several | |
| 126 | [debugging technique s](#debugg ing). | |
| 127 | ||
| 128 | ||
| 129 | --- | |
| 130 | ||
| 131 | ||
| 132 | ## Streami ng | |
| 133 | ||
| 134 | You can st ream any r esponse to a file st ream. | |
| 135 | ||
| 136 | ```js | |
| 137 | request('h ttp://goog le.com/doo dle.png'). pipe(fs.cr eateWriteS tream('doo dle.png')) | |
| 138 | ``` | |
| 139 | ||
| 140 | You can al so stream a file to a PUT or P OST reques t. This me thod will also check the file extension against a mapping of file exte nsions to content-ty pes (in th is case `a pplication /json`) an d use the proper `co ntent-type ` in the P UT request (if the h eaders don ’t alrea dy provide one). | |
| 141 | ||
| 142 | ```js | |
| 143 | fs.createR eadStream( 'file.json ').pipe(re quest.put( 'http://my site.com/o bj.json')) | |
| 144 | ``` | |
| 145 | ||
| 146 | Request ca n also `pi pe` to its elf. When doing so, `content-t ype` and ` content-le ngth` are preserved in the PUT headers. | |
| 147 | ||
| 148 | ```js | |
| 149 | request.ge t('http:// google.com /img.png') .pipe(requ est.put('h ttp://mysi te.com/img .png')) | |
| 150 | ``` | |
| 151 | ||
| 152 | Request em its a "res ponse" eve nt when a response i s received . The `res ponse` arg ument will be an ins tance of [ http.Incom ingMessage ](http://n odejs.org/ api/http.h tml#http_h ttp_incomi ngmessage) . | |
| 153 | ||
| 154 | ```js | |
| 155 | request | |
| 156 | .get('ht tp://googl e.com/img. png') | |
| 157 | .on('res ponse', fu nction(res ponse) { | |
| 158 | consol e.log(resp onse.statu sCode) // 200 | |
| 159 | consol e.log(resp onse.heade rs['conten t-type']) // 'image/ png' | |
| 160 | }) | |
| 161 | .pipe(re quest.put( 'http://my site.com/i mg.png')) | |
| 162 | ``` | |
| 163 | ||
| 164 | To easily handle err ors when s treaming r equests, l isten to t he `error` event bef ore piping : | |
| 165 | ||
| 166 | ```js | |
| 167 | request | |
| 168 | .get('ht tp://mysit e.com/dood le.png') | |
| 169 | .on('err or', funct ion(err) { | |
| 170 | consol e.log(err) | |
| 171 | }) | |
| 172 | .pipe(fs .createWri teStream(' doodle.png ')) | |
| 173 | ``` | |
| 174 | ||
| 175 | Now let’ s get fanc y. | |
| 176 | ||
| 177 | ```js | |
| 178 | http.creat eServer(fu nction (re q, resp) { | |
| 179 | if (req. url === '/ doodle.png ') { | |
| 180 | if (re q.method = == 'PUT') { | |
| 181 | req. pipe(reque st.put('ht tp://mysit e.com/dood le.png')) | |
| 182 | } else if (req.m ethod === 'GET' || r eq.method === 'HEAD' ) { | |
| 183 | requ est.get('h ttp://mysi te.com/doo dle.png'). pipe(resp) | |
| 184 | } | |
| 185 | } | |
| 186 | }) | |
| 187 | ``` | |
| 188 | ||
| 189 | You can al so `pipe() ` from `ht tp.ServerR equest` in stances, a s well as to `http.S erverRespo nse` insta nces. The HTTP metho d, headers , and enti ty-body da ta will be sent. Whi ch means t hat, if yo u don't re ally care about secu rity, you can do: | |
| 190 | ||
| 191 | ```js | |
| 192 | http.creat eServer(fu nction (re q, resp) { | |
| 193 | if (req. url === '/ doodle.png ') { | |
| 194 | var x = request( 'http://my site.com/d oodle.png' ) | |
| 195 | req.pi pe(x) | |
| 196 | x.pipe (resp) | |
| 197 | } | |
| 198 | }) | |
| 199 | ``` | |
| 200 | ||
| 201 | And since `pipe()` r eturns the destinati on stream in ≥ Nod e 0.5.x yo u can do o ne line pr oxying. :) | |
| 202 | ||
| 203 | ```js | |
| 204 | req.pipe(r equest('ht tp://mysit e.com/dood le.png')). pipe(resp) | |
| 205 | ``` | |
| 206 | ||
| 207 | Also, none of this n ew functio nality con flicts wit h requests previous features, it just ex pands them . | |
| 208 | ||
| 209 | ```js | |
| 210 | var r = re quest.defa ults({'pro xy':'http: //localpro xy.com'}) | |
| 211 | ||
| 212 | http.creat eServer(fu nction (re q, resp) { | |
| 213 | if (req. url === '/ doodle.png ') { | |
| 214 | r.get( 'http://go ogle.com/d oodle.png' ).pipe(res p) | |
| 215 | } | |
| 216 | }) | |
| 217 | ``` | |
| 218 | ||
| 219 | You can st ill use in termediate proxies, the reques ts will st ill follow HTTP forw ards, etc. | |
| 220 | ||
| 221 | [back to t op](#table -of-conten ts) | |
| 222 | ||
| 223 | ||
| 224 | --- | |
| 225 | ||
| 226 | ||
| 227 | ## Forms | |
| 228 | ||
| 229 | `request` supports ` applicatio n/x-www-fo rm-urlenco ded` and ` multipart/ form-data` form uplo ads. For ` multipart/ related` r efer to th e `multipa rt` API. | |
| 230 | ||
| 231 | ||
| 232 | #### appli cation/x-w ww-form-ur lencoded ( URL-Encode d Forms) | |
| 233 | ||
| 234 | URL-encode d forms ar e simple. | |
| 235 | ||
| 236 | ```js | |
| 237 | request.po st('http:/ /service.c om/upload' , {form:{k ey:'value' }}) | |
| 238 | // or | |
| 239 | request.po st('http:/ /service.c om/upload' ).form({ke y:'value'} ) | |
| 240 | // or | |
| 241 | request.po st({url:'h ttp://serv ice.com/up load', for m: {key:'v alue'}}, f unction(er r,httpResp onse,body) { /* ... * / }) | |
| 242 | ``` | |
| 243 | ||
| 244 | ||
| 245 | #### multi part/form- data (Mult ipart Form Uploads) | |
| 246 | ||
| 247 | For `multi part/form- data` we u se the [fo rm-data](h ttps://git hub.com/fo rm-data/fo rm-data) l ibrary by [@felixge] (https://g ithub.com/ felixge). For the mo st cases, you can pa ss your up load form data via t he `formDa ta` option . | |
| 248 | ||
| 249 | ||
| 250 | ```js | |
| 251 | var formDa ta = { | |
| 252 | // Pass a simple k ey-value p air | |
| 253 | my_field : 'my_valu e', | |
| 254 | // Pass data via B uffers | |
| 255 | my_buffe r: new Buf fer([1, 2, 3]), | |
| 256 | // Pass data via S treams | |
| 257 | my_file: fs.create ReadStream (__dirname + '/unicy cle.jpg'), | |
| 258 | // Pass multiple v alues /w a n Array | |
| 259 | attachme nts: [ | |
| 260 | fs.cre ateReadStr eam(__dirn ame + '/at tachment1. jpg'), | |
| 261 | fs.cre ateReadStr eam(__dirn ame + '/at tachment2. jpg') | |
| 262 | ], | |
| 263 | // Pass optional m eta-data w ith an 'op tions' obj ect with s tyle: {val ue: DATA, options: O PTIONS} | |
| 264 | // Use c ase: for s ome types of streams , you'll n eed to pro vide "file "-related informatio n manually . | |
| 265 | // See t he `form-d ata` READM E for more informati on about o ptions: ht tps://gith ub.com/for m-data/for m-data | |
| 266 | custom_f ile: { | |
| 267 | value: fs.creat eReadStrea m('/dev/ur andom'), | |
| 268 | option s: { | |
| 269 | file name: 'top secret.jpg ', | |
| 270 | cont entType: ' image/jpg' | |
| 271 | } | |
| 272 | } | |
| 273 | }; | |
| 274 | request.po st({url:'h ttp://serv ice.com/up load', for mData: for mData}, fu nction opt ionalCallb ack(err, h ttpRespons e, body) { | |
| 275 | if (err) { | |
| 276 | return console.e rror('uplo ad failed: ', err); | |
| 277 | } | |
| 278 | console. log('Uploa d successf ul! Serve r responde d with:', body); | |
| 279 | }); | |
| 280 | ``` | |
| 281 | ||
| 282 | For advanc ed cases, you can ac cess the f orm-data o bject itse lf via `r. form()`. T his can be modified until the request is fired on the next c ycle of th e event-lo op. (Note that this calling `f orm()` wil l clear th e currentl y set form data for that reque st.) | |
| 283 | ||
| 284 | ```js | |
| 285 | // NOTE: A dvanced us e-case, fo r normal u se see 'fo rmData' us age above | |
| 286 | var r = re quest.post ('http://s ervice.com /upload', function o ptionalCal lback(err, httpRespo nse, body) {...}) | |
| 287 | var form = r.form(); | |
| 288 | form.appen d('my_fiel d', 'my_va lue'); | |
| 289 | form.appen d('my_buff er', new B uffer([1, 2, 3])); | |
| 290 | form.appen d('custom_ file', fs. createRead Stream(__d irname + ' /unicycle. jpg'), {fi lename: 'u nicycle.jp g'}); | |
| 291 | ``` | |
| 292 | See the [f orm-data R EADME](htt ps://githu b.com/form -data/form -data) for more info rmation & examples. | |
| 293 | ||
| 294 | ||
| 295 | #### multi part/relat ed | |
| 296 | ||
| 297 | Some varia tions in d ifferent H TTP implem entations require a newline/CR LF before, after, or both befo re and aft er the bou ndary of a `multipar t/related` request ( using the multipart option). T his has be en observe d in the . NET WebAPI version 4 .0. You ca n turn on a boundary preambleC RLF or pos tamble by passing th em as `tru e` to your request o ptions. | |
| 298 | ||
| 299 | ```js | |
| 300 | request( { | |
| 301 | method : 'PUT', | |
| 302 | preamb leCRLF: tr ue, | |
| 303 | postam bleCRLF: t rue, | |
| 304 | uri: ' http://ser vice.com/u pload', | |
| 305 | multip art: [ | |
| 306 | { | |
| 307 | 'c ontent-typ e': 'appli cation/jso n', | |
| 308 | bo dy: JSON.s tringify({ foo: 'bar' , _attachm ents: {'me ssage.txt' : {follows : true, le ngth: 18, 'content_t ype': 'tex t/plain' } }}) | |
| 309 | }, | |
| 310 | { bo dy: 'I am an attachm ent' }, | |
| 311 | { bo dy: fs.cre ateReadStr eam('image .png') } | |
| 312 | ], | |
| 313 | // alt ernatively pass an o bject cont aining add itional op tions | |
| 314 | multip art: { | |
| 315 | chun ked: false , | |
| 316 | data : [ | |
| 317 | { | |
| 318 | 'content-t ype': 'app lication/j son', | |
| 319 | body: JSON .stringify ({foo: 'ba r', _attac hments: {' message.tx t': {follo ws: true, length: 18 , 'content _type': 't ext/plain' }}}) | |
| 320 | }, | |
| 321 | { body: 'I a m an attac hment' } | |
| 322 | ] | |
| 323 | } | |
| 324 | }, | |
| 325 | function (error, r esponse, b ody) { | |
| 326 | if (er ror) { | |
| 327 | retu rn console .error('up load faile d:', error ); | |
| 328 | } | |
| 329 | consol e.log('Upl oad succes sful! Ser ver respon ded with:' , body); | |
| 330 | }) | |
| 331 | ``` | |
| 332 | ||
| 333 | [back to t op](#table -of-conten ts) | |
| 334 | ||
| 335 | ||
| 336 | --- | |
| 337 | ||
| 338 | ||
| 339 | ## HTTP Au thenticati on | |
| 340 | ||
| 341 | ```js | |
| 342 | request.ge t('http:// some.serve r.com/').a uth('usern ame', 'pas sword', fa lse); | |
| 343 | // or | |
| 344 | request.ge t('http:// some.serve r.com/', { | |
| 345 | 'auth': { | |
| 346 | 'user' : 'usernam e', | |
| 347 | 'pass' : 'passwor d', | |
| 348 | 'sendI mmediately ': false | |
| 349 | } | |
| 350 | }); | |
| 351 | // or | |
| 352 | request.ge t('http:// some.serve r.com/').a uth(null, null, true , 'bearerT oken'); | |
| 353 | // or | |
| 354 | request.ge t('http:// some.serve r.com/', { | |
| 355 | 'auth': { | |
| 356 | 'beare r': 'beare rToken' | |
| 357 | } | |
| 358 | }); | |
| 359 | ``` | |
| 360 | ||
| 361 | If passed as an opti on, `auth` should be a hash co ntaining v alues: | |
| 362 | ||
| 363 | - `user` | | `usernam e` | |
| 364 | - `pass` | | `passwor d` | |
| 365 | - `sendImm ediately` (optional) | |
| 366 | - `bearer` (optional ) | |
| 367 | ||
| 368 | The method form take s paramete rs | |
| 369 | `auth(user name, pass word, send Immediatel y, bearer) `. | |
| 370 | ||
| 371 | `sendImmed iately` de faults to `true`, wh ich causes a basic o r bearer | |
| 372 | authentica tion heade r to be se nt. If `s endImmedia tely` is ` false`, th en | |
| 373 | `request` will retry with a pr oper authe ntication header aft er receivi ng a | |
| 374 | `401` resp onse from the server (which mu st contain a `WWW-Au thenticate ` header | |
| 375 | indicating the requi red authen tication m ethod). | |
| 376 | ||
| 377 | Note that you can al so specify basic aut henticatio n using th e URL itse lf, as | |
| 378 | detailed i n [RFC 173 8](http:// www.ietf.o rg/rfc/rfc 1738.txt). Simply p ass the | |
| 379 | `user:pass word` befo re the hos t with an `@` sign: | |
| 380 | ||
| 381 | ```js | |
| 382 | var userna me = 'user name', | |
| 383 | passwo rd = 'pass word', | |
| 384 | url = 'http://' + username + ':' + p assword + '@some.ser ver.com'; | |
| 385 | ||
| 386 | request({u rl: url}, function ( error, res ponse, bod y) { | |
| 387 | // Do m ore stuff with 'body ' here | |
| 388 | }); | |
| 389 | ``` | |
| 390 | ||
| 391 | Digest aut henticatio n is suppo rted, but it only wo rks with ` sendImmedi ately` | |
| 392 | set to `fa lse`; othe rwise `req uest` will send basi c authenti cation on the | |
| 393 | initial re quest, whi ch will pr obably cau se the req uest to fa il. | |
| 394 | ||
| 395 | Bearer aut henticatio n is suppo rted, and is activat ed when th e `bearer` value is | |
| 396 | available. The value may be ei ther a `St ring` or a `Function ` returnin g a | |
| 397 | `String`. Using a fu nction to supply the bearer to ken is par ticularly useful if | |
| 398 | used in co njunction with `defa ults` to a llow a sin gle functi on to supp ly the | |
| 399 | last known token at the time o f sending a request, or to com pute one o n the fly. | |
| 400 | ||
| 401 | [back to t op](#table -of-conten ts) | |
| 402 | ||
| 403 | ||
| 404 | --- | |
| 405 | ||
| 406 | ||
| 407 | ## Custom HTTP Heade rs | |
| 408 | ||
| 409 | HTTP Heade rs, such a s `User-Ag ent`, can be set in the `optio ns` object . | |
| 410 | In the exa mple below , we call the github API to fi nd out the number | |
| 411 | of stars a nd forks f or the req uest repos itory. Thi s requires a | |
| 412 | custom `Us er-Agent` header as well as ht tps. | |
| 413 | ||
| 414 | ```js | |
| 415 | var reques t = requir e('request '); | |
| 416 | ||
| 417 | var option s = { | |
| 418 | url: 'ht tps://api. github.com /repos/req uest/reque st', | |
| 419 | headers: { | |
| 420 | 'User- Agent': 'r equest' | |
| 421 | } | |
| 422 | }; | |
| 423 | ||
| 424 | function c allback(er ror, respo nse, body) { | |
| 425 | if (!err or && resp onse.statu sCode == 2 00) { | |
| 426 | var in fo = JSON. parse(body ); | |
| 427 | consol e.log(info .stargazer s_count + " Stars"); | |
| 428 | consol e.log(info .forks_cou nt + " For ks"); | |
| 429 | } | |
| 430 | } | |
| 431 | ||
| 432 | request(op tions, cal lback); | |
| 433 | ``` | |
| 434 | ||
| 435 | [back to t op](#table -of-conten ts) | |
| 436 | ||
| 437 | ||
| 438 | --- | |
| 439 | ||
| 440 | ||
| 441 | ## OAuth S igning | |
| 442 | ||
| 443 | [OAuth ver sion 1.0]( https://to ols.ietf.o rg/html/rf c5849) is supported. The | |
| 444 | default si gning algo rithm is | |
| 445 | [HMAC-SHA1 ](https:// tools.ietf .org/html/ rfc5849#se ction-3.4. 2): | |
| 446 | ||
| 447 | ```js | |
| 448 | // OAuth1. 0 - 3-legg ed server side flow (Twitter e xample) | |
| 449 | // step 1 | |
| 450 | var qs = r equire('qu erystring' ) | |
| 451 | , oauth = | |
| 452 | { call back: 'htt p://mysite .com/callb ack/' | |
| 453 | , cons umer_key: CONSUMER_K EY | |
| 454 | , cons umer_secre t: CONSUME R_SECRET | |
| 455 | } | |
| 456 | , url = 'https://a pi.twitter .com/oauth /request_t oken' | |
| 457 | ; | |
| 458 | request.po st({url:ur l, oauth:o auth}, fun ction (e, r, body) { | |
| 459 | // Ideal ly, you wo uld take t he body in the respo nse | |
| 460 | // and c onstruct a URL that a user cli cks on (li ke a sign in button) . | |
| 461 | // The v erifier is only avai lable in t he respons e after a user has | |
| 462 | // verif ied with t witter tha t they are authorizi ng your ap p. | |
| 463 | ||
| 464 | // step 2 | |
| 465 | var req_ data = qs. parse(body ) | |
| 466 | var uri = 'https:/ /api.twitt er.com/oau th/authent icate' | |
| 467 | + '?' + qs.strin gify({oaut h_token: r eq_data.oa uth_token} ) | |
| 468 | // redir ect the us er to the authorize uri | |
| 469 | ||
| 470 | // step 3 | |
| 471 | // after the user is redirec ted back t o your ser ver | |
| 472 | var auth _data = qs .parse(bod y) | |
| 473 | , oaut h = | |
| 474 | { co nsumer_key : CONSUMER _KEY | |
| 475 | , co nsumer_sec ret: CONSU MER_SECRET | |
| 476 | , to ken: auth_ data.oauth _token | |
| 477 | , to ken_secret : req_data .oauth_tok en_secret | |
| 478 | , ve rifier: au th_data.oa uth_verifi er | |
| 479 | } | |
| 480 | , url = 'https:/ /api.twitt er.com/oau th/access_ token' | |
| 481 | ; | |
| 482 | request. post({url: url, oauth :oauth}, f unction (e , r, body) { | |
| 483 | // rea dy to make signed re quests on behalf of the user | |
| 484 | var pe rm_data = qs.parse(b ody) | |
| 485 | , oa uth = | |
| 486 | { consumer_k ey: CONSUM ER_KEY | |
| 487 | , consumer_s ecret: CON SUMER_SECR ET | |
| 488 | , token: per m_data.oau th_token | |
| 489 | , token_secr et: perm_d ata.oauth_ token_secr et | |
| 490 | } | |
| 491 | , ur l = 'https ://api.twi tter.com/1 .1/users/s how.json' | |
| 492 | , qs = | |
| 493 | { screen_nam e: perm_da ta.screen_ name | |
| 494 | , user_id: p erm_data.u ser_id | |
| 495 | } | |
| 496 | ; | |
| 497 | reques t.get({url :url, oaut h:oauth, q s:qs, json :true}, fu nction (e, r, user) { | |
| 498 | cons ole.log(us er) | |
| 499 | }) | |
| 500 | }) | |
| 501 | }) | |
| 502 | ``` | |
| 503 | ||
| 504 | For [RSA-S HA1 signin g](https:/ /tools.iet f.org/html /rfc5849#s ection-3.4 .3), make | |
| 505 | the follow ing change s to the O Auth optio ns object: | |
| 506 | * Pass `si gnature_me thod : 'RS A-SHA1'` | |
| 507 | * Instead of `consum er_secret` , specify a `private _key` stri ng in | |
| 508 | [PEM for mat](http: //how2ssl. com/articl es/working _with_pem_ files/) | |
| 509 | ||
| 510 | For [PLAIN TEXT signi ng](http:/ /oauth.net /core/1.0/ #anchor22) , make | |
| 511 | the follow ing change s to the O Auth optio ns object: | |
| 512 | * Pass `si gnature_me thod : 'PL AINTEXT'` | |
| 513 | ||
| 514 | To send OA uth parame ters via q uery param s or in a post body as describ ed in The | |
| 515 | [Consumer Request Pa rameters]( http://oau th.net/cor e/1.0/#con sumer_req_ param) | |
| 516 | section of the oauth 1 spec: | |
| 517 | * Pass `tr ansport_me thod : 'qu ery'` or ` transport_ method : ' body'` in the OAuth | |
| 518 | options object. | |
| 519 | * `transpo rt_method` defaults to `'heade r'` | |
| 520 | ||
| 521 | To use [Re quest Body Hash](htt ps://oauth .googlecod e.com/svn/ spec/ext/b ody_hash/1 .0/oauth-b odyhash.ht ml) you ca n either | |
| 522 | * Manually generate the body h ash and pa ss it as a string `b ody_hash: '...'` | |
| 523 | * Automati cally gene rate the b ody hash b y passing `body_hash : true` | |
| 524 | ||
| 525 | [back to t op](#table -of-conten ts) | |
| 526 | ||
| 527 | ||
| 528 | --- | |
| 529 | ||
| 530 | ||
| 531 | ## Proxies | |
| 532 | ||
| 533 | If you spe cify a `pr oxy` optio n, then th e request (and any s ubsequent | |
| 534 | redirects) will be s ent via a connection to the pr oxy server . | |
| 535 | ||
| 536 | If your en dpoint is an `https` url, and you are us ing a prox y, then | |
| 537 | request wi ll send a `CONNECT` request to the proxy server *f irst*, and | |
| 538 | then use t he supplie d connecti on to conn ect to the endpoint. | |
| 539 | ||
| 540 | That is, f irst it wi ll make a request li ke: | |
| 541 | ||
| 542 | ``` | |
| 543 | HTTP/1.1 C ONNECT end point-serv er.com:80 | |
| 544 | Host: prox y-server.c om | |
| 545 | User-Agent : whatever user agen t you spec ify | |
| 546 | ``` | |
| 547 | ||
| 548 | and then t he proxy s erver make a TCP con nection to `endpoint -server` | |
| 549 | on port `8 0`, and re turn a res ponse that looks lik e: | |
| 550 | ||
| 551 | ``` | |
| 552 | HTTP/1.1 2 00 OK | |
| 553 | ``` | |
| 554 | ||
| 555 | At this po int, the c onnection is left op en, and th e client i s | |
| 556 | communicat ing direct ly with th e `endpoin t-server.c om` machin e. | |
| 557 | ||
| 558 | See [the w ikipedia p age on HTT P Tunnelin g](https:/ /en.wikipe dia.org/wi ki/HTTP_tu nnel) | |
| 559 | for more i nformation . | |
| 560 | ||
| 561 | By default , when pro xying `htt p` traffic , request will simpl y make a | |
| 562 | standard p roxied `ht tp` reques t. This i s done by making the `url` | |
| 563 | section of the initi al line of the reque st a fully qualified url to | |
| 564 | the endpoi nt. | |
| 565 | ||
| 566 | For exampl e, it will make a si ngle reque st that lo oks like: | |
| 567 | ||
| 568 | ``` | |
| 569 | HTTP/1.1 G ET http:// endpoint-s erver.com/ some-url | |
| 570 | Host: prox y-server.c om | |
| 571 | Other-Head ers: all g o here | |
| 572 | ||
| 573 | request bo dy or what ever | |
| 574 | ``` | |
| 575 | ||
| 576 | Because a pure "http over http " tunnel o ffers no a dditional security | |
| 577 | or other f eatures, i t is gener ally simpl er to go w ith a | |
| 578 | straightfo rward HTTP proxy in this case. However, if you wo uld like | |
| 579 | to force a tunneling proxy, yo u may set the `tunne l` option to `true`. | |
| 580 | ||
| 581 | You can al so make a standard p roxied `ht tp` reques t by expli citly sett ing | |
| 582 | `tunnel : false`, bu t **note t hat this w ill allow the proxy to see the traffic | |
| 583 | to/from th e destinat ion server **. | |
| 584 | ||
| 585 | If you are using a t unneling p roxy, you may set th e | |
| 586 | `proxyHead erWhiteLis t` to shar e certain headers wi th the pro xy. | |
| 587 | ||
| 588 | You can al so set the `proxyHea derExclusi veList` to share cer tain | |
| 589 | headers on ly with th e proxy an d not with destinati on host. | |
| 590 | ||
| 591 | By default , this set is: | |
| 592 | ||
| 593 | ``` | |
| 594 | accept | |
| 595 | accept-cha rset | |
| 596 | accept-enc oding | |
| 597 | accept-lan guage | |
| 598 | accept-ran ges | |
| 599 | cache-cont rol | |
| 600 | content-en coding | |
| 601 | content-la nguage | |
| 602 | content-le ngth | |
| 603 | content-lo cation | |
| 604 | content-md 5 | |
| 605 | content-ra nge | |
| 606 | content-ty pe | |
| 607 | connection | |
| 608 | date | |
| 609 | expect | |
| 610 | max-forwar ds | |
| 611 | pragma | |
| 612 | proxy-auth orization | |
| 613 | referer | |
| 614 | te | |
| 615 | transfer-e ncoding | |
| 616 | user-agent | |
| 617 | via | |
| 618 | ``` | |
| 619 | ||
| 620 | Note that, when usin g a tunnel ing proxy, the `prox y-authoriz ation` | |
| 621 | header and any heade rs from cu stom `prox yHeaderExc lusiveList ` are | |
| 622 | *never* se nt to the endpoint s erver, but only to t he proxy s erver. | |
| 623 | ||
| 624 | ||
| 625 | ### Contro lling prox y behaviou r using en vironment variables | |
| 626 | ||
| 627 | The follow ing enviro nment vari ables are respected by `reques t`: | |
| 628 | ||
| 629 | * `HTTP_P ROXY` / `h ttp_proxy` | |
| 630 | * `HTTPS_ PROXY` / ` https_prox y` | |
| 631 | * `NO_PRO XY` / `no_ proxy` | |
| 632 | ||
| 633 | When `HTTP _PROXY` / `http_prox y` are set , they wil l be used to proxy n on-SSL req uests that do not ha ve an expl icit `prox y` configu ration opt ion presen t. Similar ly, `HTTPS _PROXY` / `https_pro xy` will b e respecte d for SSL requests t hat do not have an e xplicit `p roxy` conf iguration option. It is valid to define a proxy in one of th e environm ent variab les, but t hen overri de it for a specific request, using the `proxy` co nfiguratio n option. Furthermor e, the `pr oxy` confi guration o ption can be explici tly set to false / n ull to opt out of pr oxying alt ogether fo r that req uest. | |
| 634 | ||
| 635 | `request` is also aw are of the `NO_PROXY `/`no_prox y` environ ment varia bles. Thes e variable s provide a granular way to op t out of p roxying, o n a per-ho st basis. It should contain a comma sepa rated list of hosts to opt out of proxyi ng. It is also possi ble to opt of proxyi ng when a particular destinati on port is used. Fin ally, the variable m ay be set to `*` to opt out of the impli cit proxy configurat ion of the other env ironment v ariables. | |
| 636 | ||
| 637 | Here's som e examples of valid `no_proxy` values: | |
| 638 | ||
| 639 | * `google .com` - do n't proxy HTTP/HTTPS requests to Google. | |
| 640 | * `google .com:443` - don't pr oxy HTTPS requests t o Google, but *do* p roxy HTTP requests t o Google. | |
| 641 | * `google .com:443, yahoo.com: 80` - don' t proxy HT TPS reques ts to Goog le, and do n't proxy HTTP reque sts to Yah oo! | |
| 642 | * `*` - i gnore `htt ps_proxy`/ `http_prox y` environ ment varia bles altog ether. | |
| 643 | ||
| 644 | [back to t op](#table -of-conten ts) | |
| 645 | ||
| 646 | ||
| 647 | --- | |
| 648 | ||
| 649 | ||
| 650 | ## UNIX Do main Socke ts | |
| 651 | ||
| 652 | `request` supports m aking requ ests to [U NIX Domain Sockets]( https://en .wikipedia .org/wiki/ Unix_domai n_socket). To make o ne, use th e followin g URL sche me: | |
| 653 | ||
| 654 | ```js | |
| 655 | /* Pattern */ 'http: //unix:SOC KET:PATH' | |
| 656 | /* Example */ reques t.get('htt p://unix:/ absolute/p ath/to/uni x.socket:/ request/pa th') | |
| 657 | ``` | |
| 658 | ||
| 659 | Note: The `SOCKET` p ath is ass umed to be absolute to the roo t of the h ost file s ystem. | |
| 660 | ||
| 661 | [back to t op](#table -of-conten ts) | |
| 662 | ||
| 663 | ||
| 664 | --- | |
| 665 | ||
| 666 | ||
| 667 | ## TLS/SSL Protocol | |
| 668 | ||
| 669 | TLS/SSL Pr otocol opt ions, such as `cert` , `key` an d `passphr ase`, can be | |
| 670 | set direct ly in `opt ions` obje ct, in the `agentOpt ions` prop erty of th e `options ` object, or even in `https.gl obalAgent. options`. Keep in mi nd that, a lthough `a gentOption s` allows for a slig htly wider range of configurat ions, the recommende d way is v ia `option s` object directly, as using ` agentOptio ns` or `ht tps.global Agent.opti ons` would not be ap plied in t he same wa y in proxi ed environ ments (as data trave ls through a TLS con nection in stead of a n http/htt ps agent). | |
| 671 | ||
| 672 | ```js | |
| 673 | var fs = r equire('fs ') | |
| 674 | , path = require ('path') | |
| 675 | , cert File = pat h.resolve( __dirname, 'ssl/clie nt.crt') | |
| 676 | , keyF ile = path .resolve(_ _dirname, 'ssl/clien t.key') | |
| 677 | , caFi le = path. resolve(__ dirname, ' ssl/ca.cer t.pem') | |
| 678 | , requ est = requ ire('reque st'); | |
| 679 | ||
| 680 | var option s = { | |
| 681 | url: ' https://ap i.some-ser ver.com/', | |
| 682 | cert: fs.readFil eSync(cert File), | |
| 683 | key: f s.readFile Sync(keyFi le), | |
| 684 | passph rase: 'pas sword', | |
| 685 | ca: fs .readFileS ync(caFile ) | |
| 686 | } | |
| 687 | }; | |
| 688 | ||
| 689 | request.ge t(options) ; | |
| 690 | ``` | |
| 691 | ||
| 692 | ### Using `options.a gentOption s` | |
| 693 | ||
| 694 | In the exa mple below , we call an API req uires clie nt side SS L certific ate | |
| 695 | (in PEM fo rmat) with passphras e protecte d private key (in PE M format) and disabl e the SSLv 3 protocol : | |
| 696 | ||
| 697 | ```js | |
| 698 | var fs = r equire('fs ') | |
| 699 | , path = require ('path') | |
| 700 | , cert File = pat h.resolve( __dirname, 'ssl/clie nt.crt') | |
| 701 | , keyF ile = path .resolve(_ _dirname, 'ssl/clien t.key') | |
| 702 | , requ est = requ ire('reque st'); | |
| 703 | ||
| 704 | var option s = { | |
| 705 | url: ' https://ap i.some-ser ver.com/', | |
| 706 | agentO ptions: { | |
| 707 | ce rt: fs.rea dFileSync( certFile), | |
| 708 | ke y: fs.read FileSync(k eyFile), | |
| 709 | // Or use `p fx` proper ty replaci ng `cert` and `key` when using private k ey, certif icate and CA certs i n PFX or P KCS12 form at: | |
| 710 | // pfx: fs.r eadFileSyn c(pfxFileP ath), | |
| 711 | pa ssphrase: 'password' , | |
| 712 | se curityOpti ons: 'SSL_ OP_NO_SSLv 3' | |
| 713 | } | |
| 714 | }; | |
| 715 | ||
| 716 | request.ge t(options) ; | |
| 717 | ``` | |
| 718 | ||
| 719 | It is able to force using SSLv 3 only by specifying `securePr otocol`: | |
| 720 | ||
| 721 | ```js | |
| 722 | request.ge t({ | |
| 723 | url: ' https://ap i.some-ser ver.com/', | |
| 724 | agentO ptions: { | |
| 725 | se cureProtoc ol: 'SSLv3 _method' | |
| 726 | } | |
| 727 | }); | |
| 728 | ``` | |
| 729 | ||
| 730 | It is poss ible to ac cept other certifica tes than t hose signe d by gener ally allow ed Certifi cate Autho rities (CA s). | |
| 731 | This can b e useful, for exampl e, when u sing self- signed cer tificates. | |
| 732 | To require a differe nt root ce rtificate, you can s pecify the signing C A by addin g the cont ents of th e CA's cer tificate f ile to the `agentOpt ions`. | |
| 733 | The certif icate the domain pre sents must be signed by the ro ot certifi cate speci fied: | |
| 734 | ||
| 735 | ```js | |
| 736 | request.ge t({ | |
| 737 | url: ' https://ap i.some-ser ver.com/', | |
| 738 | agentO ptions: { | |
| 739 | ca : fs.readF ileSync('c a.cert.pem ') | |
| 740 | } | |
| 741 | }); | |
| 742 | ``` | |
| 743 | ||
| 744 | [back to t op](#table -of-conten ts) | |
| 745 | ||
| 746 | ||
| 747 | --- | |
| 748 | ||
| 749 | ## Support for HAR 1 .2 | |
| 750 | ||
| 751 | The `optio ns.har` pr operty wil l override the value s: `url`, `method`, `qs`, `hea ders`, `fo rm`, `form Data`, `bo dy`, `json `, as well as constr uct multip art data a nd read fi les from d isk when ` request.po stData.par ams[].file Name` is p resent wit hout a mat ching `val ue`. | |
| 752 | ||
| 753 | a validati on step wi ll check i f the HAR Request fo rmat match es the lat est spec ( v1.2) and will skip parsing if not match ing. | |
| 754 | ||
| 755 | ```js | |
| 756 | var requ est = requ ire('reque st') | |
| 757 | request( { | |
| 758 | // wil l be ignor ed | |
| 759 | method : 'GET', | |
| 760 | uri: ' http://www .google.co m', | |
| 761 | ||
| 762 | // HTT P Archive Request Ob ject | |
| 763 | har: { | |
| 764 | url: 'http://w ww.mockbin .com/har', | |
| 765 | meth od: 'POST' , | |
| 766 | head ers: [ | |
| 767 | { | |
| 768 | name: 'con tent-type' , | |
| 769 | value: 'ap plication/ x-www-form -urlencode d' | |
| 770 | } | |
| 771 | ], | |
| 772 | post Data: { | |
| 773 | mi meType: 'a pplication /x-www-for m-urlencod ed', | |
| 774 | pa rams: [ | |
| 775 | { | |
| 776 | name: 'f oo', | |
| 777 | value: ' bar' | |
| 778 | }, | |
| 779 | { | |
| 780 | name: 'h ello', | |
| 781 | value: ' world' | |
| 782 | } | |
| 783 | ] | |
| 784 | } | |
| 785 | } | |
| 786 | }) | |
| 787 | ||
| 788 | // a POS T request will be se nt to http ://www.moc kbin.com | |
| 789 | // with body an ap plication/ x-www-form -urlencode d body: | |
| 790 | // foo=b ar&hello=w orld | |
| 791 | ``` | |
| 792 | ||
| 793 | [back to t op](#table -of-conten ts) | |
| 794 | ||
| 795 | ||
| 796 | --- | |
| 797 | ||
| 798 | ## request (options, callback) | |
| 799 | ||
| 800 | The first argument c an be eith er a `url` or an `op tions` obj ect. The o nly requir ed option is `uri`; all others are optio nal. | |
| 801 | ||
| 802 | - `uri` || `url` - f ully quali fied uri o r a parsed url objec t from `ur l.parse()` | |
| 803 | - `baseUrl ` - fully qualified uri string used as t he base ur l. Most us eful with `request.d efaults`, for exampl e when you want to d o many req uests to t he same do main. If `baseUrl` is `https: //example. com/api/`, then requ esting `/e nd/point?t est=true` will fetch `https:// example.co m/api/end/ point?test =true`. Wh en `baseUr l` is give n, `uri` m ust also b e a string . | |
| 804 | - `method` - http me thod (defa ult: `"GET "`) | |
| 805 | - `headers ` - http h eaders (de fault: `{} `) | |
| 806 | ||
| 807 | --- | |
| 808 | ||
| 809 | - `qs` - o bject cont aining que rystring v alues to b e appended to the `u ri` | |
| 810 | - `qsParse Options` - object co ntaining o ptions to pass to th e [qs.pars e](https:/ /github.co m/hapijs/q s#parsing- objects) m ethod. Alt ernatively pass opti ons to the [querystr ing.parse] (https://n odejs.org/ docs/v0.12 .0/api/que rystring.h tml#querys tring_quer ystring_pa rse_str_se p_eq_optio ns) method using thi s format ` {sep:';', eq:':', op tions:{}}` | |
| 811 | - `qsStrin gifyOption s` - objec t containi ng options to pass t o the [qs. stringify] (https://g ithub.com/ hapijs/qs# stringifyi ng) method . Alternat ively pass options t o the [qu erystring. stringify] (https://n odejs.org/ docs/v0.12 .0/api/que rystring.h tml#querys tring_quer ystring_st ringify_ob j_sep_eq_o ptions) me thod using this form at `{sep:' ;', eq:':' , options: {}}`. For example, t o change t he way arr ays are co nverted to query str ings using the `qs` module pas s the `arr ayFormat` option wit h one of ` indices|br ackets|rep eat` | |
| 812 | - `useQuer ystring` - If true, use `query string` to stringify and parse | |
| 813 | querystr ings, othe rwise use `qs` (defa ult: `fals e`). Set this optio n to | |
| 814 | `true` i f you need arrays to be serial ized as `f oo=bar&foo =baz` inst ead of the | |
| 815 | default `foo[0]=ba r&foo[1]=b az`. | |
| 816 | ||
| 817 | --- | |
| 818 | ||
| 819 | - `body` - entity bo dy for PAT CH, POST a nd PUT req uests. Mus t be a `Bu ffer`, `St ring` or ` ReadStream `. If `jso n` is `tru e`, then ` body` must be a JSON -serializa ble object . | |
| 820 | - `form` - when pass ed an obje ct or a qu erystring, this sets `body` to a queryst ring repre sentation of value, and adds ` Content-ty pe: applic ation/x-ww w-form-url encoded` h eader. Whe n passed n o options, a `FormDa ta` instan ce is retu rned (and is piped t o request) . See "For ms" sectio n above. | |
| 821 | - `formDat a` - Data to pass fo r a `multi part/form- data` requ est. See | |
| 822 | [Forms]( #forms) se ction abov e. | |
| 823 | - `multipa rt` - arra y of objec ts which c ontain the ir own hea ders and ` body` | |
| 824 | attribut es. Sends a `multipa rt/related ` request. See [Form s](#forms) section | |
| 825 | above. | |
| 826 | - Altern atively yo u can pass in an obj ect `{chun ked: false , data: [] }` where | |
| 827 | `chunk ed` is use d to speci fy whether the reque st is sent in | |
| 828 | [chunk ed transfe r encoding ](https:// en.wikiped ia.org/wik i/Chunked_ transfer_e ncoding) | |
| 829 | In non -chunked r equests, d ata items with body streams ar e not allo wed. | |
| 830 | - `preambl eCRLF` - a ppend a ne wline/CRLF before th e boundary of your ` multipart/ form-data` request. | |
| 831 | - `postamb leCRLF` - append a n ewline/CRL F at the e nd of the boundary o f your `mu ltipart/fo rm-data` r equest. | |
| 832 | - `json` - sets `bod y` to JSON represent ation of v alue and a dds `Conte nt-type: a pplication /json` hea der. Addi tionally, parses the response body as JS ON. | |
| 833 | - `jsonRev iver` - a [reviver f unction](h ttps://dev eloper.moz illa.org/e n-US/docs/ Web/JavaSc ript/Refer ence/Globa l_Objects/ JSON/parse ) that wil l be passe d to `JSON .parse()` when parsi ng a JSON response b ody. | |
| 834 | - `jsonRep lacer` - a [replacer function] (https://d eveloper.m ozilla.org /en-US/doc s/Web/Java Script/Ref erence/Glo bal_Object s/JSON/str ingify) th at will be passed to `JSON.str ingify()` when strin gifying a JSON reque st body. | |
| 835 | ||
| 836 | --- | |
| 837 | ||
| 838 | - `auth` - A hash co ntaining v alues `use r` || `use rname`, `p ass` || `p assword`, and `sendI mmediately ` (optiona l). See d ocumentati on above. | |
| 839 | - `oauth` - Options for OAuth HMAC-SHA1 signing. S ee documen tation abo ve. | |
| 840 | - `hawk` - Options f or [Hawk s igning](ht tps://gith ub.com/hue niverse/ha wk). The ` credential s` key mus t contain the necess ary signin g info, [s ee hawk do cs for det ails](http s://github .com/hueni verse/hawk #usage-exa mple). | |
| 841 | - `aws` - `object` c ontaining AWS signin g informat ion. Shoul d have the propertie s `key`, ` secret`. A lso requir es the pro perty `buc ket`, unle ss you’r e specifyi ng your `b ucket` as part of th e path, or the reque st doesn†™t use a b ucket (i.e . GET Serv ices). If you want t o use AWS sign versi on 4 use t he paramet er `sign_v ersion` wi th value ` 4` otherwi se the def ault is ve rsion 2. * *Note:** y ou need to `npm inst all aws4` first. | |
| 842 | - `httpSig nature` - Options fo r the [HTT P Signatur e Scheme]( https://gi thub.com/j oyent/node -http-sign ature/blob /master/ht tp_signing .md) using [Joyent's library]( https://gi thub.com/j oyent/node -http-sign ature). Th e `keyId` and `key` properties must be s pecified. See the do cs for oth er options . | |
| 843 | ||
| 844 | --- | |
| 845 | ||
| 846 | - `followR edirect` - follow HT TP 3xx res ponses as redirects (default: `true`). T his proper ty can als o be imple mented as function w hich gets `response` object as a single argument a nd should return `tr ue` if red irects sho uld contin ue or `fal se` otherw ise. | |
| 847 | - `followA llRedirect s` - follo w non-GET HTTP 3xx r esponses a s redirect s (default : `false`) | |
| 848 | - `maxRedi rects` - t he maximum number of redirects to follow (default: `10`) | |
| 849 | - `removeR efererHead er` - remo ves the re ferer head er when a redirect h appens (de fault: `fa lse`). **N ote:** if true, refe rer header set in th e initial request is preserved during re direct cha in. | |
| 850 | ||
| 851 | --- | |
| 852 | ||
| 853 | - `encodin g` - Encod ing to be used on `s etEncoding ` of respo nse data. If `null`, the `body ` is retur ned as a ` Buffer`. A nything el se **(incl uding the default va lue of `un defined`)* * will be passed as the [encod ing](http: //nodejs.o rg/api/buf fer.html#b uffer_buff er) parame ter to `to String()` (meaning t his is eff ectively ` utf8` by d efault). ( **Note:** if you exp ect binary data, you should se t `encodin g: null`.) | |
| 854 | - `gzip` - If `true` , add an ` Accept-Enc oding` hea der to req uest compr essed cont ent encodi ngs from t he server (if not al ready pres ent) and d ecode supp orted cont ent encodi ngs in the response. **Note:* * Automati c decoding of the re sponse con tent is pe rformed on the body data retur ned throug h `request ` (both th rough the `request` stream and passed to the callb ack functi on) but is not perfo rmed on th e `respons e` stream (available from the `response` event) wh ich is the unmodifie d `http.In comingMess age` objec t which ma y contain compressed data. See example b elow. | |
| 855 | - `jar` - If `true`, remember cookies fo r future u se (or def ine your c ustom cook ie jar; se e examples section) | |
| 856 | ||
| 857 | --- | |
| 858 | ||
| 859 | - `agent` - `http(s) .Agent` in stance to use | |
| 860 | - `agentCl ass` - alt ernatively specify y our agent' s class na me | |
| 861 | - `agentOp tions` - a nd pass it s options. **Note:** for HTTPS see [tls API doc fo r TLS/SSL options](h ttp://node js.org/api /tls.html# tls_tls_co nnect_opti ons_callba ck) and th e [documen tation abo ve](#using -optionsag entoptions ). | |
| 862 | - `forever ` - set to `true` to use the [ forever-ag ent](https ://github. com/reques t/forever- agent) **N ote:** Def aults to ` http(s).Ag ent({keepA live:true} )` in node 0.12+ | |
| 863 | - `pool` - An object describin g which ag ents to us e for the request. I f this opt ion is omi tted the r equest wil l use the global age nt (as lon g as your options al low for it ). Otherwi se, reques t will sea rch the po ol for you r custom a gent. If n o custom a gent is fo und, a new agent wil l be creat ed and add ed to the pool. **No te:** `poo l` is used only when the `agen t` option is not spe cified. | |
| 864 | - A `max Sockets` p roperty ca n also be provided o n the `poo l` object to set the max numbe r of socke ts for all agents cr eated (ex: `pool: {m axSockets: Infinity} `). | |
| 865 | - Note t hat if you are sendi ng multipl e requests in a loop and creat ing | |
| 866 | multip le new `po ol` object s, `maxSoc kets` will not work as intende d. To | |
| 867 | work a round this , either u se [`reque st.default s`](#reque stdefaults options) | |
| 868 | with y our pool o ptions or create the pool obje ct with th e `maxSock ets` | |
| 869 | proper ty outside of the lo op. | |
| 870 | - `timeout ` - Intege r containi ng the num ber of mil liseconds to wait fo r a | |
| 871 | server to send respo nse header s (and sta rt the res ponse body ) before a borting | |
| 872 | the reques t. Note th at if the underlying TCP conne ction cann ot be esta blished, | |
| 873 | the OS-wid e TCP conn ection tim eout will overrule t he `timeou t` option ([the | |
| 874 | default in Linux can be anywhe re from 20 -120 secon ds][linux- timeout]). | |
| 875 | ||
| 876 | [linux-tim eout]: htt p://www.se kuda.com/o verriding_ the_defaul t_linux_ke rnel_20_se cond_tcp_s ocket_conn ect_timeou t | |
| 877 | ||
| 878 | --- | |
| 879 | ||
| 880 | - `localAd dress` - L ocal inter face to bi nd for net work conne ctions. | |
| 881 | - `proxy` - An HTTP proxy to b e used. Su pports pro xy Auth wi th Basic A uth, ident ical to su pport for the `url` parameter (by embedd ing the au th info in the `uri` ) | |
| 882 | - `strictS SL` - If ` true`, req uires SSL certificat es be vali d. **Note: ** to use your own c ertificate authority , you need to specif y an agent that was created wi th that CA as an opt ion. | |
| 883 | - `tunnel` - control s the beha vior of | |
| 884 | [HTTP `C ONNECT` tu nneling](h ttps://en. wikipedia. org/wiki/H TTP_tunnel #HTTP_CONN ECT_tunnel ing) | |
| 885 | as follo ws: | |
| 886 | - `unde fined` (de fault) - ` true` if t he destina tion is `h ttps`, `fa lse` other wise | |
| 887 | - `true ` - always tunnel to the desti nation by making a ` CONNECT` r equest to | |
| 888 | the p roxy | |
| 889 | - `fals e` - reque st the des tination a s a `GET` request. | |
| 890 | - `proxyHe aderWhiteL ist` - A w hitelist o f headers to send to a | |
| 891 | tunnelin g proxy. | |
| 892 | - `proxyHe aderExclus iveList` - A whiteli st of head ers to sen d | |
| 893 | exclusiv ely to a t unneling p roxy and n ot to dest ination. | |
| 894 | ||
| 895 | --- | |
| 896 | ||
| 897 | - `time` - If `true` , the requ est-respon se cycle ( including all redire cts) is ti med at mil lisecond r esolution, and the r esult prov ided on th e response 's `elapse dTime` pro perty. | |
| 898 | - `har` - A [HAR 1.2 Request O bject](htt p://www.so ftwareisha rd.com/blo g/har-12-s pec/#reque st), will be process ed from HA R format i nto option s overwrit ing matchi ng values *(see the [HAR 1.2 s ection](#s upport-for -har-1.2) for detail s)* | |
| 899 | ||
| 900 | The callba ck argumen t gets 3 a rguments: | |
| 901 | ||
| 902 | 1. An `err or` when a pplicable (usually f rom [`http .ClientReq uest`](htt p://nodejs .org/api/h ttp.html#h ttp_class_ http_clien trequest) object) | |
| 903 | 2. An [`ht tp.Incomin gMessage`] (http://no dejs.org/a pi/http.ht ml#http_ht tp_incomin gmessage) object | |
| 904 | 3. The thi rd is the `response` body (`St ring` or ` Buffer`, o r JSON obj ect if the `json` op tion is su pplied) | |
| 905 | ||
| 906 | [back to t op](#table -of-conten ts) | |
| 907 | ||
| 908 | ||
| 909 | --- | |
| 910 | ||
| 911 | ## Conveni ence metho ds | |
| 912 | ||
| 913 | There are also short hand metho ds for dif ferent HTT P METHODs and some o ther conve niences. | |
| 914 | ||
| 915 | ||
| 916 | ### reques t.defaults (options) | |
| 917 | ||
| 918 | This metho d **return s a wrappe r** around the norma l request API that d efaults | |
| 919 | to whateve r options you pass t o it. | |
| 920 | ||
| 921 | **Note:** `request.d efaults()` **does no t** modify the globa l request API; | |
| 922 | instead, i t **return s a wrappe r** that h as your de fault sett ings appli ed to it. | |
| 923 | ||
| 924 | **Note:** You can ca ll `.defau lts()` on the wrappe r that is returned f rom | |
| 925 | `request.d efaults` t o add/over ride defau lts that w ere previo usly defau lted. | |
| 926 | ||
| 927 | For exampl e: | |
| 928 | ```js | |
| 929 | //requests using bas eRequest() will set the 'x-tok en' header | |
| 930 | var baseRe quest = re quest.defa ults({ | |
| 931 | headers: {'x-token ': 'my-tok en'} | |
| 932 | }) | |
| 933 | ||
| 934 | //requests using spe cialReques t() will i nclude the 'x-token' header se t in | |
| 935 | //baseRequ est and wi ll also in clude the 'special' header | |
| 936 | var specia lRequest = baseReque st.default s({ | |
| 937 | headers: {special: 'special value'} | |
| 938 | }) | |
| 939 | ``` | |
| 940 | ||
| 941 | ### reques t.put | |
| 942 | ||
| 943 | Same as `r equest()`, but defau lts to `me thod: "PUT "`. | |
| 944 | ||
| 945 | ```js | |
| 946 | request.pu t(url) | |
| 947 | ``` | |
| 948 | ||
| 949 | ### reques t.patch | |
| 950 | ||
| 951 | Same as `r equest()`, but defau lts to `me thod: "PAT CH"`. | |
| 952 | ||
| 953 | ```js | |
| 954 | request.pa tch(url) | |
| 955 | ``` | |
| 956 | ||
| 957 | ### reques t.post | |
| 958 | ||
| 959 | Same as `r equest()`, but defau lts to `me thod: "POS T"`. | |
| 960 | ||
| 961 | ```js | |
| 962 | request.po st(url) | |
| 963 | ``` | |
| 964 | ||
| 965 | ### reques t.head | |
| 966 | ||
| 967 | Same as `r equest()`, but defau lts to `me thod: "HEA D"`. | |
| 968 | ||
| 969 | ```js | |
| 970 | request.he ad(url) | |
| 971 | ``` | |
| 972 | ||
| 973 | ### reques t.del | |
| 974 | ||
| 975 | Same as `r equest()`, but defau lts to `me thod: "DEL ETE"`. | |
| 976 | ||
| 977 | ```js | |
| 978 | request.de l(url) | |
| 979 | ``` | |
| 980 | ||
| 981 | ### reques t.get | |
| 982 | ||
| 983 | Same as `r equest()` (for unifo rmity). | |
| 984 | ||
| 985 | ```js | |
| 986 | request.ge t(url) | |
| 987 | ``` | |
| 988 | ### reques t.cookie | |
| 989 | ||
| 990 | Function t hat create s a new co okie. | |
| 991 | ||
| 992 | ```js | |
| 993 | request.co okie('key1 =value1') | |
| 994 | ``` | |
| 995 | ### reques t.jar() | |
| 996 | ||
| 997 | Function t hat create s a new co okie jar. | |
| 998 | ||
| 999 | ```js | |
| 1000 | request.ja r() | |
| 1001 | ``` | |
| 1002 | ||
| 1003 | [back to t op](#table -of-conten ts) | |
| 1004 | ||
| 1005 | ||
| 1006 | --- | |
| 1007 | ||
| 1008 | ||
| 1009 | ## Debuggi ng | |
| 1010 | ||
| 1011 | There are at least t hree ways to debug t he operati on of `req uest`: | |
| 1012 | ||
| 1013 | 1. Launch the node p rocess lik e `NODE_DE BUG=reques t node scr ipt.js` | |
| 1014 | (`lib,r equest,oth erlib` wor ks too). | |
| 1015 | ||
| 1016 | 2. Set `re quire('req uest').deb ug = true` at any ti me (this d oes the sa me thing | |
| 1017 | as #1). | |
| 1018 | ||
| 1019 | 3. Use the [request- debug modu le](https: //github.c om/request /request-d ebug) to | |
| 1020 | view re quest and response h eaders and bodies. | |
| 1021 | ||
| 1022 | [back to t op](#table -of-conten ts) | |
| 1023 | ||
| 1024 | ||
| 1025 | --- | |
| 1026 | ||
| 1027 | ## Timeout s | |
| 1028 | ||
| 1029 | Most reque sts to ext ernal serv ers should have a ti meout atta ched, in c ase the | |
| 1030 | server is not respon ding in a timely man ner. Witho ut a timeo ut, your c ode may | |
| 1031 | have a soc ket open/c onsume res ources for minutes o r more. | |
| 1032 | ||
| 1033 | There are two main t ypes of ti meouts: ** connection timeouts* * and **re ad | |
| 1034 | timeouts** . A connec t timeout occurs if the timeou t is hit w hile your client is | |
| 1035 | attempting to establ ish a conn ection to a remote m achine (co rrespondin g to the | |
| 1036 | [connect() call][con nect] on t he socket) . A read t imeout occ urs any ti me the | |
| 1037 | server is too slow t o send bac k a part o f the resp onse. | |
| 1038 | ||
| 1039 | These two situations have wide ly differe nt implica tions for what went wrong | |
| 1040 | with the r equest, so it's usef ul to be a ble to dis tinguish t hem. You c an detect | |
| 1041 | timeout er rors by ch ecking `er r.code` fo r an 'ETIM EDOUT' val ue. Furthe r, you | |
| 1042 | can detect whether t he timeout was a con nection ti meout by c hecking if the | |
| 1043 | `err.conne ct` proper ty is set to `true`. | |
| 1044 | ||
| 1045 | ```js | |
| 1046 | request.ge t('http:// IP ', {timeou t: 1500}, function(e rr) { | |
| 1047 | consol e.log(err. code === ' ETIMEDOUT' ); | |
| 1048 | // Set to `true` if the ti meout was a connecti on timeout , `false` or | |
| 1049 | // `un defined` o therwise. | |
| 1050 | consol e.log(err. connect == = true); | |
| 1051 | proces s.exit(0); | |
| 1052 | }); | |
| 1053 | ``` | |
| 1054 | ||
| 1055 | [connect]: http://li nux.die.ne t/man/2/co nnect | |
| 1056 | ||
| 1057 | ## Example s: | |
| 1058 | ||
| 1059 | ```js | |
| 1060 | var requ est = requ ire('reque st') | |
| 1061 | , rand = Math.fl oor(Math.r andom()*10 0000000).t oString() | |
| 1062 | ; | |
| 1063 | request( | |
| 1064 | { meth od: 'PUT' | |
| 1065 | , uri: 'http://m ikeal.iris couch.com/ testjs/' + rand | |
| 1066 | , mult ipart: | |
| 1067 | [ { 'content-t ype': 'app lication/j son' | |
| 1068 | , body: JSO N.stringif y({foo: 'b ar', _atta chments: { 'message.t xt': {foll ows: true, length: 1 8, 'conten t_type': ' text/plain ' }}}) | |
| 1069 | } | |
| 1070 | , { body: 'I a m an attac hment' } | |
| 1071 | ] | |
| 1072 | } | |
| 1073 | , functi on (error, response, body) { | |
| 1074 | if(r esponse.st atusCode = = 201){ | |
| 1075 | co nsole.log( 'document saved as: http://mik eal.irisco uch.com/te stjs/'+ ra nd) | |
| 1076 | } el se { | |
| 1077 | co nsole.log( 'error: '+ response. statusCode ) | |
| 1078 | co nsole.log( body) | |
| 1079 | } | |
| 1080 | } | |
| 1081 | ) | |
| 1082 | ``` | |
| 1083 | ||
| 1084 | For backwa rds-compat ibility, r esponse co mpression is not sup ported by default. | |
| 1085 | To accept gzip-compr essed resp onses, set the `gzip ` option t o `true`. Note | |
| 1086 | that the b ody data p assed thro ugh `reque st` is aut omatically decompres sed | |
| 1087 | while the response o bject is u nmodified and will c ontain com pressed da ta if | |
| 1088 | the server sent a co mpressed r esponse. | |
| 1089 | ||
| 1090 | ```js | |
| 1091 | var requ est = requ ire('reque st') | |
| 1092 | request( | |
| 1093 | { meth od: 'GET' | |
| 1094 | , uri: 'http://w ww.google. com' | |
| 1095 | , gzip : true | |
| 1096 | } | |
| 1097 | , functi on (error, response, body) { | |
| 1098 | // b ody is the decompres sed respon se body | |
| 1099 | cons ole.log('s erver enco ded the da ta as: ' + (response .headers[' content-en coding'] | | 'identit y')) | |
| 1100 | cons ole.log('t he decoded data is: ' + body) | |
| 1101 | } | |
| 1102 | ).on('da ta', funct ion(data) { | |
| 1103 | // dec ompressed data as it is receiv ed | |
| 1104 | consol e.log('dec oded chunk : ' + data ) | |
| 1105 | }) | |
| 1106 | .on('res ponse', fu nction(res ponse) { | |
| 1107 | // unm odified ht tp.Incomin gMessage o bject | |
| 1108 | respon se.on('dat a', functi on(data) { | |
| 1109 | // c ompressed data as it is receiv ed | |
| 1110 | cons ole.log('r eceived ' + data.len gth + ' by tes of com pressed da ta') | |
| 1111 | }) | |
| 1112 | }) | |
| 1113 | ``` | |
| 1114 | ||
| 1115 | Cookies ar e disabled by defaul t (else, t hey would be used in subsequen t requests ). To enab le cookies , set `jar ` to `true ` (either in `defaul ts` or `op tions`). | |
| 1116 | ||
| 1117 | ```js | |
| 1118 | var reques t = reques t.defaults ({jar: tru e}) | |
| 1119 | request('h ttp://www. google.com ', functio n () { | |
| 1120 | request( 'http://im ages.googl e.com') | |
| 1121 | }) | |
| 1122 | ``` | |
| 1123 | ||
| 1124 | To use a c ustom cook ie jar (in stead of ` request`†™s global cookie jar ), set `ja r` to an i nstance of `request. jar()` (ei ther in `d efaults` o r `options `) | |
| 1125 | ||
| 1126 | ```js | |
| 1127 | var j = re quest.jar( ) | |
| 1128 | var reques t = reques t.defaults ({jar:j}) | |
| 1129 | request('h ttp://www. google.com ', functio n () { | |
| 1130 | request( 'http://im ages.googl e.com') | |
| 1131 | }) | |
| 1132 | ``` | |
| 1133 | ||
| 1134 | OR | |
| 1135 | ||
| 1136 | ```js | |
| 1137 | var j = re quest.jar( ); | |
| 1138 | var cookie = request .cookie('k ey1=value1 '); | |
| 1139 | var url = 'http://ww w.google.c om'; | |
| 1140 | j.setCooki e(cookie, url); | |
| 1141 | request({u rl: url, j ar: j}, fu nction () { | |
| 1142 | request( 'http://im ages.googl e.com') | |
| 1143 | }) | |
| 1144 | ``` | |
| 1145 | ||
| 1146 | To use a c ustom cook ie store ( such as a | |
| 1147 | [`FileCook ieStore`]( https://gi thub.com/m itsuru/tou gh-cookie- filestore) | |
| 1148 | which supp orts savin g to and r estoring f rom JSON f iles), pas s it as a parameter | |
| 1149 | to `reques t.jar()`: | |
| 1150 | ||
| 1151 | ```js | |
| 1152 | var FileCo okieStore = require( 'tough-coo kie-filest ore'); | |
| 1153 | // NOTE - currently the 'cooki es.json' f ile must a lready exi st! | |
| 1154 | var j = re quest.jar( new FileCo okieStore( 'cookies.j son')); | |
| 1155 | request = request.de faults({ j ar : j }) | |
| 1156 | request('h ttp://www. google.com ', functio n() { | |
| 1157 | request( 'http://im ages.googl e.com') | |
| 1158 | }) | |
| 1159 | ``` | |
| 1160 | ||
| 1161 | The cookie store mus t be a | |
| 1162 | [`tough-co okie`](htt ps://githu b.com/Sale sforceEng/ tough-cook ie) | |
| 1163 | store and it must su pport sync hronous op erations; see the | |
| 1164 | [`CookieSt ore` API d ocs](https ://github. com/Salesf orceEng/to ugh-cookie #cookiesto re-api) | |
| 1165 | for detail s. | |
| 1166 | ||
| 1167 | To inspect your cook ie jar aft er a reque st: | |
| 1168 | ||
| 1169 | ```js | |
| 1170 | var j = re quest.jar( ) | |
| 1171 | request({u rl: 'http: //www.goog le.com', j ar: j}, fu nction () { | |
| 1172 | var cook ie_string = j.getCoo kieString( url); // " key1=value 1; key2=va lue2; ..." | |
| 1173 | var cook ies = j.ge tCookies(u rl); | |
| 1174 | // [{key : 'key1', value: 'va lue1', dom ain: "www. google.com ", ...}, . ..] | |
| 1175 | }) | |
| 1176 | ``` | |
| 1177 | ||
| 1178 | [back to t op](#table -of-conten ts) | |
| 1179 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000pac kage/LICEN SE\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000000 664 \x000000175 0 \x0000001750 \x0000000002166 4 \x00001267642 3610\x000001156 0 \x00000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000ustar\x0000 00\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x00000000 00 \x0000000000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000A pache Lice nse | |
| 1180 | ||
| 1181 | Version 2. 0, January 2004 | |
| 1182 | ||
| 1183 | http://www .apache.or g/licenses / | |
| 1184 | ||
| 1185 | TERMS AND CONDITIONS FOR USE, REPRODUCTI ON, AND DI STRIBUTION | |
| 1186 | ||
| 1187 | 1. Definit ions. | |
| 1188 | ||
| 1189 | "License" shall mean the terms and condi tions for use, repro duction, a nd distrib ution as d efined by Sections 1 through 9 of this d ocument. | |
| 1190 | ||
| 1191 | "Licensor" shall mea n the copy right owne r or entit y authoriz ed by the copyright owner that is granti ng the Lic ense. | |
| 1192 | ||
| 1193 | "Legal Ent ity" shall mean the union of t he acting entity and all other entities that contr ol, are co ntrolled b y, or are under comm on control with that entity. F or the pur poses of t his defini tion, "con trol" mean s (i) the power, dir ect or ind irect, to cause the direction or managem ent of suc h entity, whether by contract or otherwi se, or (ii ) ownershi p of fifty percent ( 50%) or mo re of the outstandin g shares, or (iii) b eneficial ownership of such en tity. | |
| 1194 | ||
| 1195 | "You" (or "Your") sh all mean a n individu al or Lega l Entity e xercising permission s granted by this Li cense. | |
| 1196 | ||
| 1197 | "Source" f orm shall mean the p referred f orm for ma king modif ications, including but not li mited to s oftware so urce code, documenta tion sourc e, and con figuration files. | |
| 1198 | ||
| 1199 | "Object" f orm shall mean any f orm result ing from m echanical transforma tion or tr anslation of a Sourc e form, in cluding bu t not limi ted to com piled obje ct code, g enerated d ocumentati on, and co nversions to other m edia types . | |
| 1200 | ||
| 1201 | "Work" sha ll mean th e work of authorship , whether in Source or Object form, made available under the License, as indicat ed by a co pyright no tice that is include d in or at tached to the work ( an example is provid ed in the Appendix b elow). | |
| 1202 | ||
| 1203 | "Derivativ e Works" s hall mean any work, whether in Source or Object fo rm, that i s based on (or deriv ed from) t he Work an d for whic h the edit orial revi sions, ann otations, elaboratio ns, or oth er modific ations rep resent, as a whole, an origina l work of authorship . For the purposes o f this Lic ense, Deri vative Wor ks shall n ot include works tha t remain s eparable f rom, or me rely link (or bind b y name) to the inter faces of, the Work a nd Derivat ive Works thereof. | |
| 1204 | ||
| 1205 | "Contribut ion" shall mean any work of au thorship, including the origin al version of the Wo rk and any modificat ions or ad ditions to that Work or Deriva tive Works thereof, that is in tentionall y submitte d to Licen sor for in clusion in the Work by the cop yright own er or by a n individu al or Lega l Entity a uthorized to submit on behalf of the cop yright own er. For th e purposes of this d efinition, "submitte d" means a ny form of electroni c, verbal, or writte n communic ation sent to the Li censor or its repres entatives, including but not l imited to communicat ion on ele ctronic ma iling list s, source code contr ol systems , and issu e tracking systems t hat are ma naged by, or on beha lf of, the Licensor for the pu rpose of d iscussing and improv ing the Wo rk, but ex cluding co mmunicatio n that is conspicuou sly marked or otherw ise design ated in wr iting by t he copyrig ht owner a s "Not a C ontributio n." | |
| 1206 | ||
| 1207 | "Contribut or" shall mean Licen sor and an y individu al or Lega l Entity o n behalf o f whom a C ontributio n has been received by Licenso r and subs equently i ncorporate d within t he Work. | |
| 1208 | ||
| 1209 | 2. Grant o f Copyrigh t License. Subject t o the term s and cond itions of this Licen se, each C ontributor hereby gr ants to Yo u a perpet ual, world wide, non- exclusive, no-charge , royalty- free, irre vocable co pyright li cense to r eproduce, prepare De rivative W orks of, p ublicly di splay, pub licly perf orm, subli cense, and distribut e the Work and such Derivative Works in Source or Object for m. | |
| 1210 | ||
| 1211 | 3. Grant o f Patent L icense. Su bject to t he terms a nd conditi ons of thi s License, each Cont ributor he reby grant s to You a perpetual , worldwid e, non-exc lusive, no -charge, r oyalty-fre e, irrevoc able (exce pt as stat ed in this section) patent lic ense to ma ke, have m ade, use, offer to s ell, sell, import, a nd otherwi se transfe r the Work , where su ch license applies o nly to tho se patent claims lic ensable by such Cont ributor th at are nec essarily i nfringed b y their Co ntribution (s) alone or by comb ination of their Con tribution( s) with th e Work to which such Contribut ion(s) was submitted . If You i nstitute p atent liti gation aga inst any e ntity (inc luding a c ross-claim or counte rclaim in a lawsuit) alleging that the W ork or a C ontributio n incorpor ated withi n the Work constitut es direct or contrib utory pate nt infring ement, the n any pate nt license s granted to You und er this Li cense for that Work shall term inate as o f the date such liti gation is filed. | |
| 1212 | ||
| 1213 | 4. Redistr ibution. Y ou may rep roduce and distribut e copies o f the Work or Deriva tive Works thereof i n any medi um, with o r without modificati ons, and i n Source o r Object f orm, provi ded that Y ou meet th e followin g conditio ns: | |
| 1214 | ||
| 1215 | You must g ive any ot her recipi ents of th e Work or Derivative Works a c opy of thi s License; and | |
| 1216 | ||
| 1217 | You must c ause any m odified fi les to car ry promine nt notices stating t hat You ch anged the files; and | |
| 1218 | ||
| 1219 | You must r etain, in the Source form of a ny Derivat ive Works that You d istribute, all copyr ight, pate nt, tradem ark, and a ttribution notices f rom the So urce form of the Wor k, excludi ng those n otices tha t do not p ertain to any part o f the Deri vative Wor ks; and | |
| 1220 | ||
| 1221 | If the Wor k includes a "NOTICE " text fil e as part of its dis tribution, then any Derivative Works tha t You dist ribute mus t include a readable copy of t he attribu tion notic es contain ed within such NOTIC E file, ex cluding th ose notice s that do not pertai n to any p art of the Derivativ e Works, i n at least one of th e followin g places: within a N OTICE text file dist ributed as part of t he Derivat ive Works; within th e Source f orm or doc umentation , if provi ded along with the D erivative Works; or, within a display ge nerated by the Deriv ative Work s, if and wherever s uch third- party noti ces normal ly appear. The conte nts of the NOTICE fi le are for informati onal purpo ses only a nd do not modify the License. You may ad d Your own attributi on notices within De rivative W orks that You distri bute, alon gside or a s an adden dum to the NOTICE te xt from th e Work, pr ovided tha t such add itional at tribution notices ca nnot be co nstrued as modifying the Licen se. You ma y add Your own copyr ight state ment to Yo ur modific ations and may provi de additio nal or dif ferent lic ense terms and condi tions for use, repro duction, o r distribu tion of Yo ur modific ations, or for any s uch Deriva tive Works as a whol e, provide d Your use , reproduc tion, and distributi on of the Work other wise compl ies with t he conditi ons stated in this L icense. | |
| 1222 | ||
| 1223 | 5. Submiss ion of Con tributions . Unless Y ou explici tly state otherwise, any Contr ibution in tentionall y submitte d for incl usion in t he Work by You to th e Licensor shall be under the terms and conditions of this L icense, wi thout any additional terms or conditions . Notwiths tanding th e above, n othing her ein shall supersede or modify the terms of any sep arate lice nse agreem ent you ma y have exe cuted with Licensor regarding such Contr ibutions. | |
| 1224 | ||
| 1225 | 6. Tradema rks. This License do es not gra nt permiss ion to use the trade names, tr ademarks, service ma rks, or pr oduct name s of the L icensor, e xcept as r equired fo r reasonab le and cus tomary use in descri bing the o rigin of t he Work an d reproduc ing the co ntent of t he NOTICE file. | |
| 1226 | ||
| 1227 | 7. Disclai mer of War ranty. Unl ess requir ed by appl icable law or agreed to in wri ting, Lice nsor provi des the Wo rk (and ea ch Contrib utor provi des its Co ntribution s) on an " AS IS" BAS IS, WITHOU T WARRANTI ES OR COND ITIONS OF ANY KIND, either exp ress or im plied, inc luding, wi thout limi tation, an y warranti es or cond itions of TITLE, NON -INFRINGEM ENT, MERCH ANTABILITY , or FITNE SS FOR A P ARTICULAR PURPOSE. Y ou are sol ely respon sible for determinin g the appr opriatenes s of using or redist ributing t he Work an d assume a ny risks a ssociated with Your exercise o f permissi ons under this Licen se. | |
| 1228 | ||
| 1229 | 8. Limitat ion of Lia bility. In no event and under no legal t heory, whe ther in to rt (includ ing neglig ence), con tract, or otherwise, unless re quired by applicable law (such as delibe rate and g rossly neg ligent act s) or agre ed to in w riting, sh all any Co ntributor be liable to You for damages, including any direct , indirect , special, incidenta l, or cons equential damages of any chara cter arisi ng as a re sult of th is License or out of the use o r inabilit y to use t he Work (i ncluding b ut not lim ited to da mages for loss of go odwill, wo rk stoppag e, compute r failure or malfunc tion, or a ny and all other com mercial da mages or l osses), ev en if such Contribut or has bee n advised of the pos sibility o f such dam ages. | |
| 1230 | ||
| 1231 | 9. Accepti ng Warrant y or Addit ional Liab ility. Whi le redistr ibuting th e Work or Derivative Works the reof, You may choose to offer, and charg e a fee fo r, accepta nce of sup port, warr anty, inde mnity, or other liab ility obli gations an d/or right s consiste nt with th is License . However, in accept ing such o bligations , You may act only o n Your own behalf an d on Your sole respo nsibility, not on be half of an y other Co ntributor, and only if You agr ee to inde mnify, def end, and h old each C ontributor harmless for any li ability in curred by, or claims asserted against, s uch Contri butor by r eason of y our accept ing any su ch warrant y or addit ional liab ility. | |
| 1232 | ||
| 1233 | END OF TER MS AND CON DITIONS\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000package /index.js\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000000775 \x0000001750 \x00000 01750 \x0000000 0007661 \x00001 2676423610 \x0000012224 \x00000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 ustar\x000000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000000000 \x0000 000000 \x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000// Co pyright 20 10-2012 Mi keal Roger s | |
| 1234 | // | |
| 1235 | // Lice nsed under the Apach e License, Version 2 .0 (the "L icense"); | |
| 1236 | // you may not us e this fil e except i n complian ce with th e License. | |
| 1237 | // You may obtain a copy of the Licen se at | |
| 1238 | // | |
| 1239 | // http://www .apache.or g/licenses /LICENSE-2 .0 | |
| 1240 | // | |
| 1241 | // Unle ss require d by appli cable law or agreed to in writ ing, softw are | |
| 1242 | // dist ributed un der the Li cense is d istributed on an "AS IS" BASIS , | |
| 1243 | // WITH OUT WARRAN TIES OR CO NDITIONS O F ANY KIND , either e xpress or implied. | |
| 1244 | // See the Licens e for the specific l anguage go verning pe rmissions and | |
| 1245 | // limi tations un der the Li cense. | |
| 1246 | ||
| 1247 | 'use stric t' | |
| 1248 | ||
| 1249 | var extend = re quire('ext end') | |
| 1250 | , cookie s = re quire('./l ib/cookies ') | |
| 1251 | , helper s = re quire('./l ib/helpers ') | |
| 1252 | ||
| 1253 | var isFunc tion = he lpers.isFu nction | |
| 1254 | , params HaveReques tBody = he lpers.para msHaveRequ estBody | |
| 1255 | ||
| 1256 | ||
| 1257 | // organiz e params f or patch, post, put, head, del | |
| 1258 | function i nitParams( uri, optio ns, callba ck) { | |
| 1259 | if (type of options === 'func tion') { | |
| 1260 | callba ck = optio ns | |
| 1261 | } | |
| 1262 | ||
| 1263 | var para ms = {} | |
| 1264 | if (type of options === 'obje ct') { | |
| 1265 | extend (params, o ptions, {u ri: uri}) | |
| 1266 | } else i f (typeof uri === 's tring') { | |
| 1267 | extend (params, { uri: uri}) | |
| 1268 | } else { | |
| 1269 | extend (params, u ri) | |
| 1270 | } | |
| 1271 | ||
| 1272 | params.c allback = callback | |
| 1273 | return p arams | |
| 1274 | } | |
| 1275 | ||
| 1276 | function r equest (ur i, options , callback ) { | |
| 1277 | if (type of uri === 'undefine d') { | |
| 1278 | throw new Error( 'undefined is not a valid uri or options object.') | |
| 1279 | } | |
| 1280 | ||
| 1281 | var para ms = initP arams(uri, options, callback) | |
| 1282 | ||
| 1283 | if (para ms.method === 'HEAD' && params HaveReques tBody(para ms)) { | |
| 1284 | throw new Error( 'HTTP HEAD requests MUST NOT i nclude a r equest bod y.') | |
| 1285 | } | |
| 1286 | ||
| 1287 | return n ew request .Request(p arams) | |
| 1288 | } | |
| 1289 | ||
| 1290 | function v erbFunc (v erb) { | |
| 1291 | var meth od = verb === 'del' ? 'DELETE' : verb.to UpperCase( ) | |
| 1292 | return f unction (u ri, option s, callbac k) { | |
| 1293 | var pa rams = ini tParams(ur i, options , callback ) | |
| 1294 | params .method = method | |
| 1295 | return request(p arams, par ams.callba ck) | |
| 1296 | } | |
| 1297 | } | |
| 1298 | ||
| 1299 | // define like this to please codeintel/ intellisen se IDEs | |
| 1300 | request.ge t = verbFu nc('get') | |
| 1301 | request.he ad = verbF unc('head' ) | |
| 1302 | request.po st = verbF unc('post' ) | |
| 1303 | request.pu t = verbFu nc('put') | |
| 1304 | request.pa tch = verb Func('patc h') | |
| 1305 | request.de l = verbFu nc('del') | |
| 1306 | ||
| 1307 | request.ja r = functi on (store) { | |
| 1308 | return c ookies.jar (store) | |
| 1309 | } | |
| 1310 | ||
| 1311 | request.co okie = fun ction (str ) { | |
| 1312 | return c ookies.par se(str) | |
| 1313 | } | |
| 1314 | ||
| 1315 | function w rapRequest Method (me thod, opti ons, reque ster, verb ) { | |
| 1316 | ||
| 1317 | return f unction (u ri, opts, callback) { | |
| 1318 | var pa rams = ini tParams(ur i, opts, c allback) | |
| 1319 | ||
| 1320 | var ta rget = {} | |
| 1321 | extend (true, tar get, optio ns, params ) | |
| 1322 | ||
| 1323 | target .pool = pa rams.pool || options .pool | |
| 1324 | ||
| 1325 | if (ve rb) { | |
| 1326 | targ et.method = (verb == = 'del' ? 'DELETE' : verb.toUp perCase()) | |
| 1327 | } | |
| 1328 | ||
| 1329 | if (is Function(r equester)) { | |
| 1330 | meth od = reque ster | |
| 1331 | } | |
| 1332 | ||
| 1333 | return method(ta rget, targ et.callbac k) | |
| 1334 | } | |
| 1335 | } | |
| 1336 | ||
| 1337 | request.de faults = f unction (o ptions, re quester) { | |
| 1338 | var self = this | |
| 1339 | ||
| 1340 | options = options || {} | |
| 1341 | ||
| 1342 | if (type of options === 'func tion') { | |
| 1343 | reques ter = opti ons | |
| 1344 | option s = {} | |
| 1345 | } | |
| 1346 | ||
| 1347 | var defa ults = wrapRequ estMethod( self, opti ons, reque ster) | |
| 1348 | ||
| 1349 | var verb s = ['get' , 'head', 'post', 'p ut', 'patc h', 'del'] | |
| 1350 | verbs.fo rEach(func tion(verb) { | |
| 1351 | defaul ts[verb] = wrapRequ estMethod( self[verb] , options, requester , verb) | |
| 1352 | }) | |
| 1353 | ||
| 1354 | defaults .cookie = wrapRequ estMethod( self.cooki e, options , requeste r) | |
| 1355 | defaults .jar = self.jar | |
| 1356 | defaults .defaults = self.def aults | |
| 1357 | return d efaults | |
| 1358 | } | |
| 1359 | ||
| 1360 | request.fo rever = fu nction (ag entOptions , optionsA rg) { | |
| 1361 | var opti ons = {} | |
| 1362 | if (opti onsArg) { | |
| 1363 | extend (options, optionsArg ) | |
| 1364 | } | |
| 1365 | if (agen tOptions) { | |
| 1366 | option s.agentOpt ions = age ntOptions | |
| 1367 | } | |
| 1368 | ||
| 1369 | options. forever = true | |
| 1370 | return r equest.def aults(opti ons) | |
| 1371 | } | |
| 1372 | ||
| 1373 | // Exports | |
| 1374 | ||
| 1375 | module.exp orts = req uest | |
| 1376 | request.Re quest = re quire('./r equest') | |
| 1377 | request.in itParams = initParam s | |
| 1378 | ||
| 1379 | // Backwar ds compati bility for request.d ebug | |
| 1380 | Object.def inePropert y(request, 'debug', { | |
| 1381 | enumerab le : true, | |
| 1382 | get : fu nction() { | |
| 1383 | return request.R equest.deb ug | |
| 1384 | }, | |
| 1385 | set : fu nction(deb ug) { | |
| 1386 | reques t.Request. debug = de bug | |
| 1387 | } | |
| 1388 | }) | |
| 1389 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000p ackage/req uest.js\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x00000 00664 \x0000001 750 \x000000175 0 \x00000000116 075 \x000012703 170723\x0000012 575 \x00000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000usta r\x000000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x000000 0000 \x00000000 00 \x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000'use stri ct' | |
| 1390 | ||
| 1391 | var http = require(' http') | |
| 1392 | , https = require( 'https') | |
| 1393 | , url = require('u rl') | |
| 1394 | , util = require(' util') | |
| 1395 | , stream = require ('stream') | |
| 1396 | , zlib = require(' zlib') | |
| 1397 | , bl = r equire('bl ') | |
| 1398 | , hawk = require(' hawk') | |
| 1399 | , aws2 = require(' aws-sign2' ) | |
| 1400 | , httpSi gnature = require('h ttp-signat ure') | |
| 1401 | , mime = require(' mime-types ') | |
| 1402 | , string stream = r equire('st ringstream ') | |
| 1403 | , casele ss = requi re('casele ss') | |
| 1404 | , Foreve rAgent = r equire('fo rever-agen t') | |
| 1405 | , FormDa ta = requi re('form-d ata') | |
| 1406 | , extend = require ('extend') | |
| 1407 | , isstre am = requi re('isstre am') | |
| 1408 | , isType dArray = r equire('is -typedarra y').strict | |
| 1409 | , helper s = requir e('./lib/h elpers') | |
| 1410 | , cookie s = requir e('./lib/c ookies') | |
| 1411 | , getPro xyFromURI = require( './lib/get ProxyFromU RI') | |
| 1412 | , Querys tring = re quire('./l ib/queryst ring').Que rystring | |
| 1413 | , Har = require('. /lib/har') .Har | |
| 1414 | , Auth = require(' ./lib/auth ').Auth | |
| 1415 | , OAuth = require( './lib/oau th').OAuth | |
| 1416 | , Multip art = requ ire('./lib /multipart ').Multipa rt | |
| 1417 | , Redire ct = requi re('./lib/ redirect') .Redirect | |
| 1418 | , Tunnel = require ('./lib/tu nnel').Tun nel | |
| 1419 | ||
| 1420 | var safeSt ringify = helpers.sa feStringif y | |
| 1421 | , isRead Stream = h elpers.isR eadStream | |
| 1422 | , toBase 64 = helpe rs.toBase6 4 | |
| 1423 | , defer = helpers. defer | |
| 1424 | , copy = helpers.c opy | |
| 1425 | , versio n = helper s.version | |
| 1426 | , global CookieJar = cookies. jar() | |
| 1427 | ||
| 1428 | ||
| 1429 | var global Pool = {} | |
| 1430 | ||
| 1431 | function f ilterForNo nReserved( reserved, options) { | |
| 1432 | // Filte r out prop erties tha t are not reserved. | |
| 1433 | // Reser ved values are passe d in at ca ll site. | |
| 1434 | ||
| 1435 | var obje ct = {} | |
| 1436 | for (var i in opti ons) { | |
| 1437 | var no tReserved = (reserve d.indexOf( i) === -1) | |
| 1438 | if (no tReserved) { | |
| 1439 | obje ct[i] = op tions[i] | |
| 1440 | } | |
| 1441 | } | |
| 1442 | return o bject | |
| 1443 | } | |
| 1444 | ||
| 1445 | function f ilterOutRe servedFunc tions(rese rved, opti ons) { | |
| 1446 | // Filte r out prop erties tha t are func tions and are reserv ed. | |
| 1447 | // Reser ved values are passe d in at ca ll site. | |
| 1448 | ||
| 1449 | var obje ct = {} | |
| 1450 | for (var i in opti ons) { | |
| 1451 | var is Reserved = !(reserve d.indexOf( i) === -1) | |
| 1452 | var is Function = (typeof o ptions[i] === 'funct ion') | |
| 1453 | if (!( isReserved && isFunc tion)) { | |
| 1454 | obje ct[i] = op tions[i] | |
| 1455 | } | |
| 1456 | } | |
| 1457 | return o bject | |
| 1458 | ||
| 1459 | } | |
| 1460 | ||
| 1461 | // Functio n for prop erly handl ing a conn ection err or | |
| 1462 | function c onnectionE rrorHandle r(error) { | |
| 1463 | var sock et = this | |
| 1464 | if (sock et.res) { | |
| 1465 | if (so cket.res.r equest) { | |
| 1466 | sock et.res.req uest.emit( 'error', e rror) | |
| 1467 | } else { | |
| 1468 | sock et.res.emi t('error', error) | |
| 1469 | } | |
| 1470 | } else { | |
| 1471 | socket ._httpMess age.emit(' error', er ror) | |
| 1472 | } | |
| 1473 | } | |
| 1474 | ||
| 1475 | // Return a simpler request ob ject to al low serial ization | |
| 1476 | function r equestToJS ON() { | |
| 1477 | var self = this | |
| 1478 | return { | |
| 1479 | uri: s elf.uri, | |
| 1480 | method : self.met hod, | |
| 1481 | header s: self.he aders | |
| 1482 | } | |
| 1483 | } | |
| 1484 | ||
| 1485 | // Return a simpler response o bject to a llow seria lization | |
| 1486 | function r esponseToJ SON() { | |
| 1487 | var self = this | |
| 1488 | return { | |
| 1489 | status Code: self .statusCod e, | |
| 1490 | body: self.body, | |
| 1491 | header s: self.he aders, | |
| 1492 | reques t: request ToJSON.cal l(self.req uest) | |
| 1493 | } | |
| 1494 | } | |
| 1495 | ||
| 1496 | function R equest (op tions) { | |
| 1497 | // if gi ven the me thod prope rty in opt ions, set property e xplicitMet hod to tru e | |
| 1498 | ||
| 1499 | // exten d the Requ est instan ce with an y non-rese rved prope rties | |
| 1500 | // remov e any rese rved funct ions from the option s object | |
| 1501 | // set R equest ins tance to b e readable and writa ble | |
| 1502 | // call init | |
| 1503 | ||
| 1504 | var self = this | |
| 1505 | ||
| 1506 | // start with HAR, then over ride with additional options | |
| 1507 | if (opti ons.har) { | |
| 1508 | self._ har = new Har(self) | |
| 1509 | option s = self._ har.option s(options) | |
| 1510 | } | |
| 1511 | ||
| 1512 | stream.S tream.call (self) | |
| 1513 | var rese rved = Obj ect.keys(R equest.pro totype) | |
| 1514 | var nonR eserved = filterForN onReserved (reserved, options) | |
| 1515 | ||
| 1516 | extend(s elf, nonRe served) | |
| 1517 | options = filterOu tReservedF unctions(r eserved, o ptions) | |
| 1518 | ||
| 1519 | self.rea dable = tr ue | |
| 1520 | self.wri table = tr ue | |
| 1521 | if (opti ons.method ) { | |
| 1522 | self.e xplicitMet hod = true | |
| 1523 | } | |
| 1524 | self._qs = new Que rystring(s elf) | |
| 1525 | self._au th = new A uth(self) | |
| 1526 | self._oa uth = new OAuth(self ) | |
| 1527 | self._mu ltipart = new Multip art(self) | |
| 1528 | self._re direct = n ew Redirec t(self) | |
| 1529 | self._tu nnel = new Tunnel(se lf) | |
| 1530 | self.ini t(options) | |
| 1531 | } | |
| 1532 | ||
| 1533 | util.inher its(Reques t, stream. Stream) | |
| 1534 | ||
| 1535 | // Debuggi ng | |
| 1536 | Request.de bug = proc ess.env.NO DE_DEBUG & & /\breque st\b/.test (process.e nv.NODE_DE BUG) | |
| 1537 | function d ebug() { | |
| 1538 | if (Requ est.debug) { | |
| 1539 | consol e.error('R EQUEST %s' , util.for mat.apply( util, argu ments)) | |
| 1540 | } | |
| 1541 | } | |
| 1542 | Request.pr ototype.de bug = debu g | |
| 1543 | ||
| 1544 | Request.pr ototype.in it = funct ion (optio ns) { | |
| 1545 | // init( ) contains all the c ode to set up the req uest objec t. | |
| 1546 | // the a ctual outg oing reque st is not started un til start( ) is calle d | |
| 1547 | // this function i s called f rom both t he constru ctor and o n redirect . | |
| 1548 | var self = this | |
| 1549 | if (!opt ions) { | |
| 1550 | option s = {} | |
| 1551 | } | |
| 1552 | self.hea ders = sel f.headers ? copy(sel f.headers) : {} | |
| 1553 | ||
| 1554 | // Delet e headers with value undefined since the y break | |
| 1555 | // Clien tRequest.O utgoingMes sage.setHe ader in no de 0.12 | |
| 1556 | for (var headerNam e in self. headers) { | |
| 1557 | if (ty peof self. headers[he aderName] === 'undef ined') { | |
| 1558 | dele te self.he aders[head erName] | |
| 1559 | } | |
| 1560 | } | |
| 1561 | ||
| 1562 | caseless .httpify(s elf, self. headers) | |
| 1563 | ||
| 1564 | if (!sel f.method) { | |
| 1565 | self.m ethod = op tions.meth od || 'GET ' | |
| 1566 | } | |
| 1567 | if (!sel f.localAdd ress) { | |
| 1568 | self.l ocalAddres s = option s.localAdd ress | |
| 1569 | } | |
| 1570 | ||
| 1571 | self._qs .init(opti ons) | |
| 1572 | ||
| 1573 | debug(op tions) | |
| 1574 | if (!sel f.pool && self.pool !== false) { | |
| 1575 | self.p ool = glob alPool | |
| 1576 | } | |
| 1577 | self.des ts = self. dests || [ ] | |
| 1578 | self.__i sRequestRe quest = tr ue | |
| 1579 | ||
| 1580 | // Prote ct against double ca llback | |
| 1581 | if (!sel f._callbac k && self. callback) { | |
| 1582 | self._ callback = self.call back | |
| 1583 | self.c allback = function ( ) { | |
| 1584 | if ( self._call backCalled ) { | |
| 1585 | re turn // Pr int a warn ing maybe? | |
| 1586 | } | |
| 1587 | self ._callback Called = t rue | |
| 1588 | self ._callback .apply(sel f, argumen ts) | |
| 1589 | } | |
| 1590 | self.o n('error', self.call back.bind( )) | |
| 1591 | self.o n('complet e', self.c allback.bi nd(self, n ull)) | |
| 1592 | } | |
| 1593 | ||
| 1594 | // Peopl e use this property instead al l the time , so suppo rt it | |
| 1595 | if (!sel f.uri && s elf.url) { | |
| 1596 | self.u ri = self. url | |
| 1597 | delete self.url | |
| 1598 | } | |
| 1599 | ||
| 1600 | // If th ere's a ba seUrl, the n use it a s the base URL (i.e. uri must be | |
| 1601 | // speci fied as a relative p ath and is appended to baseUrl ). | |
| 1602 | if (self .baseUrl) { | |
| 1603 | if (ty peof self. baseUrl != = 'string' ) { | |
| 1604 | retu rn self.em it('error' , new Erro r('options .baseUrl m ust be a s tring')) | |
| 1605 | } | |
| 1606 | ||
| 1607 | if (ty peof self. uri !== 's tring') { | |
| 1608 | retu rn self.em it('error' , new Erro r('options .uri must be a strin g when usi ng options .baseUrl') ) | |
| 1609 | } | |
| 1610 | ||
| 1611 | if (se lf.uri.ind exOf('//') === 0 || self.uri.i ndexOf(':/ /') !== -1 ) { | |
| 1612 | retu rn self.em it('error' , new Erro r('options .uri must be a path when using options.b aseUrl')) | |
| 1613 | } | |
| 1614 | ||
| 1615 | // Han dle all ca ses to mak e sure tha t there's only one s lash betwe en | |
| 1616 | // bas eUrl and u ri. | |
| 1617 | var ba seUrlEndsW ithSlash = self.base Url.lastIn dexOf('/') === self. baseUrl.le ngth - 1 | |
| 1618 | var ur iStartsWit hSlash = s elf.uri.in dexOf('/') === 0 | |
| 1619 | ||
| 1620 | if (ba seUrlEndsW ithSlash & & uriStart sWithSlash ) { | |
| 1621 | self .uri = sel f.baseUrl + self.uri .slice(1) | |
| 1622 | } else if (baseU rlEndsWith Slash || u riStartsWi thSlash) { | |
| 1623 | self .uri = sel f.baseUrl + self.uri | |
| 1624 | } else if (self. uri === '' ) { | |
| 1625 | self .uri = sel f.baseUrl | |
| 1626 | } else { | |
| 1627 | self .uri = sel f.baseUrl + '/' + se lf.uri | |
| 1628 | } | |
| 1629 | delete self.base Url | |
| 1630 | } | |
| 1631 | ||
| 1632 | // A URI is needed by this p oint, emit error if we haven't been able to get on e | |
| 1633 | if (!sel f.uri) { | |
| 1634 | return self.emit ('error', new Error( 'options.u ri is a re quired arg ument')) | |
| 1635 | } | |
| 1636 | ||
| 1637 | // If a string URI /URL was g iven, pars e it into a URL obje ct | |
| 1638 | if (type of self.ur i === 'str ing') { | |
| 1639 | self.u ri = url.p arse(self. uri) | |
| 1640 | } | |
| 1641 | ||
| 1642 | // Some URL object s are not from a URL parsed st ring and n eed href a dded | |
| 1643 | if (!sel f.uri.href ) { | |
| 1644 | self.u ri.href = url.format (self.uri) | |
| 1645 | } | |
| 1646 | ||
| 1647 | // DEPRE CATED: War ning for u sers of th e old Unix Sockets U RL Scheme | |
| 1648 | if (self .uri.proto col === 'u nix:') { | |
| 1649 | return self.emit ('error', new Error( '`unix://` URL schem e is no lo nger suppo rted. Plea se use the format `h ttp://unix :SOCKET:PA TH`')) | |
| 1650 | } | |
| 1651 | ||
| 1652 | // Suppo rt Unix So ckets | |
| 1653 | if (self .uri.host === 'unix' ) { | |
| 1654 | self.e nableUnixS ocket() | |
| 1655 | } | |
| 1656 | ||
| 1657 | if (self .strictSSL === false ) { | |
| 1658 | self.r ejectUnaut horized = false | |
| 1659 | } | |
| 1660 | ||
| 1661 | if (!sel f.uri.path name) {sel f.uri.path name = '/' } | |
| 1662 | ||
| 1663 | if (!(se lf.uri.hos t || (self .uri.hostn ame && sel f.uri.port )) && !sel f.uri.isUn ix) { | |
| 1664 | // Inv alid URI: it may gen erate lot of bad err ors, like 'TypeError : Cannot c all method `indexOf` of undefi ned' in Co okieJar | |
| 1665 | // Det ect and re ject it as soon as p ossible | |
| 1666 | var fa ultyUri = url.format (self.uri) | |
| 1667 | var me ssage = 'I nvalid URI "' + faul tyUri + '" ' | |
| 1668 | if (Ob ject.keys( options).l ength === 0) { | |
| 1669 | // N o option ? This can be the sig n of a red irect | |
| 1670 | // A s this is a case whe re the use r cannot d o anything (they did n't call r equest dir ectly with this URL) | |
| 1671 | // t hey should be warned that it c an be caus ed by a re direction (can save some hair) | |
| 1672 | mess age += '. This can b e caused b y a crappy redirecti on.' | |
| 1673 | } | |
| 1674 | // Thi s error wa s fatal | |
| 1675 | self.a bort() | |
| 1676 | return self.emit ('error', new Error( message)) | |
| 1677 | } | |
| 1678 | ||
| 1679 | if (!sel f.hasOwnPr operty('pr oxy')) { | |
| 1680 | self.p roxy = get ProxyFromU RI(self.ur i) | |
| 1681 | } | |
| 1682 | ||
| 1683 | self.tun nel = self ._tunnel.i sEnabled() | |
| 1684 | if (self .proxy) { | |
| 1685 | self._ tunnel.set up(options ) | |
| 1686 | } | |
| 1687 | ||
| 1688 | self._re direct.onR equest(opt ions) | |
| 1689 | ||
| 1690 | self.set Host = fal se | |
| 1691 | if (!sel f.hasHeade r('host')) { | |
| 1692 | var ho stHeaderNa me = self. originalHo stHeaderNa me || 'hos t' | |
| 1693 | self.s etHeader(h ostHeaderN ame, self. uri.hostna me) | |
| 1694 | if (se lf.uri.por t) { | |
| 1695 | if ( !(self.ur i.port === 80 && sel f.uri.prot ocol === ' http:') && | |
| 1696 | !(self.ur i.port === 443 && se lf.uri.pro tocol === 'https:') ) { | |
| 1697 | se lf.setHead er(hostHea derName, s elf.getHea der('host' ) + (':' + self.uri. port) ) | |
| 1698 | } | |
| 1699 | } | |
| 1700 | self.s etHost = t rue | |
| 1701 | } | |
| 1702 | ||
| 1703 | self.jar (self._jar || option s.jar) | |
| 1704 | ||
| 1705 | if (!sel f.uri.port ) { | |
| 1706 | if (self.u ri.protoco l === 'htt p:') {self .uri. PORT
|
|
| 1707 | else if (s elf.uri.pr otocol === 'https:') {self.uri . PORT
|
|
| 1708 | } | |
| 1709 | ||
| 1710 | if (self .proxy && !self.tunn el) { | |
| 1711 | self.p ort = self .proxy.por t | |
| 1712 | self.h ost = self .proxy.hos tname | |
| 1713 | } else { | |
| 1714 | self.p ort = self .uri.port | |
| 1715 | self.h ost = self .uri.hostn ame | |
| 1716 | } | |
| 1717 | ||
| 1718 | if (opti ons.form) { | |
| 1719 | self.f orm(option s.form) | |
| 1720 | } | |
| 1721 | ||
| 1722 | if (opti ons.formDa ta) { | |
| 1723 | var fo rmData = o ptions.for mData | |
| 1724 | var re questForm = self.for m() | |
| 1725 | var ap pendFormVa lue = func tion (key, value) { | |
| 1726 | if ( value.hasO wnProperty ('value') && value.h asOwnPrope rty('optio ns')) { | |
| 1727 | re questForm. append(key , value.va lue, value .options) | |
| 1728 | } el se { | |
| 1729 | re questForm. append(key , value) | |
| 1730 | } | |
| 1731 | } | |
| 1732 | for (v ar formKey in formDa ta) { | |
| 1733 | if ( formData.h asOwnPrope rty(formKe y)) { | |
| 1734 | va r formValu e = formDa ta[formKey ] | |
| 1735 | if (formValu e instance of Array) { | |
| 1736 | for (var j = 0; j < formValue. length; j+ +) { | |
| 1737 | appendFo rmValue(fo rmKey, for mValue[j]) | |
| 1738 | } | |
| 1739 | } else { | |
| 1740 | appendForm Value(form Key, formV alue) | |
| 1741 | } | |
| 1742 | } | |
| 1743 | } | |
| 1744 | } | |
| 1745 | ||
| 1746 | if (opti ons.qs) { | |
| 1747 | self.q s(options. qs) | |
| 1748 | } | |
| 1749 | ||
| 1750 | if (self .uri.path) { | |
| 1751 | self.p ath = self .uri.path | |
| 1752 | } else { | |
| 1753 | self.p ath = self .uri.pathn ame + (sel f.uri.sear ch || '') | |
| 1754 | } | |
| 1755 | ||
| 1756 | if (self .path.leng th === 0) { | |
| 1757 | self.p ath = '/' | |
| 1758 | } | |
| 1759 | ||
| 1760 | // Auth must happe n last in case signi ng is depe ndent on o ther heade rs | |
| 1761 | if (opti ons.aws) { | |
| 1762 | self.a ws(options .aws) | |
| 1763 | } | |
| 1764 | ||
| 1765 | if (opti ons.hawk) { | |
| 1766 | self.h awk(option s.hawk) | |
| 1767 | } | |
| 1768 | ||
| 1769 | if (opti ons.httpSi gnature) { | |
| 1770 | self.h ttpSignatu re(options .httpSigna ture) | |
| 1771 | } | |
| 1772 | ||
| 1773 | if (opti ons.auth) { | |
| 1774 | if (Ob ject.proto type.hasOw nProperty. call(optio ns.auth, ' username') ) { | |
| 1775 | opti ons.auth.u ser = opti ons.auth.u sername | |
| 1776 | } | |
| 1777 | if (Ob ject.proto type.hasOw nProperty. call(optio ns.auth, ' password') ) { | |
| 1778 | opti ons.auth.p ass = opti ons.auth.p assword | |
| 1779 | } | |
| 1780 | ||
| 1781 | self.a uth( | |
| 1782 | opti ons.auth.u ser, | |
| 1783 | opti ons.auth.p ass, | |
| 1784 | opti ons.auth.s endImmedia tely, | |
| 1785 | opti ons.auth.b earer | |
| 1786 | ) | |
| 1787 | } | |
| 1788 | ||
| 1789 | if (self .gzip && ! self.hasHe ader('acce pt-encodin g')) { | |
| 1790 | self.s etHeader(' accept-enc oding', 'g zip') | |
| 1791 | } | |
| 1792 | ||
| 1793 | if (self .uri.auth && !self.h asHeader(' authorizat ion')) { | |
| 1794 | var ur iAuthPiece s = self.u ri.auth.sp lit(':').m ap(functio n(item) {r eturn self ._qs.unesc ape(item)} ) | |
| 1795 | self.a uth(uriAut hPieces[0] , uriAuthP ieces.slic e(1).join( ':'), true ) | |
| 1796 | } | |
| 1797 | ||
| 1798 | if (!sel f.tunnel & & self.pro xy && self .proxy.aut h && !self .hasHeader ('proxy-au thorizatio n')) { | |
| 1799 | var pr oxyAuthPie ces = self .proxy.aut h.split(': ').map(fun ction(item ) {return self._qs.u nescape(it em)}) | |
| 1800 | var au thHeader = 'Basic ' + toBase64 (proxyAuth Pieces.joi n(':')) | |
| 1801 | self.s etHeader(' proxy-auth orization' , authHead er) | |
| 1802 | } | |
| 1803 | ||
| 1804 | if (self .proxy && !self.tunn el) { | |
| 1805 | self.p ath = (sel f.uri.prot ocol + '// ' + self.u ri.host + self.path) | |
| 1806 | } | |
| 1807 | ||
| 1808 | if (opti ons.json) { | |
| 1809 | self.j son(option s.json) | |
| 1810 | } | |
| 1811 | if (opti ons.multip art) { | |
| 1812 | self.m ultipart(o ptions.mul tipart) | |
| 1813 | } | |
| 1814 | ||
| 1815 | if (opti ons.time) { | |
| 1816 | self.t iming = tr ue | |
| 1817 | self.e lapsedTime = self.el apsedTime || 0 | |
| 1818 | } | |
| 1819 | ||
| 1820 | function setConten tLength () { | |
| 1821 | if (is TypedArray (self.body )) { | |
| 1822 | self .body = ne w Buffer(s elf.body) | |
| 1823 | } | |
| 1824 | ||
| 1825 | if (!s elf.hasHea der('conte nt-length' )) { | |
| 1826 | var length | |
| 1827 | if ( typeof sel f.body === 'string') { | |
| 1828 | le ngth = Buf fer.byteLe ngth(self. body) | |
| 1829 | } | |
| 1830 | else if (Array .isArray(s elf.body)) { | |
| 1831 | le ngth = sel f.body.red uce(functi on (a, b) {return a + b.length }, 0) | |
| 1832 | } | |
| 1833 | else { | |
| 1834 | le ngth = sel f.body.len gth | |
| 1835 | } | |
| 1836 | ||
| 1837 | if ( length) { | |
| 1838 | se lf.setHead er('conten t-length', length) | |
| 1839 | } el se { | |
| 1840 | se lf.emit('e rror', new Error('Ar gument err or, option s.body.')) | |
| 1841 | } | |
| 1842 | } | |
| 1843 | } | |
| 1844 | if (self .body && ! isstream(s elf.body)) { | |
| 1845 | setCon tentLength () | |
| 1846 | } | |
| 1847 | ||
| 1848 | if (opti ons.oauth) { | |
| 1849 | self.o auth(optio ns.oauth) | |
| 1850 | } else i f (self._o auth.param s && self. hasHeader( 'authoriza tion')) { | |
| 1851 | self.o auth(self. _oauth.par ams) | |
| 1852 | } | |
| 1853 | ||
| 1854 | var prot ocol = sel f.proxy && !self.tun nel ? self .proxy.pro tocol : se lf.uri.pro tocol | |
| 1855 | , defa ultModules = {'http: ':http, 'h ttps:':htt ps} | |
| 1856 | , http Modules = self.httpM odules || {} | |
| 1857 | ||
| 1858 | self.htt pModule = httpModule s[protocol ] || defau ltModules[ protocol] | |
| 1859 | ||
| 1860 | if (!sel f.httpModu le) { | |
| 1861 | return self.emit ('error', new Error( 'Invalid p rotocol: ' + protoco l)) | |
| 1862 | } | |
| 1863 | ||
| 1864 | if (opti ons.ca) { | |
| 1865 | self.c a = option s.ca | |
| 1866 | } | |
| 1867 | ||
| 1868 | if (!sel f.agent) { | |
| 1869 | if (op tions.agen tOptions) { | |
| 1870 | self .agentOpti ons = opti ons.agentO ptions | |
| 1871 | } | |
| 1872 | ||
| 1873 | if (op tions.agen tClass) { | |
| 1874 | self .agentClas s = option s.agentCla ss | |
| 1875 | } else if (optio ns.forever ) { | |
| 1876 | var v = versio n() | |
| 1877 | // u se Forever Agent in n ode 0.10- only | |
| 1878 | if ( v.major == = 0 && v.m inor <= 10 ) { | |
| 1879 | se lf.agentCl ass = prot ocol === ' http:' ? F oreverAgen t : Foreve rAgent.SSL | |
| 1880 | } el se { | |
| 1881 | se lf.agentCl ass = self .httpModul e.Agent | |
| 1882 | se lf.agentOp tions = se lf.agentOp tions || { } | |
| 1883 | se lf.agentOp tions.keep Alive = tr ue | |
| 1884 | } | |
| 1885 | } else { | |
| 1886 | self .agentClas s = self.h ttpModule. Agent | |
| 1887 | } | |
| 1888 | } | |
| 1889 | ||
| 1890 | if (self .pool === false) { | |
| 1891 | self.a gent = fal se | |
| 1892 | } else { | |
| 1893 | self.a gent = sel f.agent || self.getN ewAgent() | |
| 1894 | } | |
| 1895 | ||
| 1896 | self.on( 'pipe', fu nction (sr c) { | |
| 1897 | if (se lf.ntick & & self._st arted) { | |
| 1898 | self .emit('err or', new E rror('You cannot pip e to this stream aft er the out bound requ est has st arted.')) | |
| 1899 | } | |
| 1900 | self.s rc = src | |
| 1901 | if (is ReadStream (src)) { | |
| 1902 | if ( !self.hasH eader('con tent-type' )) { | |
| 1903 | se lf.setHead er('conten t-type', m ime.lookup (src.path) ) | |
| 1904 | } | |
| 1905 | } else { | |
| 1906 | if ( src.header s) { | |
| 1907 | fo r (var i i n src.head ers) { | |
| 1908 | if (!self. hasHeader( i)) { | |
| 1909 | self.set Header(i, src.header s[i]) | |
| 1910 | } | |
| 1911 | } | |
| 1912 | } | |
| 1913 | if ( self._json && !self. hasHeader( 'content-t ype')) { | |
| 1914 | se lf.setHead er('conten t-type', ' applicatio n/json') | |
| 1915 | } | |
| 1916 | if ( src.method && !self. explicitMe thod) { | |
| 1917 | se lf.method = src.meth od | |
| 1918 | } | |
| 1919 | } | |
| 1920 | ||
| 1921 | // sel f.on('pipe ', functio n () { | |
| 1922 | // c onsole.err or('You ha ve already piped to this strea m. Pipeing twice is likely to break the request.') | |
| 1923 | // }) | |
| 1924 | }) | |
| 1925 | ||
| 1926 | defer(fu nction () { | |
| 1927 | if (se lf._aborte d) { | |
| 1928 | retu rn | |
| 1929 | } | |
| 1930 | ||
| 1931 | var en d = functi on () { | |
| 1932 | if ( self._form ) { | |
| 1933 | if (!self._a uth.hasAut h) { | |
| 1934 | self._form .pipe(self ) | |
| 1935 | } | |
| 1936 | el se if (sel f._auth.ha sAuth && s elf._auth. sentAuth) { | |
| 1937 | self._form .pipe(self ) | |
| 1938 | } | |
| 1939 | } | |
| 1940 | if ( self._mult ipart && s elf._multi part.chunk ed) { | |
| 1941 | se lf._multip art.body.p ipe(self) | |
| 1942 | } | |
| 1943 | if ( self.body) { | |
| 1944 | if (isstream (self.body )) { | |
| 1945 | self.body. pipe(self) | |
| 1946 | } else { | |
| 1947 | setContent Length() | |
| 1948 | if (Array. isArray(se lf.body)) { | |
| 1949 | self.bod y.forEach( function ( part) { | |
| 1950 | self.w rite(part) | |
| 1951 | }) | |
| 1952 | } else { | |
| 1953 | self.wri te(self.bo dy) | |
| 1954 | } | |
| 1955 | self.end() | |
| 1956 | } | |
| 1957 | } el se if (sel f.requestB odyStream) { | |
| 1958 | co nsole.warn ('options. requestBod yStream is deprecate d, please pass the r equest obj ect to str eam.pipe.' ) | |
| 1959 | se lf.request BodyStream .pipe(self ) | |
| 1960 | } el se if (!se lf.src) { | |
| 1961 | if (self._au th.hasAuth && !self. _auth.sent Auth) { | |
| 1962 | self.end() | |
| 1963 | return | |
| 1964 | } | |
| 1965 | if (self.met hod !== 'G ET' && typ eof self.m ethod !== 'undefined ') { | |
| 1966 | self.setHe ader('cont ent-length ', 0) | |
| 1967 | } | |
| 1968 | se lf.end() | |
| 1969 | } | |
| 1970 | } | |
| 1971 | ||
| 1972 | if (se lf._form & & !self.ha sHeader('c ontent-len gth')) { | |
| 1973 | // B efore endi ng the req uest, we h ad to comp ute the le ngth of th e whole fo rm, asyncl y | |
| 1974 | self .setHeader (self._for m.getHeade rs(), true ) | |
| 1975 | self ._form.get Length(fun ction (err , length) { | |
| 1976 | if (!err && !isNaN(len gth)) { | |
| 1977 | self.setHe ader('cont ent-length ', length) | |
| 1978 | } | |
| 1979 | en d() | |
| 1980 | }) | |
| 1981 | } else { | |
| 1982 | end( ) | |
| 1983 | } | |
| 1984 | ||
| 1985 | self.n tick = tru e | |
| 1986 | }) | |
| 1987 | ||
| 1988 | } | |
| 1989 | ||
| 1990 | Request.pr ototype.ge tNewAgent = function () { | |
| 1991 | var self = this | |
| 1992 | var Agen t = self.a gentClass | |
| 1993 | var opti ons = {} | |
| 1994 | if (self .agentOpti ons) { | |
| 1995 | for (v ar i in se lf.agentOp tions) { | |
| 1996 | opti ons[i] = s elf.agentO ptions[i] | |
| 1997 | } | |
| 1998 | } | |
| 1999 | if (self .ca) { | |
| 2000 | option s.ca = sel f.ca | |
| 2001 | } | |
| 2002 | if (self .ciphers) { | |
| 2003 | option s.ciphers = self.cip hers | |
| 2004 | } | |
| 2005 | if (self .securePro tocol) { | |
| 2006 | option s.securePr otocol = s elf.secure Protocol | |
| 2007 | } | |
| 2008 | if (self .secureOpt ions) { | |
| 2009 | option s.secureOp tions = se lf.secureO ptions | |
| 2010 | } | |
| 2011 | if (type of self.re jectUnauth orized !== 'undefine d') { | |
| 2012 | option s.rejectUn authorized = self.re jectUnauth orized | |
| 2013 | } | |
| 2014 | ||
| 2015 | if (self .cert && s elf.key) { | |
| 2016 | option s.key = se lf.key | |
| 2017 | option s.cert = s elf.cert | |
| 2018 | } | |
| 2019 | ||
| 2020 | if (self .pfx) { | |
| 2021 | option s.pfx = se lf.pfx | |
| 2022 | } | |
| 2023 | ||
| 2024 | if (self .passphras e) { | |
| 2025 | option s.passphra se = self. passphrase | |
| 2026 | } | |
| 2027 | ||
| 2028 | var pool Key = '' | |
| 2029 | ||
| 2030 | // diffe rent types of agents are in di fferent po ols | |
| 2031 | if (Agen t !== self .httpModul e.Agent) { | |
| 2032 | poolKe y += Agent .name | |
| 2033 | } | |
| 2034 | ||
| 2035 | // ca op tion is on ly relevan t if proxy or destin ation are https | |
| 2036 | var prox y = self.p roxy | |
| 2037 | if (type of proxy = == 'string ') { | |
| 2038 | proxy = url.pars e(proxy) | |
| 2039 | } | |
| 2040 | var isHt tps = (pro xy && prox y.protocol === 'http s:') || th is.uri.pro tocol === 'https:' | |
| 2041 | ||
| 2042 | if (isHt tps) { | |
| 2043 | if (op tions.ca) { | |
| 2044 | if ( poolKey) { | |
| 2045 | po olKey += ' :' | |
| 2046 | } | |
| 2047 | pool Key += opt ions.ca | |
| 2048 | } | |
| 2049 | ||
| 2050 | if (ty peof optio ns.rejectU nauthorize d !== 'und efined') { | |
| 2051 | if ( poolKey) { | |
| 2052 | po olKey += ' :' | |
| 2053 | } | |
| 2054 | pool Key += opt ions.rejec tUnauthori zed | |
| 2055 | } | |
| 2056 | ||
| 2057 | if (op tions.cert ) { | |
| 2058 | if ( poolKey) { | |
| 2059 | po olKey += ' :' | |
| 2060 | } | |
| 2061 | pool Key += opt ions.cert. toString(' ascii') + options.ke y.toString ('ascii') | |
| 2062 | } | |
| 2063 | ||
| 2064 | if (op tions.pfx) { | |
| 2065 | if ( poolKey) { | |
| 2066 | po olKey += ' :' | |
| 2067 | } | |
| 2068 | pool Key += opt ions.pfx.t oString('a scii') | |
| 2069 | } | |
| 2070 | ||
| 2071 | if (op tions.ciph ers) { | |
| 2072 | if ( poolKey) { | |
| 2073 | po olKey += ' :' | |
| 2074 | } | |
| 2075 | pool Key += opt ions.ciphe rs | |
| 2076 | } | |
| 2077 | ||
| 2078 | if (op tions.secu reProtocol ) { | |
| 2079 | if ( poolKey) { | |
| 2080 | po olKey += ' :' | |
| 2081 | } | |
| 2082 | pool Key += opt ions.secur eProtocol | |
| 2083 | } | |
| 2084 | ||
| 2085 | if (op tions.secu reOptions) { | |
| 2086 | if ( poolKey) { | |
| 2087 | po olKey += ' :' | |
| 2088 | } | |
| 2089 | pool Key += opt ions.secur eOptions | |
| 2090 | } | |
| 2091 | } | |
| 2092 | ||
| 2093 | if (self .pool === globalPool && !poolK ey && Obje ct.keys(op tions).len gth === 0 && self.ht tpModule.g lobalAgent ) { | |
| 2094 | // not doing any thing spec ial. Use the global Agent | |
| 2095 | return self.http Module.glo balAgent | |
| 2096 | } | |
| 2097 | ||
| 2098 | // we're using a s tored agen t. Make s ure it's p rotocol-sp ecific | |
| 2099 | poolKey = self.uri .protocol + poolKey | |
| 2100 | ||
| 2101 | // gener ate a new agent for this setti ng if none yet exist s | |
| 2102 | if (!sel f.pool[poo lKey]) { | |
| 2103 | self.p ool[poolKe y] = new A gent(optio ns) | |
| 2104 | // pro perly set maxSockets on new ag ents | |
| 2105 | if (se lf.pool.ma xSockets) { | |
| 2106 | self .pool[pool Key].maxSo ckets = se lf.pool.ma xSockets | |
| 2107 | } | |
| 2108 | } | |
| 2109 | ||
| 2110 | return s elf.pool[p oolKey] | |
| 2111 | } | |
| 2112 | ||
| 2113 | Request.pr ototype.st art = func tion () { | |
| 2114 | // start () is call ed once we are ready to send t he outgoin g HTTP req uest. | |
| 2115 | // this is usually called on the first write(), end() or o n nextTick () | |
| 2116 | var self = this | |
| 2117 | ||
| 2118 | if (self ._aborted) { | |
| 2119 | return | |
| 2120 | } | |
| 2121 | ||
| 2122 | self._st arted = tr ue | |
| 2123 | self.met hod = self .method || 'GET' | |
| 2124 | self.hre f = self.u ri.href | |
| 2125 | ||
| 2126 | if (self .src && se lf.src.sta t && self. src.stat.s ize && !se lf.hasHead er('conten t-length') ) { | |
| 2127 | self.s etHeader(' content-le ngth', sel f.src.stat .size) | |
| 2128 | } | |
| 2129 | if (self ._aws) { | |
| 2130 | self.a ws(self._a ws, true) | |
| 2131 | } | |
| 2132 | ||
| 2133 | // We ha ve a metho d named au th, which is complet ely differ ent from t he http.re quest | |
| 2134 | // auth option. I f we don't remove it , we're go nna have a bad time. | |
| 2135 | var reqO ptions = c opy(self) | |
| 2136 | delete r eqOptions. auth | |
| 2137 | ||
| 2138 | debug('m ake reques t', self.u ri.href) | |
| 2139 | ||
| 2140 | try { | |
| 2141 | self.r eq = self. httpModule .request(r eqOptions) | |
| 2142 | } catch (err) { | |
| 2143 | self.e mit('error ', err) | |
| 2144 | return | |
| 2145 | } | |
| 2146 | ||
| 2147 | if (self .timing) { | |
| 2148 | self.s tartTime = new Date( ).getTime( ) | |
| 2149 | } | |
| 2150 | ||
| 2151 | if (self .timeout & & !self.ti meoutTimer ) { | |
| 2152 | var ti meout = se lf.timeout < 0 ? 0 : self.time out | |
| 2153 | // Set a timeout in memory - this bl ock will t hrow if th e server t akes more | |
| 2154 | // tha n `timeout ` to write the HTTP status and headers ( correspond ing to | |
| 2155 | // the on('respo nse') even t on the c lient). NB : this mea sures wall -clock | |
| 2156 | // tim e, not the time betw een bytes sent by th e server. | |
| 2157 | self.t imeoutTime r = setTim eout(funct ion () { | |
| 2158 | var connectTim eout = sel f.req.sock et && self .req.socke t.readable === false | |
| 2159 | self .abort() | |
| 2160 | var e = new Er ror('ETIME DOUT') | |
| 2161 | e.co de = 'ETIM EDOUT' | |
| 2162 | e.co nnect = co nnectTimeo ut | |
| 2163 | self .emit('err or', e) | |
| 2164 | }, tim eout) | |
| 2165 | ||
| 2166 | if (se lf.req.set Timeout) { // only w orks on no de 0.6+ | |
| 2167 | // S et an addi tional tim eout on th e socket, via the `s etsockopt` syscall. | |
| 2168 | // T his timeou t sets the amount of time to w ait *betwe en* bytes sent | |
| 2169 | // f rom the se rver, and may or may not corre spond to t he wall-cl ock time | |
| 2170 | // e lapsed fro m the star t of the r equest. | |
| 2171 | // | |
| 2172 | // I n particul ar, it's u seful for erroring i f the serv er fails t o send | |
| 2173 | // d ata halfwa y through streaming a response . | |
| 2174 | self .req.setTi meout(time out, funct ion () { | |
| 2175 | if (self.req ) { | |
| 2176 | self.req.a bort() | |
| 2177 | var e = ne w Error('E SOCKETTIME DOUT') | |
| 2178 | e.code = ' ESOCKETTIM EDOUT' | |
| 2179 | e.connect = false | |
| 2180 | self.emit( 'error', e ) | |
| 2181 | } | |
| 2182 | }) | |
| 2183 | } | |
| 2184 | } | |
| 2185 | ||
| 2186 | self.req .on('respo nse', self .onRequest Response.b ind(self)) | |
| 2187 | self.req .on('error ', self.on RequestErr or.bind(se lf)) | |
| 2188 | self.req .on('drain ', functio n() { | |
| 2189 | self.e mit('drain ') | |
| 2190 | }) | |
| 2191 | self.req .on('socke t', functi on(socket) { | |
| 2192 | self.e mit('socke t', socket ) | |
| 2193 | }) | |
| 2194 | ||
| 2195 | self.on( 'end', fun ction() { | |
| 2196 | if ( s elf.req.co nnection ) { | |
| 2197 | self .req.conne ction.remo veListener ('error', connection ErrorHandl er) | |
| 2198 | } | |
| 2199 | }) | |
| 2200 | self.emi t('request ', self.re q) | |
| 2201 | } | |
| 2202 | ||
| 2203 | Request.pr ototype.on RequestErr or = funct ion (error ) { | |
| 2204 | var self = this | |
| 2205 | if (self ._aborted) { | |
| 2206 | return | |
| 2207 | } | |
| 2208 | if (self .req && se lf.req._re usedSocket && error. code === ' ECONNRESET ' | |
| 2209 | && s elf.agent. addRequest Noreuse) { | |
| 2210 | self.a gent = { a ddRequest: self.agen t.addReque stNoreuse. bind(self. agent) } | |
| 2211 | self.s tart() | |
| 2212 | self.r eq.end() | |
| 2213 | return | |
| 2214 | } | |
| 2215 | if (self .timeout & & self.tim eoutTimer) { | |
| 2216 | clearT imeout(sel f.timeoutT imer) | |
| 2217 | self.t imeoutTime r = null | |
| 2218 | } | |
| 2219 | self.emi t('error', error) | |
| 2220 | } | |
| 2221 | ||
| 2222 | Request.pr ototype.on RequestRes ponse = fu nction (re sponse) { | |
| 2223 | var self = this | |
| 2224 | debug('o nRequestRe sponse', s elf.uri.hr ef, respon se.statusC ode, respo nse.header s) | |
| 2225 | response .on('end', function( ) { | |
| 2226 | if (se lf.timing) { | |
| 2227 | self .elapsedTi me += (new Date().ge tTime() - self.start Time) | |
| 2228 | debu g('elapsed time', se lf.elapsed Time) | |
| 2229 | resp onse.elaps edTime = s elf.elapse dTime | |
| 2230 | } | |
| 2231 | debug( 'response end', self .uri.href, response. statusCode , response .headers) | |
| 2232 | }) | |
| 2233 | ||
| 2234 | // The c heck on re sponse.con nection is a workaro und for br owserify. | |
| 2235 | if (resp onse.conne ction && r esponse.co nnection.l isteners(' error').in dexOf(conn ectionErro rHandler) === -1) { | |
| 2236 | respon se.connect ion.setMax Listeners( 0) | |
| 2237 | respon se.connect ion.once(' error', co nnectionEr rorHandler ) | |
| 2238 | } | |
| 2239 | if (self ._aborted) { | |
| 2240 | debug( 'aborted', self.uri. href) | |
| 2241 | respon se.resume( ) | |
| 2242 | return | |
| 2243 | } | |
| 2244 | ||
| 2245 | self.res ponse = re sponse | |
| 2246 | response .request = self | |
| 2247 | response .toJSON = responseTo JSON | |
| 2248 | ||
| 2249 | // XXX T his is dif ferent on 0.10, beca use SSL is strict by default | |
| 2250 | if (self .httpModul e === http s && | |
| 2251 | self .strictSSL && (!resp onse.hasOw nProperty( 'socket') || | |
| 2252 | !res ponse.sock et.authori zed)) { | |
| 2253 | debug( 'strict ss l error', self.uri.h ref) | |
| 2254 | var ss lErr = res ponse.hasO wnProperty ('socket') ? respons e.socket.a uthorizati onError : self.uri.h ref + ' do es not sup port SSL' | |
| 2255 | self.e mit('error ', new Err or('SSL Er ror: ' + s slErr)) | |
| 2256 | return | |
| 2257 | } | |
| 2258 | ||
| 2259 | // Save the origin al host be fore any r edirect (i f it chang es, we nee d to | |
| 2260 | // remov e any auth orization headers). Also reme mber the c ase of the header | |
| 2261 | // name because lo ts of brok en servers expect Ho st instead of host a nd we | |
| 2262 | // want the caller to be abl e to speci fy this. | |
| 2263 | self.ori ginalHost = self.get Header('ho st') | |
| 2264 | if (!sel f.original HostHeader Name) { | |
| 2265 | self.o riginalHos tHeaderNam e = self.h asHeader(' host') | |
| 2266 | } | |
| 2267 | if (self .setHost) { | |
| 2268 | self.r emoveHeade r('host') | |
| 2269 | } | |
| 2270 | if (self .timeout & & self.tim eoutTimer) { | |
| 2271 | clearT imeout(sel f.timeoutT imer) | |
| 2272 | self.t imeoutTime r = null | |
| 2273 | } | |
| 2274 | ||
| 2275 | var targ etCookieJa r = (self. _jar && se lf._jar.se tCookie) ? self._jar : globalC ookieJar | |
| 2276 | var addC ookie = fu nction (co okie) { | |
| 2277 | //set the cookie if it's d omain in t he href's domain. | |
| 2278 | try { | |
| 2279 | targ etCookieJa r.setCooki e(cookie, self.uri.h ref, {igno reError: t rue}) | |
| 2280 | } catc h (e) { | |
| 2281 | self .emit('err or', e) | |
| 2282 | } | |
| 2283 | } | |
| 2284 | ||
| 2285 | response .caseless = caseless (response. headers) | |
| 2286 | ||
| 2287 | if (resp onse.casel ess.has('s et-cookie' ) && (!sel f._disable Cookies)) { | |
| 2288 | var he aderName = response. caseless.h as('set-co okie') | |
| 2289 | if (Ar ray.isArra y(response .headers[h eaderName] )) { | |
| 2290 | resp onse.heade rs[headerN ame].forEa ch(addCook ie) | |
| 2291 | } else { | |
| 2292 | addC ookie(resp onse.heade rs[headerN ame]) | |
| 2293 | } | |
| 2294 | } | |
| 2295 | ||
| 2296 | if (self ._redirect .onRespons e(response )) { | |
| 2297 | return // Ignore the rest of the res ponse | |
| 2298 | } else { | |
| 2299 | // Be a good str eam and em it end whe n the resp onse is fi nished. | |
| 2300 | // Hac k to emit end on clo se because of a core bug that never fire s end | |
| 2301 | respon se.on('clo se', funct ion () { | |
| 2302 | if ( !self._end ed) { | |
| 2303 | se lf.respons e.emit('en d') | |
| 2304 | } | |
| 2305 | }) | |
| 2306 | ||
| 2307 | respon se.on('end ', functio n () { | |
| 2308 | self ._ended = true | |
| 2309 | }) | |
| 2310 | ||
| 2311 | var re sponseCont ent | |
| 2312 | if (se lf.gzip) { | |
| 2313 | var contentEnc oding = re sponse.hea ders['cont ent-encodi ng'] || 'i dentity' | |
| 2314 | cont entEncodin g = conten tEncoding. trim().toL owerCase() | |
| 2315 | ||
| 2316 | if ( contentEnc oding === 'gzip') { | |
| 2317 | re sponseCont ent = zlib .createGun zip() | |
| 2318 | re sponse.pip e(response Content) | |
| 2319 | } el se { | |
| 2320 | // Since pre vious vers ions didn' t check fo r Content- Encoding h eader, | |
| 2321 | // ignore an y invalid values to preserve b ackwards-c ompatibili ty | |
| 2322 | if (contentE ncoding != = 'identit y') { | |
| 2323 | debug('ign oring unre cognized C ontent-Enc oding ' + contentEnc oding) | |
| 2324 | } | |
| 2325 | re sponseCont ent = resp onse | |
| 2326 | } | |
| 2327 | } else { | |
| 2328 | resp onseConten t = respon se | |
| 2329 | } | |
| 2330 | ||
| 2331 | if (se lf.encodin g) { | |
| 2332 | if ( self.dests .length != = 0) { | |
| 2333 | co nsole.erro r('Ignorin g encoding parameter as this s tream is b eing piped to anothe r stream w hich makes the encod ing option invalid.' ) | |
| 2334 | } el se if (res ponseConte nt.setEnco ding) { | |
| 2335 | re sponseCont ent.setEnc oding(self .encoding) | |
| 2336 | } el se { | |
| 2337 | // Should on ly occur o n node pre -v0.9.4 (j oyent/node @9b5abe5) with | |
| 2338 | // zlib stre ams. | |
| 2339 | // If/When s upport for 0.9.4 is dropped, t his should be unnece ssary. | |
| 2340 | re sponseCont ent = resp onseConten t.pipe(str ingstream( self.encod ing)) | |
| 2341 | } | |
| 2342 | } | |
| 2343 | ||
| 2344 | if (se lf._paused ) { | |
| 2345 | resp onseConten t.pause() | |
| 2346 | } | |
| 2347 | ||
| 2348 | self.r esponseCon tent = res ponseConte nt | |
| 2349 | ||
| 2350 | self.e mit('respo nse', resp onse) | |
| 2351 | ||
| 2352 | self.d ests.forEa ch(functio n (dest) { | |
| 2353 | self .pipeDest( dest) | |
| 2354 | }) | |
| 2355 | ||
| 2356 | respon seContent. on('data', function (chunk) { | |
| 2357 | self ._destdata = true | |
| 2358 | self .emit('dat a', chunk) | |
| 2359 | }) | |
| 2360 | respon seContent. on('end', function ( chunk) { | |
| 2361 | self .emit('end ', chunk) | |
| 2362 | }) | |
| 2363 | respon seContent. on('error' , function (error) { | |
| 2364 | self .emit('err or', error ) | |
| 2365 | }) | |
| 2366 | respon seContent. on('close' , function () {self. emit('clos e')}) | |
| 2367 | ||
| 2368 | if (se lf.callbac k) { | |
| 2369 | self .readRespo nseBody(re sponse) | |
| 2370 | } | |
| 2371 | //if n o callback | |
| 2372 | else { | |
| 2373 | self .on('end', function () { | |
| 2374 | if (self._ab orted) { | |
| 2375 | debug('abo rted', sel f.uri.href ) | |
| 2376 | return | |
| 2377 | } | |
| 2378 | se lf.emit('c omplete', response) | |
| 2379 | }) | |
| 2380 | } | |
| 2381 | } | |
| 2382 | debug('f inish init function' , self.uri .href) | |
| 2383 | } | |
| 2384 | ||
| 2385 | Request.pr ototype.re adResponse Body = fun ction (res ponse) { | |
| 2386 | var self = this | |
| 2387 | debug('r eading res ponse\'s b ody') | |
| 2388 | var buff er = bl() | |
| 2389 | , stri ngs = [] | |
| 2390 | ||
| 2391 | self.on( 'data', fu nction (ch unk) { | |
| 2392 | if (Bu ffer.isBuf fer(chunk) ) { | |
| 2393 | buff er.append( chunk) | |
| 2394 | } else { | |
| 2395 | stri ngs.push(c hunk) | |
| 2396 | } | |
| 2397 | }) | |
| 2398 | self.on( 'end', fun ction () { | |
| 2399 | debug( 'end event ', self.ur i.href) | |
| 2400 | if (se lf._aborte d) { | |
| 2401 | debu g('aborted ', self.ur i.href) | |
| 2402 | retu rn | |
| 2403 | } | |
| 2404 | ||
| 2405 | if (bu ffer.lengt h) { | |
| 2406 | debu g('has bod y', self.u ri.href, b uffer.leng th) | |
| 2407 | if ( self.encod ing === nu ll) { | |
| 2408 | // response. body = buf fer | |
| 2409 | // can't mov e to this until http s://github .com/rvagg /bl/issues /13 | |
| 2410 | re sponse.bod y = buffer .slice() | |
| 2411 | } el se { | |
| 2412 | re sponse.bod y = buffer .toString( self.encod ing) | |
| 2413 | } | |
| 2414 | } else if (strin gs.length) { | |
| 2415 | // T he UTF8 BO M [0xEF,0x BB,0xBF] i s converte d to [0xFE ,0xFF] in the JS UTC 16/UCS2 re presentati on. | |
| 2416 | // S trip this value out when the e ncoding is set to 'u tf8', as u pstream co nsumers wo n't expect it and it breaks JS ON.parse() . | |
| 2417 | if ( self.encod ing === 'u tf8' && st rings[0].l ength > 0 && strings [0][0] === '\uFEFF') { | |
| 2418 | st rings[0] = strings[0 ].substrin g(1) | |
| 2419 | } | |
| 2420 | resp onse.body = strings. join('') | |
| 2421 | } | |
| 2422 | ||
| 2423 | if (se lf._json) { | |
| 2424 | try { | |
| 2425 | re sponse.bod y = JSON.p arse(respo nse.body, self._json Reviver) | |
| 2426 | } ca tch (e) { | |
| 2427 | de bug('inval id JSON re ceived', s elf.uri.hr ef) | |
| 2428 | } | |
| 2429 | } | |
| 2430 | debug( 'emitting complete', self.uri. href) | |
| 2431 | if (ty peof respo nse.body = == 'undefi ned' && !s elf._json) { | |
| 2432 | resp onse.body = self.enc oding === null ? new Buffer(0) : '' | |
| 2433 | } | |
| 2434 | self.e mit('compl ete', resp onse, resp onse.body) | |
| 2435 | }) | |
| 2436 | } | |
| 2437 | ||
| 2438 | Request.pr ototype.ab ort = func tion () { | |
| 2439 | var self = this | |
| 2440 | self._ab orted = tr ue | |
| 2441 | ||
| 2442 | if (self .req) { | |
| 2443 | self.r eq.abort() | |
| 2444 | } | |
| 2445 | else if (self.resp onse) { | |
| 2446 | self.r esponse.de stroy() | |
| 2447 | } | |
| 2448 | ||
| 2449 | self.emi t('abort') | |
| 2450 | } | |
| 2451 | ||
| 2452 | Request.pr ototype.pi peDest = f unction (d est) { | |
| 2453 | var self = this | |
| 2454 | var resp onse = sel f.response | |
| 2455 | // Calle d after th e response is receiv ed | |
| 2456 | if (dest .headers & & !dest.he adersSent) { | |
| 2457 | if (re sponse.cas eless.has( 'content-t ype')) { | |
| 2458 | var ctname = r esponse.ca seless.has ('content- type') | |
| 2459 | if ( dest.setHe ader) { | |
| 2460 | de st.setHead er(ctname, response. headers[ct name]) | |
| 2461 | } | |
| 2462 | else { | |
| 2463 | de st.headers [ctname] = response. headers[ct name] | |
| 2464 | } | |
| 2465 | } | |
| 2466 | ||
| 2467 | if (re sponse.cas eless.has( 'content-l ength')) { | |
| 2468 | var clname = r esponse.ca seless.has ('content- length') | |
| 2469 | if ( dest.setHe ader) { | |
| 2470 | de st.setHead er(clname, response. headers[cl name]) | |
| 2471 | } el se { | |
| 2472 | de st.headers [clname] = response. headers[cl name] | |
| 2473 | } | |
| 2474 | } | |
| 2475 | } | |
| 2476 | if (dest .setHeader && !dest. headersSen t) { | |
| 2477 | for (v ar i in re sponse.hea ders) { | |
| 2478 | // I f the resp onse conte nt is bein g decoded, the Conte nt-Encodin g header | |
| 2479 | // o f the resp onse doesn 't represe nt the pip ed content , so don't pass it. | |
| 2480 | if ( !self.gzip || i !== 'content-e ncoding') { | |
| 2481 | de st.setHead er(i, resp onse.heade rs[i]) | |
| 2482 | } | |
| 2483 | } | |
| 2484 | dest.s tatusCode = response .statusCod e | |
| 2485 | } | |
| 2486 | if (self .pipefilte r) { | |
| 2487 | self.p ipefilter( response, dest) | |
| 2488 | } | |
| 2489 | } | |
| 2490 | ||
| 2491 | Request.pr ototype.qs = functio n (q, clob ber) { | |
| 2492 | var self = this | |
| 2493 | var base | |
| 2494 | if (!clo bber && se lf.uri.que ry) { | |
| 2495 | base = self._qs. parse(self .uri.query ) | |
| 2496 | } else { | |
| 2497 | base = {} | |
| 2498 | } | |
| 2499 | ||
| 2500 | for (var i in q) { | |
| 2501 | base[i ] = q[i] | |
| 2502 | } | |
| 2503 | ||
| 2504 | var qs = self._qs. stringify( base) | |
| 2505 | ||
| 2506 | if (qs = == '') { | |
| 2507 | return self | |
| 2508 | } | |
| 2509 | ||
| 2510 | self.uri = url.par se(self.ur i.href.spl it('?')[0] + '?' + q s) | |
| 2511 | self.url = self.ur i | |
| 2512 | self.pat h = self.u ri.path | |
| 2513 | ||
| 2514 | if (self .uri.host === 'unix' ) { | |
| 2515 | self.e nableUnixS ocket() | |
| 2516 | } | |
| 2517 | ||
| 2518 | return s elf | |
| 2519 | } | |
| 2520 | Request.pr ototype.fo rm = funct ion (form) { | |
| 2521 | var self = this | |
| 2522 | if (form ) { | |
| 2523 | if (!/ ^applicati on\/x-www- form-urlen coded\b/.t est(self.g etHeader(' content-ty pe'))) { | |
| 2524 | self .setHeader ('content- type', 'ap plication/ x-www-form -urlencode d') | |
| 2525 | } | |
| 2526 | self.b ody = (typ eof form = == 'string ') | |
| 2527 | ? se lf._qs.rfc 3986(form. toString(' utf8')) | |
| 2528 | : se lf._qs.str ingify(for m).toStrin g('utf8') | |
| 2529 | return self | |
| 2530 | } | |
| 2531 | // creat e form-dat a object | |
| 2532 | self._fo rm = new F ormData() | |
| 2533 | self._fo rm.on('err or', funct ion(err) { | |
| 2534 | err.me ssage = 'f orm-data: ' + err.me ssage | |
| 2535 | self.e mit('error ', err) | |
| 2536 | self.a bort() | |
| 2537 | }) | |
| 2538 | return s elf._form | |
| 2539 | } | |
| 2540 | Request.pr ototype.mu ltipart = function ( multipart) { | |
| 2541 | var self = this | |
| 2542 | ||
| 2543 | self._mu ltipart.on Request(mu ltipart) | |
| 2544 | ||
| 2545 | if (!sel f._multipa rt.chunked ) { | |
| 2546 | self.b ody = self ._multipar t.body | |
| 2547 | } | |
| 2548 | ||
| 2549 | return s elf | |
| 2550 | } | |
| 2551 | Request.pr ototype.js on = funct ion (val) { | |
| 2552 | var self = this | |
| 2553 | ||
| 2554 | if (!sel f.hasHeade r('accept' )) { | |
| 2555 | self.s etHeader(' accept', ' applicatio n/json') | |
| 2556 | } | |
| 2557 | ||
| 2558 | if (type of self.js onReplacer === 'func tion') { | |
| 2559 | self._ jsonReplac er = self. jsonReplac er | |
| 2560 | } | |
| 2561 | ||
| 2562 | self._js on = true | |
| 2563 | if (type of val === 'boolean' ) { | |
| 2564 | if (se lf.body != = undefine d) { | |
| 2565 | if ( !/^applica tion\/x-ww w-form-url encoded\b/ .test(self .getHeader ('content- type'))) { | |
| 2566 | se lf.body = safeString ify(self.b ody, self. _jsonRepla cer) | |
| 2567 | } el se { | |
| 2568 | se lf.body = self._qs.r fc3986(sel f.body) | |
| 2569 | } | |
| 2570 | if ( !self.hasH eader('con tent-type' )) { | |
| 2571 | se lf.setHead er('conten t-type', ' applicatio n/json') | |
| 2572 | } | |
| 2573 | } | |
| 2574 | } else { | |
| 2575 | self.b ody = safe Stringify( val, self. _jsonRepla cer) | |
| 2576 | if (!s elf.hasHea der('conte nt-type')) { | |
| 2577 | self .setHeader ('content- type', 'ap plication/ json') | |
| 2578 | } | |
| 2579 | } | |
| 2580 | ||
| 2581 | if (type of self.js onReviver === 'funct ion') { | |
| 2582 | self._ jsonRevive r = self.j sonReviver | |
| 2583 | } | |
| 2584 | ||
| 2585 | return s elf | |
| 2586 | } | |
| 2587 | Request.pr ototype.ge tHeader = function ( name, head ers) { | |
| 2588 | var self = this | |
| 2589 | var resu lt, re, ma tch | |
| 2590 | if (!hea ders) { | |
| 2591 | header s = self.h eaders | |
| 2592 | } | |
| 2593 | Object.k eys(header s).forEach (function (key) { | |
| 2594 | if (ke y.length ! == name.le ngth) { | |
| 2595 | retu rn | |
| 2596 | } | |
| 2597 | re = n ew RegExp( name, 'i') | |
| 2598 | match = key.matc h(re) | |
| 2599 | if (ma tch) { | |
| 2600 | resu lt = heade rs[key] | |
| 2601 | } | |
| 2602 | }) | |
| 2603 | return r esult | |
| 2604 | } | |
| 2605 | Request.pr ototype.en ableUnixSo cket = fun ction () { | |
| 2606 | // Get t he socket & request paths from the URL | |
| 2607 | var unix Parts = th is.uri.pat h.split(': ') | |
| 2608 | , host = unixPar ts[0] | |
| 2609 | , path = unixPar ts[1] | |
| 2610 | // Apply unix prop erties to request | |
| 2611 | this.soc ketPath = host | |
| 2612 | this.uri .pathname = path | |
| 2613 | this.uri .path = pa th | |
| 2614 | this.uri .host = ho st | |
| 2615 | this.uri .hostname = host | |
| 2616 | this.uri .isUnix = true | |
| 2617 | } | |
| 2618 | ||
| 2619 | ||
| 2620 | Request.pr ototype.au th = funct ion (user, pass, sen dImmediate ly, bearer ) { | |
| 2621 | var self = this | |
| 2622 | ||
| 2623 | self._au th.onReque st(user, p ass, sendI mmediately , bearer) | |
| 2624 | ||
| 2625 | return s elf | |
| 2626 | } | |
| 2627 | Request.pr ototype.aw s = functi on (opts, now) { | |
| 2628 | var self = this | |
| 2629 | ||
| 2630 | if (!now ) { | |
| 2631 | self._ aws = opts | |
| 2632 | return self | |
| 2633 | } | |
| 2634 | ||
| 2635 | if (opts .sign_vers ion == 4 | | opts.sig n_version == '4') { | |
| 2636 | var aw s4 = requi re('aws4') | |
| 2637 | // use aws4 | |
| 2638 | var op tions = { | |
| 2639 | host : self.uri .host, | |
| 2640 | path : self.uri .path, | |
| 2641 | meth od: self.m ethod, | |
| 2642 | head ers: { | |
| 2643 | 'c ontent-typ e': self.g etHeader(' content-ty pe') || '' | |
| 2644 | }, | |
| 2645 | body : self.bod y | |
| 2646 | } | |
| 2647 | var si gnRes = aw s4.sign(op tions, { | |
| 2648 | acce ssKeyId: o pts.key, | |
| 2649 | secr etAccessKe y: opts.se cret | |
| 2650 | }) | |
| 2651 | self.s etHeader(' authorizat ion', sign Res.header s.Authoriz ation) | |
| 2652 | self.s etHeader(' x-amz-date ', signRes .headers[' X-Amz-Date ']) | |
| 2653 | } | |
| 2654 | else { | |
| 2655 | // def ault: use aws-sign2 | |
| 2656 | var da te = new D ate() | |
| 2657 | self.s etHeader(' date', dat e.toUTCStr ing()) | |
| 2658 | var au th = | |
| 2659 | { ke y: opts.ke y | |
| 2660 | , se cret: opts .secret | |
| 2661 | , ve rb: self.m ethod.toUp perCase() | |
| 2662 | , da te: date | |
| 2663 | , co ntentType: self.getH eader('con tent-type' ) || '' | |
| 2664 | , md 5: self.ge tHeader('c ontent-md5 ') || '' | |
| 2665 | , am azonHeader s: aws2.ca nonicalize Headers(se lf.headers ) | |
| 2666 | } | |
| 2667 | var pa th = self. uri.path | |
| 2668 | if (op ts.bucket && path) { | |
| 2669 | auth .resource = '/' + op ts.bucket + path | |
| 2670 | } else if (opts. bucket && !path) { | |
| 2671 | auth .resource = '/' + op ts.bucket | |
| 2672 | } else if (!opts .bucket && path) { | |
| 2673 | auth .resource = path | |
| 2674 | } else if (!opts .bucket && !path) { | |
| 2675 | auth .resource = '/' | |
| 2676 | } | |
| 2677 | auth.r esource = aws2.canon icalizeRes ource(auth .resource) | |
| 2678 | self.s etHeader(' authorizat ion', aws2 .authoriza tion(auth) ) | |
| 2679 | } | |
| 2680 | ||
| 2681 | return s elf | |
| 2682 | } | |
| 2683 | Request.pr ototype.ht tpSignatur e = functi on (opts) { | |
| 2684 | var self = this | |
| 2685 | httpSign ature.sign Request({ | |
| 2686 | getHea der: funct ion(header ) { | |
| 2687 | retu rn self.ge tHeader(he ader, self .headers) | |
| 2688 | }, | |
| 2689 | setHea der: funct ion(header , value) { | |
| 2690 | self .setHeader (header, v alue) | |
| 2691 | }, | |
| 2692 | method : self.met hod, | |
| 2693 | path: self.path | |
| 2694 | }, opts) | |
| 2695 | debug('h ttpSignatu re authori zation', s elf.getHea der('autho rization') ) | |
| 2696 | ||
| 2697 | return s elf | |
| 2698 | } | |
| 2699 | Request.pr ototype.ha wk = funct ion (opts) { | |
| 2700 | var self = this | |
| 2701 | self.set Header('Au thorizatio n', hawk.c lient.head er(self.ur i, self.me thod, opts ).field) | |
| 2702 | } | |
| 2703 | Request.pr ototype.oa uth = func tion (_oau th) { | |
| 2704 | var self = this | |
| 2705 | ||
| 2706 | self._oa uth.onRequ est(_oauth ) | |
| 2707 | ||
| 2708 | return s elf | |
| 2709 | } | |
| 2710 | ||
| 2711 | Request.pr ototype.ja r = functi on (jar) { | |
| 2712 | var self = this | |
| 2713 | var cook ies | |
| 2714 | ||
| 2715 | if (self ._redirect .redirects Followed = == 0) { | |
| 2716 | self.o riginalCoo kieHeader = self.get Header('co okie') | |
| 2717 | } | |
| 2718 | ||
| 2719 | if (!jar ) { | |
| 2720 | // dis able cooki es | |
| 2721 | cookie s = false | |
| 2722 | self._ disableCoo kies = tru e | |
| 2723 | } else { | |
| 2724 | var ta rgetCookie Jar = (jar && jar.ge tCookieStr ing) ? jar : globalC ookieJar | |
| 2725 | var ur ihref = se lf.uri.hre f | |
| 2726 | //fetc h cookie i n the Spec ified host | |
| 2727 | if (ta rgetCookie Jar) { | |
| 2728 | cook ies = targ etCookieJa r.getCooki eString(ur ihref) | |
| 2729 | } | |
| 2730 | } | |
| 2731 | ||
| 2732 | //if nee d cookie a nd cookie is not emp ty | |
| 2733 | if (cook ies && coo kies.lengt h) { | |
| 2734 | if (se lf.origina lCookieHea der) { | |
| 2735 | // D on't overw rite exist ing Cookie header | |
| 2736 | self .setHeader ('cookie', self.orig inalCookie Header + ' ; ' + cook ies) | |
| 2737 | } else { | |
| 2738 | self .setHeader ('cookie', cookies) | |
| 2739 | } | |
| 2740 | } | |
| 2741 | self._ja r = jar | |
| 2742 | return s elf | |
| 2743 | } | |
| 2744 | ||
| 2745 | ||
| 2746 | // Stream API | |
| 2747 | Request.pr ototype.pi pe = funct ion (dest, opts) { | |
| 2748 | var self = this | |
| 2749 | ||
| 2750 | if (self .response) { | |
| 2751 | if (se lf._destda ta) { | |
| 2752 | self .emit('err or', new E rror('You cannot pip e after da ta has bee n emitted from the r esponse.') ) | |
| 2753 | } else if (self. _ended) { | |
| 2754 | self .emit('err or', new E rror('You cannot pip e after th e response has been ended.')) | |
| 2755 | } else { | |
| 2756 | stre am.Stream. prototype. pipe.call( self, dest , opts) | |
| 2757 | self .pipeDest( dest) | |
| 2758 | retu rn dest | |
| 2759 | } | |
| 2760 | } else { | |
| 2761 | self.d ests.push( dest) | |
| 2762 | stream .Stream.pr ototype.pi pe.call(se lf, dest, opts) | |
| 2763 | return dest | |
| 2764 | } | |
| 2765 | } | |
| 2766 | Request.pr ototype.wr ite = func tion () { | |
| 2767 | var self = this | |
| 2768 | if (self ._aborted) {return} | |
| 2769 | ||
| 2770 | if (!sel f._started ) { | |
| 2771 | self.s tart() | |
| 2772 | } | |
| 2773 | return s elf.req.wr ite.apply( self.req, arguments) | |
| 2774 | } | |
| 2775 | Request.pr ototype.en d = functi on (chunk) { | |
| 2776 | var self = this | |
| 2777 | if (self ._aborted) {return} | |
| 2778 | ||
| 2779 | if (chun k) { | |
| 2780 | self.w rite(chunk ) | |
| 2781 | } | |
| 2782 | if (!sel f._started ) { | |
| 2783 | self.s tart() | |
| 2784 | } | |
| 2785 | if (self .req) { | |
| 2786 | self.r eq.end() | |
| 2787 | } | |
| 2788 | } | |
| 2789 | Request.pr ototype.pa use = func tion () { | |
| 2790 | var self = this | |
| 2791 | if (!sel f.response Content) { | |
| 2792 | self._ paused = t rue | |
| 2793 | } else { | |
| 2794 | self.r esponseCon tent.pause .apply(sel f.response Content, a rguments) | |
| 2795 | } | |
| 2796 | } | |
| 2797 | Request.pr ototype.re sume = fun ction () { | |
| 2798 | var self = this | |
| 2799 | if (!sel f.response Content) { | |
| 2800 | self._ paused = f alse | |
| 2801 | } else { | |
| 2802 | self.r esponseCon tent.resum e.apply(se lf.respons eContent, arguments) | |
| 2803 | } | |
| 2804 | } | |
| 2805 | Request.pr ototype.de stroy = fu nction () { | |
| 2806 | var self = this | |
| 2807 | if (!sel f._ended) { | |
| 2808 | self.e nd() | |
| 2809 | } else i f (self.re sponse) { | |
| 2810 | self.r esponse.de stroy() | |
| 2811 | } | |
| 2812 | } | |
| 2813 | ||
| 2814 | Request.de faultProxy HeaderWhit eList = | |
| 2815 | Tunnel.d efaultProx yHeaderWhi teList.sli ce() | |
| 2816 | ||
| 2817 | Request.de faultProxy HeaderExcl usiveList = | |
| 2818 | Tunnel.d efaultProx yHeaderExc lusiveList .slice() | |
| 2819 | ||
| 2820 | // Exports | |
| 2821 | ||
| 2822 | Request.pr ototype.to JSON = req uestToJSON | |
| 2823 | module.exp orts = Req uest | |
| 2824 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000package/. travis.yml \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000000664 \x00000 01750 \x0000001 750 \x000000000 00662 \x0000127 03170723\x00000 12652 \x00000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000us tar\x000000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 000000 \x000000 0000 \x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000languag e: node_js | |
| 2825 | ||
| 2826 | node_js: | |
| 2827 | - node | |
| 2828 | - 0.12 | |
| 2829 | - 0.10 | |
| 2830 | ||
| 2831 | after_scri pt: | |
| 2832 | - npm ru n test-cov | |
| 2833 | - cat ./ coverage/l cov.info | codecov | |
| 2834 | - cat ./ coverage/l cov.info | coveralls | |
| 2835 | ||
| 2836 | webhooks: | |
| 2837 | urls: ht tps://webh ooks.gitte r.im/e/237 280ed4796c 19cc626 | |
| 2838 | on_succe ss: change # option s: [always |never|cha nge] defau lt: always | |
| 2839 | on_failu re: always # option s: [always |never|cha nge] defau lt: always | |
| 2840 | on_start : false # defaul t: false | |
| 2841 | ||
| 2842 | sudo: fals e | |
| 2843 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000pa ckage/CHAN GELOG.md\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x000000 0664 \x00000017 50 \x0000001750 \x000000001632 10 \x0000127031 71456\x00000123 55 \x00000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000ustar \x000000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000000 000 \x000000000 0 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 ## Change Log | |
| 2844 | ||
| 2845 | ### v2.71. 0 (2016/04 /12) | |
| 2846 | - [#2164]( https://gi thub.com/r equest/req uest/pull/ 2164) Catc h errors f rom the un derlying h ttp module (@simov) | |
| 2847 | ||
| 2848 | ### v2.70. 0 (2016/04 /05) | |
| 2849 | - [#2147]( https://gi thub.com/r equest/req uest/pull/ 2147) Upda te eslint to version 2.5.3 🚠€ (@simov, @greenkee perio-bot) | |
| 2850 | - [#2009]( https://gi thub.com/r equest/req uest/pull/ 2009) Supp ort JSON s tringify r eplacer ar gument. (@ elyobo) | |
| 2851 | - [#2142]( https://gi thub.com/r equest/req uest/pull/ 2142) Upda te eslint to version 2.5.1 🚠€ (@greenk eeperio-bo t) | |
| 2852 | - [#2128]( https://gi thub.com/r equest/req uest/pull/ 2128) Upda te browser ify-istanb ul to vers ion 2.0.0 🚀 (@gre enkeeperio -bot) | |
| 2853 | - [#2115]( https://gi thub.com/r equest/req uest/pull/ 2115) Upda te eslint to version 2.3.0 🚠€ (@simov, @greenkee perio-bot) | |
| 2854 | - [#2089]( https://gi thub.com/r equest/req uest/pull/ 2089) Fix badges (@s imov) | |
| 2855 | - [#2092]( https://gi thub.com/r equest/req uest/pull/ 2092) Upda te browser ify-istanb ul to vers ion 1.0.0 🚀 (@gre enkeeperio -bot) | |
| 2856 | - [#2079]( https://gi thub.com/r equest/req uest/pull/ 2079) Acce pt read st ream as bo dy option (@simov) | |
| 2857 | - [#2070]( https://gi thub.com/r equest/req uest/pull/ 2070) Upda te bl to v ersion 1.1 .2 🚀 (@ greenkeepe rio-bot) | |
| 2858 | - [#2063]( https://gi thub.com/r equest/req uest/pull/ 2063) Up b luebird an d oauth-si gn (@simov ) | |
| 2859 | - [#2058]( https://gi thub.com/r equest/req uest/pull/ 2058) Karm a fixes fo r latest v ersions (@ eiriksm) | |
| 2860 | - [#2057]( https://gi thub.com/r equest/req uest/pull/ 2057) Upda te contrib uting guid elines (@s imov) | |
| 2861 | - [#2054]( https://gi thub.com/r equest/req uest/pull/ 2054) Upda te qs to v ersion 6.1 .0 🚀 (@ greenkeepe rio-bot) | |
| 2862 | ||
| 2863 | ### v2.69. 0 (2016/01 /27) | |
| 2864 | - [#2041]( https://gi thub.com/r equest/req uest/pull/ 2041) rest ore aws4 a s regular dependency (@rmg) | |
| 2865 | ||
| 2866 | ### v2.68. 0 (2016/01 /27) | |
| 2867 | - [#2036]( https://gi thub.com/r equest/req uest/pull/ 2036) Add AWS Signat ure Versio n 4 (@simo v, @mirkod s) | |
| 2868 | - [#2022]( https://gi thub.com/r equest/req uest/pull/ 2022) Conv ert numeri c multipar t bodies t o string ( @simov, @f eross) | |
| 2869 | - [#2024]( https://gi thub.com/r equest/req uest/pull/ 2024) Upda te har-val idator dep endency fo r nsp advi sory #76 ( @TylerDixo n) | |
| 2870 | - [#2016]( https://gi thub.com/r equest/req uest/pull/ 2016) Upda te qs to v ersion 6.0 .2 🚀 (@ greenkeepe rio-bot) | |
| 2871 | - [#2007]( https://gi thub.com/r equest/req uest/pull/ 2007) Use the `exten d` module instead of util._ext end (@simo v) | |
| 2872 | - [#2003]( https://gi thub.com/r equest/req uest/pull/ 2003) Upda te browser ify to ver sion 13.0. 0 🚀 (@g reenkeeper io-bot) | |
| 2873 | - [#1989]( https://gi thub.com/r equest/req uest/pull/ 1989) Upda te buffer- equal to v ersion 1.0 .0 🚀 (@ greenkeepe rio-bot) | |
| 2874 | - [#1956]( https://gi thub.com/r equest/req uest/pull/ 1956) Chec k form-dat a content- length val ue before setting up the heade r (@jongyo onlee) | |
| 2875 | - [#1958]( https://gi thub.com/r equest/req uest/pull/ 1958) Use IncomingMe ssage.dest roy method (@simov) | |
| 2876 | - [#1952]( https://gi thub.com/r equest/req uest/pull/ 1952) Adds example f or Tor pro xy (@prome theansacri fice) | |
| 2877 | - [#1943]( https://gi thub.com/r equest/req uest/pull/ 1943) Upda te eslint to version 1.10.3 🠚€ (@simov , @greenke eperio-bot ) | |
| 2878 | - [#1924]( https://gi thub.com/r equest/req uest/pull/ 1924) Upda te eslint to version 1.10.1 🠚€ (@green keeperio-b ot) | |
| 2879 | - [#1915]( https://gi thub.com/r equest/req uest/pull/ 1915) Remo ve content -length an d transfer -encoding headers fr om default ProxyHeade rWhiteList (@yaxia) | |
| 2880 | ||
| 2881 | ### v2.67. 0 (2015/11 /19) | |
| 2882 | - [#1913]( https://gi thub.com/r equest/req uest/pull/ 1913) Upda te http-si gnature to version 1 .1.0 🚀 (@greenkee perio-bot) | |
| 2883 | ||
| 2884 | ### v2.66. 0 (2015/11 /18) | |
| 2885 | - [#1906]( https://gi thub.com/r equest/req uest/pull/ 1906) Upda te README URLs based on HTTP r edirects ( @ReadmeCri tic) | |
| 2886 | - [#1905]( https://gi thub.com/r equest/req uest/pull/ 1905) Conv ert typed arrays int o regular buffers (@ simov) | |
| 2887 | - [#1902]( https://gi thub.com/r equest/req uest/pull/ 1902) node -uuid@1.4. 7 breaks b uild 🚨 (@greenkee perio-bot) | |
| 2888 | - [#1894]( https://gi thub.com/r equest/req uest/pull/ 1894) Fix tunneling after redi rection fr om https ( Original: #1881) (@s imov, @fal ms) | |
| 2889 | - [#1893]( https://gi thub.com/r equest/req uest/pull/ 1893) Upda te eslint to version 1.9.0 🚠€ (@greenk eeperio-bo t) | |
| 2890 | - [#1852]( https://gi thub.com/r equest/req uest/pull/ 1852) Upda te eslint to version 1.7.3 🚠€ (@simov, @greenkee perio-bot, @paulomcn ally, @mic helsalib, @arbaaz, @ vladimiric h, @LoicMa hieu, @Jos hWillik, @ jzaefferer , @ryanwho ley, @djch ie, @thisc onnect, @m genereu, @ acroca, @S ebmaster, @Bloutiouf ) | |
| 2891 | - [#1876]( https://gi thub.com/r equest/req uest/pull/ 1876) Impl ement loos e matching for har m ime types (@simov) | |
| 2892 | - [#1875]( https://gi thub.com/r equest/req uest/pull/ 1875) Upda te bluebir d to versi on 3.0.2 ð Ÿš€ (@simo v, @greenk eeperio-bo t) | |
| 2893 | - [#1871]( https://gi thub.com/r equest/req uest/pull/ 1871) Upda te browser ify to ver sion 12.0. 1 🚀 (@g reenkeeper io-bot) | |
| 2894 | - [#1866]( https://gi thub.com/r equest/req uest/pull/ 1866) Add missing qu otes on x- token prop erty in RE ADME (@mig uelmota) | |
| 2895 | - [#1874]( https://gi thub.com/r equest/req uest/pull/ 1874) Fix typo in RE ADME.md (@ gswalden) | |
| 2896 | - [#1860]( https://gi thub.com/r equest/req uest/pull/ 1860) Impr ove refere r header t ests and d ocs (@simo v) | |
| 2897 | - [#1861]( https://gi thub.com/r equest/req uest/pull/ 1861) Remo ve redunda nt call to Stream co nstructor (@watson) | |
| 2898 | - [#1857]( https://gi thub.com/r equest/req uest/pull/ 1857) Fix Referer he ader to po int to the original host name (@simov) | |
| 2899 | - [#1850]( https://gi thub.com/r equest/req uest/pull/ 1850) Upda te karma-c overage to version 0 .5.3 🚀 (@greenkee perio-bot) | |
| 2900 | - [#1847]( https://gi thub.com/r equest/req uest/pull/ 1847) Use node's lat est versio n when bui lding (@si mov) | |
| 2901 | - [#1836]( https://gi thub.com/r equest/req uest/pull/ 1836) Tunn el: fix wr ong proper ty name (@ Bloutiouf) | |
| 2902 | - [#1820]( https://gi thub.com/r equest/req uest/pull/ 1820) Set href as re quest.js u ses it (@m genereu) | |
| 2903 | - [#1840]( https://gi thub.com/r equest/req uest/pull/ 1840) Upda te http-si gnature to version 1 .0.2 🚀 (@greenkee perio-bot) | |
| 2904 | - [#1845]( https://gi thub.com/r equest/req uest/pull/ 1845) Upda te istanbu l to versi on 0.4.0 ð Ÿš€ (@gree nkeeperio- bot) | |
| 2905 | ||
| 2906 | ### v2.65. 0 (2015/10 /11) | |
| 2907 | - [#1833]( https://gi thub.com/r equest/req uest/pull/ 1833) Upda te aws-sig n2 to vers ion 0.6.0 🚀 (@gre enkeeperio -bot) | |
| 2908 | - [#1811]( https://gi thub.com/r equest/req uest/pull/ 1811) Enab le loose c ookie pars ing in tou gh-cookie (@Sebmaste r) | |
| 2909 | - [#1830]( https://gi thub.com/r equest/req uest/pull/ 1830) Brin g back til de ranges for all de pendencies (@simov) | |
| 2910 | - [#1821]( https://gi thub.com/r equest/req uest/pull/ 1821) Impl ement supp ort for RF C 2617 MD5 -sess algo rithm. (@B igDSK) | |
| 2911 | - [#1828]( https://gi thub.com/r equest/req uest/pull/ 1828) Upda ted qs dep endency to 5.2.0 (@a croca) | |
| 2912 | - [#1818]( https://gi thub.com/r equest/req uest/pull/ 1818) Extr act `readR esponseBod y` method out of `on RequestRes ponse` (@p voisin) | |
| 2913 | - [#1819]( https://gi thub.com/r equest/req uest/pull/ 1819) Run stringify once (@mge nereu) | |
| 2914 | - [#1814]( https://gi thub.com/r equest/req uest/pull/ 1814) Upda ted har-va lidator to version 2 .0.2 (@gre enkeeperio -bot) | |
| 2915 | - [#1807]( https://gi thub.com/r equest/req uest/pull/ 1807) Upda ted tough- cookie to version 2. 1.0 (@gree nkeeperio- bot) | |
| 2916 | - [#1800]( https://gi thub.com/r equest/req uest/pull/ 1800) Add caret rang es for dev Dependenci es, except eslint (@ simov) | |
| 2917 | - [#1799]( https://gi thub.com/r equest/req uest/pull/ 1799) Upda ted karma- browserify to versio n 4.4.0 (@ greenkeepe rio-bot) | |
| 2918 | - [#1797]( https://gi thub.com/r equest/req uest/pull/ 1797) Upda ted tape t o version 4.2.0 (@gr eenkeeperi o-bot) | |
| 2919 | - [#1788]( https://gi thub.com/r equest/req uest/pull/ 1788) Pinn ed all dep endencies (@greenkee perio-bot) | |
| 2920 | ||
| 2921 | ### v2.64. 0 (2015/09 /25) | |
| 2922 | - [#1787]( https://gi thub.com/r equest/req uest/pull/ 1787) npm ignore exa mples, rel ease.sh an d disabled .appveyor. yml (@this connect) | |
| 2923 | - [#1775]( https://gi thub.com/r equest/req uest/pull/ 1775) Fix typo in RE ADME.md (@ djchie) | |
| 2924 | - [#1776]( https://gi thub.com/r equest/req uest/pull/ 1776) Chan ged word ' conjuction ' to read 'conjuncti on' in REA DME.md (@r yanwholey) | |
| 2925 | - [#1785]( https://gi thub.com/r equest/req uest/pull/ 1785) Reve rt: Set de fault appl ication/js on content -type when using jso n option # 1772 (@sim ov) | |
| 2926 | ||
| 2927 | ### v2.63. 0 (2015/09 /21) | |
| 2928 | - [#1772]( https://gi thub.com/r equest/req uest/pull/ 1772) Set default ap plication/ json conte nt-type wh en using j son option (@jzaeffe rer) | |
| 2929 | ||
| 2930 | ### v2.62. 0 (2015/09 /15) | |
| 2931 | - [#1768]( https://gi thub.com/r equest/req uest/pull/ 1768) Add node 4.0 t o the list of build targets (@ simov) | |
| 2932 | - [#1767]( https://gi thub.com/r equest/req uest/pull/ 1767) Quer y strings now cooper ate with u nix socket s (@JoshWi llik) | |
| 2933 | - [#1750]( https://gi thub.com/r equest/req uest/pull/ 1750) Reve rt doc abo ut install ation of t ough-cooki e added in #884 (@Lo icMahieu) | |
| 2934 | - [#1746]( https://gi thub.com/r equest/req uest/pull/ 1746) Miss ed comma i n Readme ( @vladimiri ch) | |
| 2935 | - [#1743]( https://gi thub.com/r equest/req uest/pull/ 1743) Fix options no t being in itialized in default s method ( @simov) | |
| 2936 | ||
| 2937 | ### v2.61. 0 (2015/08 /19) | |
| 2938 | - [#1721]( https://gi thub.com/r equest/req uest/pull/ 1721) Mino r fix in R EADME.md ( @arbaaz) | |
| 2939 | - [#1733]( https://gi thub.com/r equest/req uest/pull/ 1733) Avoi d useless Buffer tra nsformatio n (@michel salib) | |
| 2940 | - [#1726]( https://gi thub.com/r equest/req uest/pull/ 1726) Upda te README. md (@paulo mcnally) | |
| 2941 | - [#1715]( https://gi thub.com/r equest/req uest/pull/ 1715) Fix forever op tion in no de > 0.10 #1709 (@ca libr) | |
| 2942 | - [#1716]( https://gi thub.com/r equest/req uest/pull/ 1716) Do n ot create Buffer fro m Object i n setConte ntLength(i ojs v3.0 i ssue) (@ca libr) | |
| 2943 | - [#1711]( https://gi thub.com/r equest/req uest/pull/ 1711) Add ability to detect co nnect time outs (@kev inburke) | |
| 2944 | - [#1712]( https://gi thub.com/r equest/req uest/pull/ 1712) Set certificat e expirati on to Augu st 2, 2018 (@kevinbu rke) | |
| 2945 | - [#1700]( https://gi thub.com/r equest/req uest/pull/ 1700) debu g() when J SON.parse( ) on a res ponse body fails (@p hillipj) | |
| 2946 | ||
| 2947 | ### v2.60. 0 (2015/07 /21) | |
| 2948 | - [#1687]( https://gi thub.com/r equest/req uest/pull/ 1687) Fix caseless b ug - conte nt-type no t being se t for mult ipart/form -data (@si mov, @gary mathews) | |
| 2949 | ||
| 2950 | ### v2.59. 0 (2015/07 /20) | |
| 2951 | - [#1671]( https://gi thub.com/r equest/req uest/pull/ 1671) Add tests and docs for u sing the a gent, agen tClass, ag entOptions and forev er options . | |
| 2952 | Forever o ption defa ults to us ing http(s ).Agent in node 0.12 + (@simov) | |
| 2953 | - [#1679]( https://gi thub.com/r equest/req uest/pull/ 1679) Fix - do not r emove OAut h param wh en using O Auth realm (@simov, @jhalickma n) | |
| 2954 | - [#1668]( https://gi thub.com/r equest/req uest/pull/ 1668) upda ted depend encies (@d eamme) | |
| 2955 | - [#1656]( https://gi thub.com/r equest/req uest/pull/ 1656) Fix form metho d (@simov) | |
| 2956 | - [#1651]( https://gi thub.com/r equest/req uest/pull/ 1651) Pres erve HEAD method whe n using fo llowAllRed irects (@s imov) | |
| 2957 | - [#1652]( https://gi thub.com/r equest/req uest/pull/ 1652) Upda te `encodi ng` option documenta tion in RE ADME.md (@ daniel347x ) | |
| 2958 | - [#1650]( https://gi thub.com/r equest/req uest/pull/ 1650) Allo w content- type overr iding when using the `form` op tion (@sim ov) | |
| 2959 | - [#1646]( https://gi thub.com/r equest/req uest/pull/ 1646) Clar ify the na ture of se tting `ca` in `agent Options` ( @jeffcharl es) | |
| 2960 | ||
| 2961 | ### v2.58. 0 (2015/06 /16) | |
| 2962 | - [#1638]( https://gi thub.com/r equest/req uest/pull/ 1638) Use the `exten d` module to deep ex tend in th e defaults method (@ simov) | |
| 2963 | - [#1631]( https://gi thub.com/r equest/req uest/pull/ 1631) Move tunnel lo gic into s eparate mo dule (@sim ov) | |
| 2964 | - [#1634]( https://gi thub.com/r equest/req uest/pull/ 1634) Fix OAuth quer y transpor t_method ( @simov) | |
| 2965 | - [#1603]( https://gi thub.com/r equest/req uest/pull/ 1603) Add codecov (@ simov) | |
| 2966 | ||
| 2967 | ### v2.57. 0 (2015/05 /31) | |
| 2968 | - [#1615]( https://gi thub.com/r equest/req uest/pull/ 1615) Repl ace '.clie nt' with ' .socket' a s the form er was dep recated in 2.2.0. (@ ChALkeR) | |
| 2969 | ||
| 2970 | ### v2.56. 0 (2015/05 /28) | |
| 2971 | - [#1610]( https://gi thub.com/r equest/req uest/pull/ 1610) Bump module de pendencies (@simov) | |
| 2972 | - [#1600]( https://gi thub.com/r equest/req uest/pull/ 1600) Extr act the qu erystring logic into separate module (@s imov) | |
| 2973 | - [#1607]( https://gi thub.com/r equest/req uest/pull/ 1607) Re-g enerate ce rtificates (@simov) | |
| 2974 | - [#1599]( https://gi thub.com/r equest/req uest/pull/ 1599) Move getProxyF romURI log ic below t he check f or Invaild URI (#159 5) (@simov ) | |
| 2975 | - [#1598]( https://gi thub.com/r equest/req uest/pull/ 1598) Fix the way ht tp verbs a re defined in order to please intellisen se IDEs (@ simov, @fl annelJesus ) | |
| 2976 | - [#1591]( https://gi thub.com/r equest/req uest/pull/ 1591) A fe w minor fi xes: (@sim ov) | |
| 2977 | - [#1584]( https://gi thub.com/r equest/req uest/pull/ 1584) Refa ctor test- default te sts (accor ding to co mments in #1430) (@s imov) | |
| 2978 | - [#1585]( https://gi thub.com/r equest/req uest/pull/ 1585) Fixi ng documen tation reg arding TLS options ( #1583) (@m ainakae) | |
| 2979 | - [#1574]( https://gi thub.com/r equest/req uest/pull/ 1574) Refr esh the oa uth_nonce on redirec t (#1573) (@simov) | |
| 2980 | - [#1570]( https://gi thub.com/r equest/req uest/pull/ 1570) Disc overed tes ts that we ren't prop erly runni ng (@seans trom) | |
| 2981 | - [#1569]( https://gi thub.com/r equest/req uest/pull/ 1569) Fix pause befo re respons e arrives (@kevinoid ) | |
| 2982 | - [#1558]( https://gi thub.com/r equest/req uest/pull/ 1558) Emit error ins tead of th row (@simo v) | |
| 2983 | - [#1568]( https://gi thub.com/r equest/req uest/pull/ 1568) Fix stall when piping gz ipped resp onse (@kev inoid) | |
| 2984 | - [#1560]( https://gi thub.com/r equest/req uest/pull/ 1560) Upda te combine d-stream ( @apechimp) | |
| 2985 | - [#1543]( https://gi thub.com/r equest/req uest/pull/ 1543) Init ial suppor t for oaut h_body_has h on json payloads ( @simov, @a esopwolf) | |
| 2986 | - [#1541]( https://gi thub.com/r equest/req uest/pull/ 1541) Fix coveralls (@simov) | |
| 2987 | - [#1540]( https://gi thub.com/r equest/req uest/pull/ 1540) Fix recursive defaults f or conveni ence metho ds (@simov ) | |
| 2988 | - [#1536]( https://gi thub.com/r equest/req uest/pull/ 1536) More eslint st yle rules (@froatsno ok) | |
| 2989 | - [#1533]( https://gi thub.com/r equest/req uest/pull/ 1533) Addi ng depende ncy status bar to RE ADME.md (@ YasharF) | |
| 2990 | - [#1539]( https://gi thub.com/r equest/req uest/pull/ 1539) ensu re the lat est versio n of har-v alidator i s included (@ahmadna ssri) | |
| 2991 | - [#1516]( https://gi thub.com/r equest/req uest/pull/ 1516) fore ver+pool t est (@devT ristan) | |
| 2992 | ||
| 2993 | ### v2.55. 0 (2015/04 /05) | |
| 2994 | - [#1520]( https://gi thub.com/r equest/req uest/pull/ 1520) Refa ctor defau lts (@simo v) | |
| 2995 | - [#1525]( https://gi thub.com/r equest/req uest/pull/ 1525) Dele te request headers w ith undefi ned value. (@froatsn ook) | |
| 2996 | - [#1521]( https://gi thub.com/r equest/req uest/pull/ 1521) Add promise te sts (@simo v) | |
| 2997 | - [#1518]( https://gi thub.com/r equest/req uest/pull/ 1518) Fix defaults ( @simov) | |
| 2998 | - [#1515]( https://gi thub.com/r equest/req uest/pull/ 1515) Allo w static i nvoking of convenien ce methods (@simov) | |
| 2999 | - [#1505]( https://gi thub.com/r equest/req uest/pull/ 1505) Fix multipart boundary e xtraction regexp (@s imov) | |
| 3000 | - [#1510]( https://gi thub.com/r equest/req uest/pull/ 1510) Fix basic auth form data (@simov) | |
| 3001 | ||
| 3002 | ### v2.54. 0 (2015/03 /24) | |
| 3003 | - [#1501]( https://gi thub.com/r equest/req uest/pull/ 1501) HTTP Archive 1 .2 support (@ahmadna ssri) | |
| 3004 | - [#1486]( https://gi thub.com/r equest/req uest/pull/ 1486) Add a test for the forev er agent ( @akshayp) | |
| 3005 | - [#1500]( https://gi thub.com/r equest/req uest/pull/ 1500) Addi ng handlin g for no a uth method and null bearer (@p hilberg) | |
| 3006 | - [#1498]( https://gi thub.com/r equest/req uest/pull/ 1498) Add table of c ontents in readme (@ simov) | |
| 3007 | - [#1477]( https://gi thub.com/r equest/req uest/pull/ 1477) Add support fo r qs optio ns via qsO ptions key (@simov) | |
| 3008 | - [#1496]( https://gi thub.com/r equest/req uest/pull/ 1496) Para meters enc oded to ba se 64 shou ld be deco ded as UTF -8, not AS CII. (@alb anm) | |
| 3009 | - [#1494]( https://gi thub.com/r equest/req uest/pull/ 1494) Upda te eslint (@froatsno ok) | |
| 3010 | - [#1474]( https://gi thub.com/r equest/req uest/pull/ 1474) Requ ire Colon in Basic A uth (@eryk walder) | |
| 3011 | - [#1481]( https://gi thub.com/r equest/req uest/pull/ 1481) Fix baseUrl an d redirect ions. (@bu rningtree) | |
| 3012 | - [#1469]( https://gi thub.com/r equest/req uest/pull/ 1469) Feat ure/base u rl (@froat snook) | |
| 3013 | - [#1459]( https://gi thub.com/r equest/req uest/pull/ 1459) Add option to time reque st/respons e cycle (i ncluding r ollup of r edirects) (@aaron-em ) | |
| 3014 | - [#1468]( https://gi thub.com/r equest/req uest/pull/ 1468) Re-e nable io.j s/node 0.1 2 build (@ simov, @mi keal, @BBB ) | |
| 3015 | - [#1442]( https://gi thub.com/r equest/req uest/pull/ 1442) Fixe d the issu e with str ictSSL tes ts on 0.1 2 & io.js by explici tly settin g a cipher that matc hes the ce rt. (@BBB, @nicolasm ccurdy, @d emohi, @si mov, @0x41 39) | |
| 3016 | - [#1460]( https://gi thub.com/r equest/req uest/pull/ 1460) loca lAddress o r proxy co nfig is lo st when re directing (@simov, @ 0x4139) | |
| 3017 | - [#1453]( https://gi thub.com/r equest/req uest/pull/ 1453) Test on Node.j s 0.12 and io.js wit h allowed failures ( @nicolasmc curdy, @de mohi) | |
| 3018 | - [#1426]( https://gi thub.com/r equest/req uest/pull/ 1426) Fixi ng tests t o pass on io.js and node 0.12 (only test -https.js stiff fail ing) (@mik eal) | |
| 3019 | - [#1446]( https://gi thub.com/r equest/req uest/pull/ 1446) Miss ing HTTP r eferer hea der with r edirects F ixes #1038 (@simov, @guimonz) | |
| 3020 | - [#1428]( https://gi thub.com/r equest/req uest/pull/ 1428) Depr ecate Node v0.8.x (@ nylen) | |
| 3021 | - [#1436]( https://gi thub.com/r equest/req uest/pull/ 1436) Add ability to set a req uester wit hout setti ng default options ( @tikotzky) | |
| 3022 | - [#1435]( https://gi thub.com/r equest/req uest/pull/ 1435) dry up verb me thods (@se thpollack) | |
| 3023 | - [#1423]( https://gi thub.com/r equest/req uest/pull/ 1423) Allo w fully qu alified mu ltipart co ntent-type header (@ simov) | |
| 3024 | - [#1430]( https://gi thub.com/r equest/req uest/pull/ 1430) Fix recursive requester (@tikotzky ) | |
| 3025 | - [#1429]( https://gi thub.com/r equest/req uest/pull/ 1429) Thro w error wh en making HEAD reque st with a body (@tik otzky) | |
| 3026 | - [#1419]( https://gi thub.com/r equest/req uest/pull/ 1419) Add note that the projec t is broke n in 0.12. x (@nylen) | |
| 3027 | - [#1413]( https://gi thub.com/r equest/req uest/pull/ 1413) Fix basic auth (@simov) | |
| 3028 | - [#1397]( https://gi thub.com/r equest/req uest/pull/ 1397) Impr ove pipe-f rom-file t ests (@nyl en) | |
| 3029 | ||
| 3030 | ### v2.53. 0 (2015/02 /02) | |
| 3031 | - [#1396]( https://gi thub.com/r equest/req uest/pull/ 1396) Do n ot rfc3986 escape JS ON bodies (@nylen, @ simov) | |
| 3032 | - [#1392]( https://gi thub.com/r equest/req uest/pull/ 1392) Impr ove `timeo ut` option descripti on (@watso n) | |
| 3033 | ||
| 3034 | ### v2.52. 0 (2015/02 /02) | |
| 3035 | - [#1383]( https://gi thub.com/r equest/req uest/pull/ 1383) Add missing HT TPS option s that wer e not bein g passed t o tunnel ( @brichard1 9) (@nylen ) | |
| 3036 | - [#1388]( https://gi thub.com/r equest/req uest/pull/ 1388) Upgr ade mime-t ypes packa ge version (@roderic khsiao) | |
| 3037 | - [#1389]( https://gi thub.com/r equest/req uest/pull/ 1389) Revi se Setup T unnel Func tion (@sea nstrom) | |
| 3038 | - [#1374]( https://gi thub.com/r equest/req uest/pull/ 1374) Allo w explicit ly disabli ng tunneli ng for pro xied https destinati ons (@nyle n) | |
| 3039 | - [#1376]( https://gi thub.com/r equest/req uest/pull/ 1376) Use karma-brow serify for tests. Ad d browser test cover age report er. (@eiri ksm) | |
| 3040 | - [#1366]( https://gi thub.com/r equest/req uest/pull/ 1366) Refa ctor OAuth into sepa rate modul e (@simov) | |
| 3041 | - [#1373]( https://gi thub.com/r equest/req uest/pull/ 1373) Rewr ite tunnel test to b e pure Nod e.js (@nyl en) | |
| 3042 | - [#1371]( https://gi thub.com/r equest/req uest/pull/ 1371) Upgr ade test r eporter (@ nylen) | |
| 3043 | - [#1360]( https://gi thub.com/r equest/req uest/pull/ 1360) Refa ctor basic , bearer, digest aut h logic in to separat e class (@ simov) | |
| 3044 | - [#1354]( https://gi thub.com/r equest/req uest/pull/ 1354) Remo ve circula r dependen cy from de bugging co de (@nylen ) | |
| 3045 | - [#1351]( https://gi thub.com/r equest/req uest/pull/ 1351) Move digest au th into pr ivate prot otype meth od (@simov ) | |
| 3046 | - [#1352]( https://gi thub.com/r equest/req uest/pull/ 1352) Upda te hawk de pendency t o ~2.3.0 ( @mridgway) | |
| 3047 | - [#1353]( https://gi thub.com/r equest/req uest/pull/ 1353) Corr ect travis -ci badge (@dogancel ik) | |
| 3048 | - [#1349]( https://gi thub.com/r equest/req uest/pull/ 1349) Make sure we r eturn on e rrored bro wser reque sts. (@eir iksm) | |
| 3049 | - [#1346]( https://gi thub.com/r equest/req uest/pull/ 1346) getP roxyFromUR I Extracti on Refacto r (@seanst rom) | |
| 3050 | - [#1337]( https://gi thub.com/r equest/req uest/pull/ 1337) Stan dardize te st ports o n 6767 (@n ylen) | |
| 3051 | - [#1341]( https://gi thub.com/r equest/req uest/pull/ 1341) Emit FormData error even ts as Requ est error events (@n ylen, @rwk y) | |
| 3052 | - [#1343]( https://gi thub.com/r equest/req uest/pull/ 1343) Clea n up readm e badges, and add Tr avis and C overalls b adges (@ny len) | |
| 3053 | - [#1345]( https://gi thub.com/r equest/req uest/pull/ 1345) Upda te README. md (@Aaron -Hartwig) | |
| 3054 | - [#1338]( https://gi thub.com/r equest/req uest/pull/ 1338) Alwa ys wait fo r server.c lose() cal lback in t ests (@nyl en) | |
| 3055 | - [#1342]( https://gi thub.com/r equest/req uest/pull/ 1342) Add mock https server an d redo sta rt of brow ser tests for this p urpose. (@ eiriksm) | |
| 3056 | - [#1339]( https://gi thub.com/r equest/req uest/pull/ 1339) Impr ove auth d ocs (@nyle n) | |
| 3057 | - [#1335]( https://gi thub.com/r equest/req uest/pull/ 1335) Add support fo r OAuth pl aintext si gnature me thod (@sim ov) | |
| 3058 | - [#1332]( https://gi thub.com/r equest/req uest/pull/ 1332) Add clean scri pt to remo ve test-br owser.js a fter the t ests run ( @seanstrom ) | |
| 3059 | - [#1327]( https://gi thub.com/r equest/req uest/pull/ 1327) Fix errors gen erating co verage rep orts. (@ny len) | |
| 3060 | - [#1330]( https://gi thub.com/r equest/req uest/pull/ 1330) Retu rn empty b uffer upon empty res ponse body and encod ing is set to null ( @seanstrom ) | |
| 3061 | - [#1326]( https://gi thub.com/r equest/req uest/pull/ 1326) Use faster con tainer-bas ed infrast ructure on Travis (@ nylen) | |
| 3062 | - [#1315]( https://gi thub.com/r equest/req uest/pull/ 1315) Impl ement rfc3 986 option (@simov, @nylen, @a poco, @Dul lReference Exception, @mmalecki , @oliamb, @cliffcro sland, @Le wisJEllis, @eiriksm, @poislaga rde) | |
| 3063 | - [#1314]( https://gi thub.com/r equest/req uest/pull/ 1314) Dete ct urlenco ded form d ata header via regex (@simov) | |
| 3064 | - [#1317]( https://gi thub.com/r equest/req uest/pull/ 1317) Impr ove OAuth1 .0 server side flow example (@ simov) | |
| 3065 | ||
| 3066 | ### v2.51. 0 (2014/12 /10) | |
| 3067 | - [#1310]( https://gi thub.com/r equest/req uest/pull/ 1310) Reve rt changes introduce d in https ://github. com/reques t/request/ pull/1282 (@simov) | |
| 3068 | ||
| 3069 | ### v2.50. 0 (2014/12 /09) | |
| 3070 | - [#1308]( https://gi thub.com/r equest/req uest/pull/ 1308) Add browser te st to keep track of browserify compabili ty. (@eiri ksm) | |
| 3071 | - [#1299]( https://gi thub.com/r equest/req uest/pull/ 1299) Add optional s upport for jsonReviv er (@poisl agarde) | |
| 3072 | - [#1277]( https://gi thub.com/r equest/req uest/pull/ 1277) Add Coveralls configurat ion (@simo v) | |
| 3073 | - [#1307]( https://gi thub.com/r equest/req uest/pull/ 1307) Upgr ade form-d ata, add b ack browse rify compa bility. Fi xes #455. (@eiriksm) | |
| 3074 | - [#1305]( https://gi thub.com/r equest/req uest/pull/ 1305) Fix typo in RE ADME.md (@ LewisJElli s) | |
| 3075 | - [#1288]( https://gi thub.com/r equest/req uest/pull/ 1288) Upda te README. md to expl ain custom file use case (@cli ffcrosland ) | |
| 3076 | ||
| 3077 | ### v2.49. 0 (2014/11 /28) | |
| 3078 | - [#1295]( https://gi thub.com/r equest/req uest/pull/ 1295) fix( proxy): no -proxy fal se positiv e (@oliamb ) | |
| 3079 | - [#1292]( https://gi thub.com/r equest/req uest/pull/ 1292) Upgr ade `casel ess` to 0. 8.1 (@mmal ecki) | |
| 3080 | - [#1276]( https://gi thub.com/r equest/req uest/pull/ 1276) Set transfer e ncoding fo r multipar t/related to chunked by defaul t (@simov) | |
| 3081 | - [#1275]( https://gi thub.com/r equest/req uest/pull/ 1275) Fix multipart content-ty pe headers detection (@simov) | |
| 3082 | - [#1269]( https://gi thub.com/r equest/req uest/pull/ 1269) adds streams e xample for review (@ tbuchok) | |
| 3083 | - [#1238]( https://gi thub.com/r equest/req uest/pull/ 1238) Add examples R EADME.md ( @simov) | |
| 3084 | ||
| 3085 | ### v2.48. 0 (2014/11 /12) | |
| 3086 | - [#1263]( https://gi thub.com/r equest/req uest/pull/ 1263) Fixe d a syntax error / t ypo in REA DME.md (@x na2) | |
| 3087 | - [#1253]( https://gi thub.com/r equest/req uest/pull/ 1253) Add multipart chunked fl ag (@simov , @nylen) | |
| 3088 | - [#1251]( https://gi thub.com/r equest/req uest/pull/ 1251) Clar ify that d efaults() does not m odify glob al default s (@nylen) | |
| 3089 | - [#1250]( https://gi thub.com/r equest/req uest/pull/ 1250) Impr ove docume ntation fo r pool and maxSocket s options (@nylen) | |
| 3090 | - [#1237]( https://gi thub.com/r equest/req uest/pull/ 1237) Docu menting er ror handli ng when us ing stream s (@vmatto s) | |
| 3091 | - [#1244]( https://gi thub.com/r equest/req uest/pull/ 1244) Fina lize chang elog comma nd (@nylen ) | |
| 3092 | - [#1241]( https://gi thub.com/r equest/req uest/pull/ 1241) Fix typo (@ale xanderGuge l) | |
| 3093 | - [#1223]( https://gi thub.com/r equest/req uest/pull/ 1223) Show latest ve rsion numb er instead of "upcom ing" in ch angelog (@ nylen) | |
| 3094 | - [#1236]( https://gi thub.com/r equest/req uest/pull/ 1236) Docu ment how t o use cust om CA in R EADME (#12 29) (@hype system) | |
| 3095 | - [#1228]( https://gi thub.com/r equest/req uest/pull/ 1228) Supp ort for oa uth with R SA-SHA1 si gning (@ny len) | |
| 3096 | - [#1216]( https://gi thub.com/r equest/req uest/pull/ 1216) Made json and multipart options co exist (@ny len, @simo v) | |
| 3097 | - [#1225]( https://gi thub.com/r equest/req uest/pull/ 1225) Allo w header w hite/exclu sive lists in any ca se. (@RRev erser) | |
| 3098 | ||
| 3099 | ### v2.47. 0 (2014/10 /26) | |
| 3100 | - [#1222]( https://gi thub.com/r equest/req uest/pull/ 1222) Move from mike al/request to reques t/request (@nylen) | |
| 3101 | - [#1220]( https://gi thub.com/r equest/req uest/pull/ 1220) upda te qs depe ndency to 2.3.1 (@Fr edKSchott) | |
| 3102 | - [#1212]( https://gi thub.com/r equest/req uest/pull/ 1212) Impr ove tests/ test-timeo ut.js (@ny len) | |
| 3103 | - [#1219]( https://gi thub.com/r equest/req uest/pull/ 1219) remo ve old glo balAgent w orkaround for node 0 .4 (@reque st) | |
| 3104 | - [#1214]( https://gi thub.com/r equest/req uest/pull/ 1214) Remo ve cruft l eft over f rom option al depende ncies (@ny len) | |
| 3105 | - [#1215]( https://gi thub.com/r equest/req uest/pull/ 1215) Add proxyHeade rExclusive List optio n for prox y-only hea ders. (@RR everser) | |
| 3106 | - [#1211]( https://gi thub.com/r equest/req uest/pull/ 1211) Allo w 'Host' h eader inst ead of 'ho st' and re member cas e across r edirects ( @nylen) | |
| 3107 | - [#1208]( https://gi thub.com/r equest/req uest/pull/ 1208) Impr ove releas e script ( @nylen) | |
| 3108 | - [#1213]( https://gi thub.com/r equest/req uest/pull/ 1213) Supp ort for cu stom cooki e store (@ nylen, @mi tsuru) | |
| 3109 | - [#1197]( https://gi thub.com/r equest/req uest/pull/ 1197) Clea n up some code aroun d setting the agent (@FredKSch ott) | |
| 3110 | - [#1209]( https://gi thub.com/r equest/req uest/pull/ 1209) Impr ove multip art form a ppend test (@simov) | |
| 3111 | - [#1207]( https://gi thub.com/r equest/req uest/pull/ 1207) Upda te changel og (@nylen ) | |
| 3112 | - [#1185]( https://gi thub.com/r equest/req uest/pull/ 1185) Stre am multipa rt/related bodies (@ simov) | |
| 3113 | ||
| 3114 | ### v2.46. 0 (2014/10 /23) | |
| 3115 | - [#1198]( https://gi thub.com/r equest/req uest/pull/ 1198) doc for TLS/SS L protocol options ( @shawnzhu) | |
| 3116 | - [#1200]( https://gi thub.com/r equest/req uest/pull/ 1200) Add a Gitter c hat badge to README. md (@gitte r-badger) | |
| 3117 | - [#1196]( https://gi thub.com/r equest/req uest/pull/ 1196) Upgr ade taper test repor ter to v0. 3.0 (@nyle n) | |
| 3118 | - [#1199]( https://gi thub.com/r equest/req uest/pull/ 1199) Fix lint error : undeclar ed var i ( @nylen) | |
| 3119 | - [#1191]( https://gi thub.com/r equest/req uest/pull/ 1191) Move self.prox y decision logic out of init a nd into a helper (@F redKSchott ) | |
| 3120 | - [#1190]( https://gi thub.com/r equest/req uest/pull/ 1190) Move _buildReq uest() log ic back in to init (@ FredKSchot t) | |
| 3121 | - [#1186]( https://gi thub.com/r equest/req uest/pull/ 1186) Supp ort Smarte r Unix URL Scheme (@ FredKSchot t) | |
| 3122 | - [#1178]( https://gi thub.com/r equest/req uest/pull/ 1178) upda te form do cumentatio n for new usage (@Fr edKSchott) | |
| 3123 | - [#1180]( https://gi thub.com/r equest/req uest/pull/ 1180) Enab le no-mixe d-requires linting r ule (@nyle n) | |
| 3124 | - [#1184]( https://gi thub.com/r equest/req uest/pull/ 1184) Don' t forward authorizat ion header across re directs to different hosts (@n ylen) | |
| 3125 | - [#1183]( https://gi thub.com/r equest/req uest/pull/ 1183) Corr ect README about pre and posta mble CRLF using mult ipart and not mult.. . (@netpoe tica) | |
| 3126 | - [#1179]( https://gi thub.com/r equest/req uest/pull/ 1179) Lint tests dir ectory (@n ylen) | |
| 3127 | - [#1169]( https://gi thub.com/r equest/req uest/pull/ 1169) add metadata f or form-da ta file fi eld (@dotc ypress) | |
| 3128 | - [#1173]( https://gi thub.com/r equest/req uest/pull/ 1173) remo ve optiona l dependen cies (@sea nstrom) | |
| 3129 | - [#1165]( https://gi thub.com/r equest/req uest/pull/ 1165) Clea nup event listeners and remove function creation f rom init ( @FredKScho tt) | |
| 3130 | - [#1174]( https://gi thub.com/r equest/req uest/pull/ 1174) upda te the req uest.cooki e docs to have a val id cookie example (@ seanstrom) | |
| 3131 | - [#1168]( https://gi thub.com/r equest/req uest/pull/ 1168) crea te a detac h helper a nd use det ach helper in replac e of nextT ick (@sean strom) | |
| 3132 | - [#1171]( https://gi thub.com/r equest/req uest/pull/ 1171) in p ost can se nd form da ta and use callback (@MiroRade novic) | |
| 3133 | - [#1159]( https://gi thub.com/r equest/req uest/pull/ 1159) acce pt charset for x-www -form-urle ncoded con tent-type (@seanstro m) | |
| 3134 | - [#1157]( https://gi thub.com/r equest/req uest/pull/ 1157) Upda te README. md: body w ith json=t rue (@Rob- -W) | |
| 3135 | - [#1164]( https://gi thub.com/r equest/req uest/pull/ 1164) Disa ble tests/ test-timeo ut.js on T ravis (@ny len) | |
| 3136 | - [#1153]( https://gi thub.com/r equest/req uest/pull/ 1153) Docu ment how t o run a si ngle test (@nylen) | |
| 3137 | - [#1144]( https://gi thub.com/r equest/req uest/pull/ 1144) adds documenta tion for t he "respon se" event within the streaming section ( @tbuchok) | |
| 3138 | - [#1162]( https://gi thub.com/r equest/req uest/pull/ 1162) Upda te eslintr c file to no longer allow past errors (@ FredKSchot t) | |
| 3139 | - [#1155]( https://gi thub.com/r equest/req uest/pull/ 1155) Supp ort/use se lf everywh ere (@sean strom) | |
| 3140 | - [#1161]( https://gi thub.com/r equest/req uest/pull/ 1161) fix no-use-bef ore-define lint warn ings (@emk ay) | |
| 3141 | - [#1156]( https://gi thub.com/r equest/req uest/pull/ 1156) addi ng curly b rackets to get rid o f lint err ors (@emka y) | |
| 3142 | - [#1151]( https://gi thub.com/r equest/req uest/pull/ 1151) Fix localAddre ss test on OS X (@ny len) | |
| 3143 | - [#1145]( https://gi thub.com/r equest/req uest/pull/ 1145) docu mentation: fix outda ted refere nce to set CookieSync old name in README (@FredKSch ott) | |
| 3144 | - [#1131]( https://gi thub.com/r equest/req uest/pull/ 1131) Upda te pool do cumentatio n (@FredKS chott) | |
| 3145 | - [#1143]( https://gi thub.com/r equest/req uest/pull/ 1143) Rewr ite all te sts to use tape (@ny len) | |
| 3146 | - [#1137]( https://gi thub.com/r equest/req uest/pull/ 1137) Add ability to specifiy querystrin g lib in o ptions. (@ jgrund) | |
| 3147 | - [#1138]( https://gi thub.com/r equest/req uest/pull/ 1138) allo w hostname and port in place o f host on uri (@capp slock) | |
| 3148 | - [#1134]( https://gi thub.com/r equest/req uest/pull/ 1134) Fix multiple r edirects a nd `self.f ollowRedir ect` (@bla keembrey) | |
| 3149 | - [#1130]( https://gi thub.com/r equest/req uest/pull/ 1130) docu mentation fix: add n ote about npm test f or contrib uting (@Fr edKSchott) | |
| 3150 | - [#1120]( https://gi thub.com/r equest/req uest/pull/ 1120) Supp ort/refact or request setup tun nel (@sean strom) | |
| 3151 | - [#1129]( https://gi thub.com/r equest/req uest/pull/ 1129) lint ing fix: c onvert dou ble quote strings to use singl e quotes ( @FredKScho tt) | |
| 3152 | - [#1124]( https://gi thub.com/r equest/req uest/pull/ 1124) lint ing fix: r emove unne ccesary se mi-colons (@FredKSch ott) | |
| 3153 | ||
| 3154 | ### v2.45. 0 (2014/10 /06) | |
| 3155 | - [#1128]( https://gi thub.com/r equest/req uest/pull/ 1128) Add test for s etCookie r egression (@nylen) | |
| 3156 | - [#1127]( https://gi thub.com/r equest/req uest/pull/ 1127) adde d tests ar ound using objects a s values i n a query string (@b coe) | |
| 3157 | - [#1103]( https://gi thub.com/r equest/req uest/pull/ 1103) Supp ort/refact or request construct or (@nylen , @seanstr om) | |
| 3158 | - [#1119]( https://gi thub.com/r equest/req uest/pull/ 1119) add basic lint ing to req uest libra ry (@FredK Schott) | |
| 3159 | - [#1121]( https://gi thub.com/r equest/req uest/pull/ 1121) Reve rt "Explic itly use s ync versio ns of cook ie functio ns" (@nyle n) | |
| 3160 | - [#1118]( https://gi thub.com/r equest/req uest/pull/ 1118) lint ing fix: R estructure bad empty if statem ent (@Fred KSchott) | |
| 3161 | - [#1117]( https://gi thub.com/r equest/req uest/pull/ 1117) Fix a bad chec k for vali d URIs (@F redKSchott ) | |
| 3162 | - [#1113]( https://gi thub.com/r equest/req uest/pull/ 1113) lint ing fix: s pace out o perators ( @FredKScho tt) | |
| 3163 | - [#1116]( https://gi thub.com/r equest/req uest/pull/ 1116) Fix typo in `n oProxyHost ` definiti on (@FredK Schott) | |
| 3164 | - [#1114]( https://gi thub.com/r equest/req uest/pull/ 1114) lint ing fix: A dded a `ne w` operato r that was missing w hen creati ng and thr owing a ne w error (@ FredKSchot t) | |
| 3165 | - [#1096]( https://gi thub.com/r equest/req uest/pull/ 1096) No_p roxy suppo rt (@samcd ay) | |
| 3166 | - [#1107]( https://gi thub.com/r equest/req uest/pull/ 1107) lint ing-fix: r emove unus ed variabl es (@FredK Schott) | |
| 3167 | - [#1112]( https://gi thub.com/r equest/req uest/pull/ 1112) lint ing fix: M ake return values co nsistent a nd more st raitforwar d (@FredKS chott) | |
| 3168 | - [#1111]( https://gi thub.com/r equest/req uest/pull/ 1111) lint ing fix: a uthPieces was gettin g redeclar ed (@FredK Schott) | |
| 3169 | - [#1105]( https://gi thub.com/r equest/req uest/pull/ 1105) Use strict mod e in reque st (@FredK Schott) | |
| 3170 | - [#1110]( https://gi thub.com/r equest/req uest/pull/ 1110) lint ing fix: r eplace laz y '==' wit h more str ict '===' (@FredKSch ott) | |
| 3171 | - [#1109]( https://gi thub.com/r equest/req uest/pull/ 1109) lint ing fix: r emove func tion call from if-el se conditi onal state ment (@Fre dKSchott) | |
| 3172 | - [#1102]( https://gi thub.com/r equest/req uest/pull/ 1102) Fix to allow s etting a ` requester` on recurs ive calls to `reques t.defaults ` (@tikotz ky) | |
| 3173 | - [#1095]( https://gi thub.com/r equest/req uest/pull/ 1095) Twea king engin es in pack age.json ( @pdehaan) | |
| 3174 | - [#1082]( https://gi thub.com/r equest/req uest/pull/ 1082) Forw ard the so cket event from the httpModule request ( @seanstrom ) | |
| 3175 | - [#972](h ttps://git hub.com/re quest/requ est/pull/9 72) Clarif y gzip han dling in t he README (@kevinoid ) | |
| 3176 | - [#1089]( https://gi thub.com/r equest/req uest/pull/ 1089) Ment ion that e ncoding de faults to utf8, not Buffer (@s tuartpb) | |
| 3177 | - [#1088]( https://gi thub.com/r equest/req uest/pull/ 1088) Fix cookie exa mple in RE ADME.md an d make it more clear (@pipi321 67) | |
| 3178 | - [#1027]( https://gi thub.com/r equest/req uest/pull/ 1027) Add support fo r multipar t form dat a in reque st options . (@crocke t) | |
| 3179 | - [#1076]( https://gi thub.com/r equest/req uest/pull/ 1076) use Request.ab ort() to a bort the r equest whe n the requ est has ti med-out (@ seanstrom) | |
| 3180 | - [#1068]( https://gi thub.com/r equest/req uest/pull/ 1068) add optional p ostamble r equired by .NET mult ipart requ ests (@net poetica) | |
| 3181 | ||
| 3182 | ### v2.43. 0 (2014/09 /18) | |
| 3183 | - [#1057]( https://gi thub.com/r equest/req uest/pull/ 1057) Defa ults shoul d not over write defi ned option s (@davidw ood) | |
| 3184 | - [#1046]( https://gi thub.com/r equest/req uest/pull/ 1046) Prop agate data stream err ors, usefu l in case gzip fails . (@ZJONSS ON, @Janpo t) | |
| 3185 | - [#1063]( https://gi thub.com/r equest/req uest/pull/ 1063) copy the input headers o bject #106 0 (@finnp) | |
| 3186 | - [#1031]( https://gi thub.com/r equest/req uest/pull/ 1031) Expl icitly use sync vers ions of co okie funct ions (@ZJO NSSON) | |
| 3187 | - [#1056]( https://gi thub.com/r equest/req uest/pull/ 1056) Fix redirects when passi ng url.par se(x) as U RL to conv enience me thod (@nyl en) | |
| 3188 | ||
| 3189 | ### v2.42. 0 (2014/09 /04) | |
| 3190 | - [#1053]( https://gi thub.com/r equest/req uest/pull/ 1053) Fix #1051 Pars e auth pro perly when using non -tunneling proxy (@i saacs) | |
| 3191 | ||
| 3192 | ### v2.41. 0 (2014/09 /04) | |
| 3193 | - [#1050]( https://gi thub.com/r equest/req uest/pull/ 1050) Pass whitelist ed headers to tunnel ing proxy. Organize all tunne ling logic . (@isaacs , @Feldhac ker) | |
| 3194 | - [#1035]( https://gi thub.com/r equest/req uest/pull/ 1035) soup ed up node i.co badge (@rvagg) | |
| 3195 | - [#1048]( https://gi thub.com/r equest/req uest/pull/ 1048) Aws is now pos sible over a proxy ( @steven-ae rts) | |
| 3196 | - [#1039]( https://gi thub.com/r equest/req uest/pull/ 1039) extr act out he lper funct ions to a helper fil e (@seanst rom) | |
| 3197 | - [#1021]( https://gi thub.com/r equest/req uest/pull/ 1021) Supp ort/refact or indexjs (@seanstr om) | |
| 3198 | - [#1033]( https://gi thub.com/r equest/req uest/pull/ 1033) Impr ove and do cument deb ug options (@nylen) | |
| 3199 | - [#1034]( https://gi thub.com/r equest/req uest/pull/ 1034) Fix readme hea dings (@ny len) | |
| 3200 | - [#1030]( https://gi thub.com/r equest/req uest/pull/ 1030) Allo w recursiv e request. defaults ( @tikotzky) | |
| 3201 | - [#1029]( https://gi thub.com/r equest/req uest/pull/ 1029) Fix a couple o f typos (@ nylen) | |
| 3202 | - [#675](h ttps://git hub.com/re quest/requ est/pull/6 75) Checki ng for SSL fault on connection before re ading SSL properties (@VRMink) | |
| 3203 | - [#989](h ttps://git hub.com/re quest/requ est/pull/9 89) Added allowRedir ect functi on. Should return tr ue if redi rect is al lowed or f alse other wise (@dor onin) | |
| 3204 | - [#1025]( https://gi thub.com/r equest/req uest/pull/ 1025) [fix es #1023] Set self._ ended to t rue once r esponse ha s ended (@ mridgway) | |
| 3205 | - [#1020]( https://gi thub.com/r equest/req uest/pull/ 1020) Add back remov ed debug m etadata (@ FredKSchot t) | |
| 3206 | - [#1008]( https://gi thub.com/r equest/req uest/pull/ 1008) Movi ng to mod ule instea d of cutom er buffer concatenat ion. (@mik eal) | |
| 3207 | - [#770](h ttps://git hub.com/re quest/requ est/pull/7 70) Added dependency badge for README fi le; (@timg luz, @mafi ntosh, @la litkapoor, @stash, @ bobyrizov) | |
| 3208 | - [#1016]( https://gi thub.com/r equest/req uest/pull/ 1016) toJS ON no long er results in an inf inite loop , returns simple obj ects (@Fre dKSchott) | |
| 3209 | - [#1018]( https://gi thub.com/r equest/req uest/pull/ 1018) Remo ve pre-0.4 .4 HTTPS f ix (@mmale cki) | |
| 3210 | - [#1006]( https://gi thub.com/r equest/req uest/pull/ 1006) Migr ate to cas eless, fix es #1001 ( @mikeal) | |
| 3211 | - [#995](h ttps://git hub.com/re quest/requ est/pull/9 95) Fix pa rsing arra y of objec ts (@sjonn et19) | |
| 3212 | - [#999](h ttps://git hub.com/re quest/requ est/pull/9 99) Fix fa llback for browserif y for opti onal modul es. (@eiri ksm) | |
| 3213 | - [#996](h ttps://git hub.com/re quest/requ est/pull/9 96) Wrong oauth sign ature when multiple same param keys exis t [updated ] (@bengl, @hyjin) | |
| 3214 | ||
| 3215 | ### v2.40. 0 (2014/08 /06) | |
| 3216 | - [#992](h ttps://git hub.com/re quest/requ est/pull/9 92) Fix se curity vul nerability . Update q s (@poetic ninja) | |
| 3217 | - [#988](h ttps://git hub.com/re quest/requ est/pull/9 88) “--â € -> “⠀”†(@up isfree) | |
| 3218 | - [#987](h ttps://git hub.com/re quest/requ est/pull/9 87) Show o ptional mo dules as b eing loade d by the m odule that reqeusted them (@ia rna) | |
| 3219 | ||
| 3220 | ### v2.39. 0 (2014/07 /24) | |
| 3221 | - [#976](h ttps://git hub.com/re quest/requ est/pull/9 76) Update README.md (@pvoznen ko) | |
| 3222 | ||
| 3223 | ### v2.38. 0 (2014/07 /22) | |
| 3224 | - [#952](h ttps://git hub.com/re quest/requ est/pull/9 52) Adding support t o client c ertificate with prox y use case (@ofirsha ked) | |
| 3225 | - [#884](h ttps://git hub.com/re quest/requ est/pull/8 84) Docume nted tough -cookie in stallation . (@wbyoun g) | |
| 3226 | - [#935](h ttps://git hub.com/re quest/requ est/pull/9 35) Correc t reposito ry url (@f ritx) | |
| 3227 | - [#963](h ttps://git hub.com/re quest/requ est/pull/9 63) Update changelog (@nylen) | |
| 3228 | - [#960](h ttps://git hub.com/re quest/requ est/pull/9 60) Suppor t gzip wit h encoding on node p re-v0.9.4 (@kevinoid ) | |
| 3229 | - [#953](h ttps://git hub.com/re quest/requ est/pull/9 53) Add as ync Conten t-Length c omputation when usin g form-dat a (@LoicMa hieu) | |
| 3230 | - [#844](h ttps://git hub.com/re quest/requ est/pull/8 44) Add su pport for HTTP[S]_PR OXY enviro nment vari ables. Fi xes #595. (@jvmccart hy) | |
| 3231 | - [#946](h ttps://git hub.com/re quest/requ est/pull/9 46) defaul ts: merge headers (@ aj0strow) | |
| 3232 | ||
| 3233 | ### v2.37. 0 (2014/07 /07) | |
| 3234 | - [#957](h ttps://git hub.com/re quest/requ est/pull/9 57) Silenc e EventEmi tter memor y leak war ning #311 (@watson) | |
| 3235 | - [#955](h ttps://git hub.com/re quest/requ est/pull/9 55) check for conten t-length h eader befo re setting it in nex tTick (@ca milleanne) | |
| 3236 | - [#951](h ttps://git hub.com/re quest/requ est/pull/9 51) Add su pport for gzip conte nt decodin g (@kevino id) | |
| 3237 | - [#949](h ttps://git hub.com/re quest/requ est/pull/9 49) Manual ly enter q uerystring in form o ption (@ch arlespwd) | |
| 3238 | - [#944](h ttps://git hub.com/re quest/requ est/pull/9 44) Make r equest wor k with bro wserify (@ eiriksm) | |
| 3239 | - [#943](h ttps://git hub.com/re quest/requ est/pull/9 43) New mi me module (@eiriksm) | |
| 3240 | - [#927](h ttps://git hub.com/re quest/requ est/pull/9 27) Bump v ersion of hawk dep. (@samccone ) | |
| 3241 | - [#907](h ttps://git hub.com/re quest/requ est/pull/9 07) append secureOpt ions to po olKey (@me dovob) | |
| 3242 | ||
| 3243 | ### v2.35. 0 (2014/05 /17) | |
| 3244 | - [#901](h ttps://git hub.com/re quest/requ est/pull/9 01) Fixes #555 (@pig ulla) | |
| 3245 | - [#897](h ttps://git hub.com/re quest/requ est/pull/8 97) merge with defau lt options (@vohof) | |
| 3246 | - [#891](h ttps://git hub.com/re quest/requ est/pull/8 91) fixes 857 - opti ons object is mutate d by calli ng request (@lalitka poor) | |
| 3247 | - [#869](h ttps://git hub.com/re quest/requ est/pull/8 69) Pipefi lter test (@tgohn) | |
| 3248 | - [#866](h ttps://git hub.com/re quest/requ est/pull/8 66) Fix ty po (@dandv ) | |
| 3249 | - [#861](h ttps://git hub.com/re quest/requ est/pull/8 61) Add su pport for RFC 6750 B earer Toke ns (@phedn y) | |
| 3250 | - [#809](h ttps://git hub.com/re quest/requ est/pull/8 09) upgrad e tunnel-p roxy to 0. 4.0 (@ksat o9700) | |
| 3251 | - [#850](h ttps://git hub.com/re quest/requ est/pull/8 50) Fix wo rd consist ency in re adme (@0xN obody) | |
| 3252 | - [#810](h ttps://git hub.com/re quest/requ est/pull/8 10) add so me exposit ion to mpu example i n README.m d (@mikerm cneil) | |
| 3253 | - [#840](h ttps://git hub.com/re quest/requ est/pull/8 40) improv e error re porting fo r invalid protocols (@FND) | |
| 3254 | - [#821](h ttps://git hub.com/re quest/requ est/pull/8 21) added secureOpti ons back ( @nw) | |
| 3255 | - [#815](h ttps://git hub.com/re quest/requ est/pull/8 15) Create changelog based on pull reque sts (@lali tkapoor) | |
| 3256 | ||
| 3257 | ### v2.34. 0 (2014/02 /18) | |
| 3258 | - [#516](h ttps://git hub.com/re quest/requ est/pull/5 16) UNIX S ocket URL Support (@ lyuzashi) | |
| 3259 | - [#801](h ttps://git hub.com/re quest/requ est/pull/8 01) 794 ig nore cooki e parsing and domain errors (@ lalitkapoo r) | |
| 3260 | - [#802](h ttps://git hub.com/re quest/requ est/pull/8 02) Added the Apache license t o the pack age.json. (@keskival ) | |
| 3261 | - [#793](h ttps://git hub.com/re quest/requ est/pull/7 93) Adds c ontent-len gth calcul ation when submittin g forms us ing form-d ata li... (@Juul) | |
| 3262 | - [#785](h ttps://git hub.com/re quest/requ est/pull/7 85) Provid e ability to overrid e content- type when `json` opt ion used ( @vvo) | |
| 3263 | - [#781](h ttps://git hub.com/re quest/requ est/pull/7 81) simple r isReadSt ream funct ion (@joao jeronimo) | |
| 3264 | ||
| 3265 | ### v2.32. 0 (2014/01 /16) | |
| 3266 | - [#767](h ttps://git hub.com/re quest/requ est/pull/7 67) Use to ugh-cookie CookieJar sync API (@stash) | |
| 3267 | - [#764](h ttps://git hub.com/re quest/requ est/pull/7 64) Case-i nsensitive authentic ation sche me (@bobyr izov) | |
| 3268 | - [#763](h ttps://git hub.com/re quest/requ est/pull/7 63) Upgrad e tough-co okie to 0. 10.0 (@sta sh) | |
| 3269 | - [#744](h ttps://git hub.com/re quest/requ est/pull/7 44) Use Co okie.parse (@lalitka poor) | |
| 3270 | - [#757](h ttps://git hub.com/re quest/requ est/pull/7 57) requir e aws-sign 2 (@mafint osh) | |
| 3271 | ||
| 3272 | ### v2.31. 0 (2014/01 /08) | |
| 3273 | - [#645](h ttps://git hub.com/re quest/requ est/pull/6 45) update twitter a pi url to v1.1 (@mic k) | |
| 3274 | - [#746](h ttps://git hub.com/re quest/requ est/pull/7 46) README : Markdown code high light (@we akish) | |
| 3275 | - [#745](h ttps://git hub.com/re quest/requ est/pull/7 45) updati ng setCook ie example to make i t clear th at the cal lback is r equired (@ emkay) | |
| 3276 | - [#742](h ttps://git hub.com/re quest/requ est/pull/7 42) Add no te about J SON output body type (@iansltx ) | |
| 3277 | - [#741](h ttps://git hub.com/re quest/requ est/pull/7 41) README example i s using ol d cookie j ar api (@e mkay) | |
| 3278 | - [#736](h ttps://git hub.com/re quest/requ est/pull/7 36) Fix ca llback arg uments doc umentation (@mmaleck i) | |
| 3279 | ||
| 3280 | ### v2.30. 0 (2013/12 /13) | |
| 3281 | - [#732](h ttps://git hub.com/re quest/requ est/pull/7 32) JSHINT : Creating global 'f or' variab le. Should be 'for ( var ...'. (@Fritz-Li um) | |
| 3282 | - [#730](h ttps://git hub.com/re quest/requ est/pull/7 30) better HTTP DIGE ST support (@dai-shi ) | |
| 3283 | - [#728](h ttps://git hub.com/re quest/requ est/pull/7 28) Fix Ty peError wh en calling request.c ookie (@sc arletmeow) | |
| 3284 | ||
| 3285 | ### v2.29. 0 (2013/12 /06) | |
| 3286 | - [#727](h ttps://git hub.com/re quest/requ est/pull/7 27) fix re quester bu g (@jchris ) | |
| 3287 | ||
| 3288 | ### v2.28. 0 (2013/12 /04) | |
| 3289 | - [#724](h ttps://git hub.com/re quest/requ est/pull/7 24) README .md: add c ustom HTTP Headers e xample. (@ tcort) | |
| 3290 | - [#719](h ttps://git hub.com/re quest/requ est/pull/7 19) Made a comment g ender neut ral. (@uns etbit) | |
| 3291 | - [#715](h ttps://git hub.com/re quest/requ est/pull/7 15) Reques t.multipar t no longe r crashes when heade r 'Content -type' pre sent (@pas taclub) | |
| 3292 | - [#710](h ttps://git hub.com/re quest/requ est/pull/7 10) Fixing listing i n callback part of d ocs. (@luk asz-zak) | |
| 3293 | - [#696](h ttps://git hub.com/re quest/requ est/pull/6 96) Edited README.md for forma tting and clarity of phrasing (@Zearin) | |
| 3294 | - [#694](h ttps://git hub.com/re quest/requ est/pull/6 94) Typo i n README ( @VRMink) | |
| 3295 | - [#690](h ttps://git hub.com/re quest/requ est/pull/6 90) Handle blank pas sword in b asic auth. (@diversa rio) | |
| 3296 | - [#682](h ttps://git hub.com/re quest/requ est/pull/6 82) Option al depende ncies (@Tu rbo87) | |
| 3297 | - [#683](h ttps://git hub.com/re quest/requ est/pull/6 83) Travis CI suppor t (@Turbo8 7) | |
| 3298 | - [#674](h ttps://git hub.com/re quest/requ est/pull/6 74) change cookie mo dule,to to ugh-cookie .please ch eck it . ( @sxyizhire n) | |
| 3299 | - [#666](h ttps://git hub.com/re quest/requ est/pull/6 66) make ` ciphers` a nd `secure Protocol` to work in https req uest (@ric harddong) | |
| 3300 | - [#656](h ttps://git hub.com/re quest/requ est/pull/6 56) Test c ase for #3 04. (@dive rsario) | |
| 3301 | - [#662](h ttps://git hub.com/re quest/requ est/pull/6 62) option .tunnel to explicitl y disable tunneling (@seanmons tar) | |
| 3302 | - [#659](h ttps://git hub.com/re quest/requ est/pull/6 59) fix fa ilure when running w ith NODE_D EBUG=reque st, and a test for t hat (@jrgm ) | |
| 3303 | - [#630](h ttps://git hub.com/re quest/requ est/pull/6 30) Send r andom cnon ce for HTT P Digest r equests (@ wprl) | |
| 3304 | ||
| 3305 | ### v2.27. 0 (2013/08 /15) | |
| 3306 | - [#619](h ttps://git hub.com/re quest/requ est/pull/6 19) decoup le things a bit (@jo aojeronimo ) | |
| 3307 | ||
| 3308 | ### v2.26. 0 (2013/08 /07) | |
| 3309 | - [#613](h ttps://git hub.com/re quest/requ est/pull/6 13) Fixes #583, move d initiali zation of self.uri.p athname (@ lexander) | |
| 3310 | - [#605](h ttps://git hub.com/re quest/requ est/pull/6 05) Only i nclude ":" + pass in Basic Aut h if it's defined (f ixes #602) (@bendruc ker) | |
| 3311 | ||
| 3312 | ### v2.24. 0 (2013/07 /23) | |
| 3313 | - [#596](h ttps://git hub.com/re quest/requ est/pull/5 96) Global agent is being used when pool is specif ied (@Caul drath) | |
| 3314 | - [#594](h ttps://git hub.com/re quest/requ est/pull/5 94) Emit c omplete ev ent when t here is no callback (@RomainLK ) | |
| 3315 | - [#601](h ttps://git hub.com/re quest/requ est/pull/6 01) Fixed a small ty po (@micha lstanko) | |
| 3316 | ||
| 3317 | ### v2.23. 0 (2013/07 /23) | |
| 3318 | - [#589](h ttps://git hub.com/re quest/requ est/pull/5 89) Preven t setting headers af ter they a re sent (@ geek) | |
| 3319 | - [#587](h ttps://git hub.com/re quest/requ est/pull/5 87) Global cookie ja r disabled by defaul t (@threep ointone) | |
| 3320 | ||
| 3321 | ### v2.22. 0 (2013/07 /05) | |
| 3322 | - [#544](h ttps://git hub.com/re quest/requ est/pull/5 44) Update http-sign ature vers ion. (@dav idlehn) | |
| 3323 | - [#581](h ttps://git hub.com/re quest/requ est/pull/5 81) Fix sp elling of "ignoring. " (@bigeas y) | |
| 3324 | - [#568](h ttps://git hub.com/re quest/requ est/pull/5 68) use ag entOptions to create agent whe n specifie d in reque st (@SamPl acette) | |
| 3325 | - [#564](h ttps://git hub.com/re quest/requ est/pull/5 64) Fix re directions (@criloz) | |
| 3326 | - [#541](h ttps://git hub.com/re quest/requ est/pull/5 41) The ex ported req uest funct ion doesn' t have an auth metho d (@tschau b) | |
| 3327 | - [#542](h ttps://git hub.com/re quest/requ est/pull/5 42) Expose Request c lass (@reg ality) | |
| 3328 | ||
| 3329 | ### v2.21. 0 (2013/04 /30) | |
| 3330 | - [#536](h ttps://git hub.com/re quest/requ est/pull/5 36) Allow explicitly empty use r field fo r basic au thenticati on. (@mike ando) | |
| 3331 | - [#532](h ttps://git hub.com/re quest/requ est/pull/5 32) fix ty po (@frede ricosilva) | |
| 3332 | - [#497](h ttps://git hub.com/re quest/requ est/pull/4 97) Added redirect e vent (@Cau ldrath) | |
| 3333 | - [#503](h ttps://git hub.com/re quest/requ est/pull/5 03) Fix ba sic auth f or passwor ds that co ntain colo ns (@tonis tiigi) | |
| 3334 | - [#521](h ttps://git hub.com/re quest/requ est/pull/5 21) Improv ing test-l ocalAddres s.js (@now ay421) | |
| 3335 | - [#529](h ttps://git hub.com/re quest/requ est/pull/5 29) depend encies ver sions bump (@jodaka) | |
| 3336 | ||
| 3337 | ### v2.20. 0 (2013/04 /22) | |
| 3338 | - [#523](h ttps://git hub.com/re quest/requ est/pull/5 23) Updati ng depende ncies (@no way421) | |
| 3339 | - [#520](h ttps://git hub.com/re quest/requ est/pull/5 20) Fixing test-tunn el.js (@no way421) | |
| 3340 | - [#519](h ttps://git hub.com/re quest/requ est/pull/5 19) Update internal path state on post-c reation QS changes ( @jblebrun) | |
| 3341 | - [#510](h ttps://git hub.com/re quest/requ est/pull/5 10) Add HT TP Signatu re support . (@davidl ehn) | |
| 3342 | - [#502](h ttps://git hub.com/re quest/requ est/pull/5 02) Fix PO ST (and pr obably oth er) reques ts that ar e retried after 401 Unauthoriz ed (@nylen ) | |
| 3343 | - [#508](h ttps://git hub.com/re quest/requ est/pull/5 08) Honor the .stric tSSL optio n when usi ng proxies (tunnel-a gent) (@jh s) | |
| 3344 | - [#512](h ttps://git hub.com/re quest/requ est/pull/5 12) Make p assword op tional to support th e format: http://use rname@host name/ (@pa jato1) | |
| 3345 | - [#513](h ttps://git hub.com/re quest/requ est/pull/5 13) add 'l ocalAddres s' support (@yyfrank yy) | |
| 3346 | - [#498](h ttps://git hub.com/re quest/requ est/pull/4 98) Moving response emit above setHeader s on desti nation str eams (@ken perkins) | |
| 3347 | - [#490](h ttps://git hub.com/re quest/requ est/pull/4 90) Empty response b ody (3-rd argument) must be pa ssed to ca llback as an empty s tring (@Ol egas) | |
| 3348 | - [#479](h ttps://git hub.com/re quest/requ est/pull/4 79) Changi ng so if A ccept head er is expl icitly set , sending json does not ov... (@RoryH) | |
| 3349 | - [#475](h ttps://git hub.com/re quest/requ est/pull/4 75) Use `u nescape` f rom `query string` (@ shimaore) | |
| 3350 | - [#473](h ttps://git hub.com/re quest/requ est/pull/4 73) V0.10 compat (@i saacs) | |
| 3351 | - [#471](h ttps://git hub.com/re quest/requ est/pull/4 71) Using querystrin g library from visio nmedia (@k backowski) | |
| 3352 | - [#461](h ttps://git hub.com/re quest/requ est/pull/4 61) Strip the UTF8 B OM from a UTF encode d response (@kppulli n) | |
| 3353 | - [#460](h ttps://git hub.com/re quest/requ est/pull/4 60) hawk 0 .10.0 (@hu eniverse) | |
| 3354 | - [#462](h ttps://git hub.com/re quest/requ est/pull/4 62) if que ry params are empty, then requ est path s houldn't e nd with a '?' (merge s cleanly now) (@jai pandya) | |
| 3355 | - [#456](h ttps://git hub.com/re quest/requ est/pull/4 56) hawk 0 .9.0 (@hue niverse) | |
| 3356 | - [#429](h ttps://git hub.com/re quest/requ est/pull/4 29) Copy o ptions bef ore adding callback. (@nrn, @n friedly, @ youurayy, @jplock, @ kapetan, @ landeiro, @othiym23, @mmalecki ) | |
| 3357 | - [#454](h ttps://git hub.com/re quest/requ est/pull/4 54) Destro y the resp onse if pr esent when destroyin g the requ est (clean merge) (@ mafintosh) | |
| 3358 | - [#310](h ttps://git hub.com/re quest/requ est/pull/3 10) Twitte r Oauth St uff Out of Date; Now Updated ( @joemccann , @isaacs, @mscdex) | |
| 3359 | - [#413](h ttps://git hub.com/re quest/requ est/pull/4 13) rename googledoo dle.png to .jpg (@nf riedly, @y ouurayy, @ jplock, @k apetan, @l andeiro, @ othiym23, @mmalecki) | |
| 3360 | - [#448](h ttps://git hub.com/re quest/requ est/pull/4 48) Conven ience meth od for PAT CH (@mloar ) | |
| 3361 | - [#444](h ttps://git hub.com/re quest/requ est/pull/4 44) protec t against double cal lbacks on error path (@spollac k) | |
| 3362 | - [#433](h ttps://git hub.com/re quest/requ est/pull/4 33) Added support fo r HTTPS ce rt & key ( @mmalecki) | |
| 3363 | - [#430](h ttps://git hub.com/re quest/requ est/pull/4 30) Respec t specifie d {Host,ho st} header s, not jus t {host} ( @andrewsch aaf) | |
| 3364 | - [#415](h ttps://git hub.com/re quest/requ est/pull/4 15) Fixed a typo. (@ jerem) | |
| 3365 | - [#338](h ttps://git hub.com/re quest/requ est/pull/3 38) Add mo re auth op tions, inc luding dig est suppor t (@nylen) | |
| 3366 | - [#403](h ttps://git hub.com/re quest/requ est/pull/4 03) Optimi ze environ ment looku p to happe n once onl y (@mmalec ki) | |
| 3367 | - [#398](h ttps://git hub.com/re quest/requ est/pull/3 98) Add mo re reporti ng to test s (@mmalec ki) | |
| 3368 | - [#388](h ttps://git hub.com/re quest/requ est/pull/3 88) Ensure "safe" to JSON doesn 't break E ventEmitte rs (@othiy m23) | |
| 3369 | - [#381](h ttps://git hub.com/re quest/requ est/pull/3 81) Resolv ing "Inval id signatu re. Expect ed signatu re base st ring: " (@ landeiro) | |
| 3370 | - [#380](h ttps://git hub.com/re quest/requ est/pull/3 80) Fixes missing ho st header on retried request w hen using forever ag ent (@mac- ) | |
| 3371 | - [#376](h ttps://git hub.com/re quest/requ est/pull/3 76) Header s lost on redirect ( @kapetan) | |
| 3372 | - [#375](h ttps://git hub.com/re quest/requ est/pull/3 75) Fix fo r missing oauth_time stamp para meter (@jp lock) | |
| 3373 | - [#374](h ttps://git hub.com/re quest/requ est/pull/3 74) Correc t Host hea der for pr oxy tunnel CONNECT ( @youurayy) | |
| 3374 | - [#370](h ttps://git hub.com/re quest/requ est/pull/3 70) Twitte r reverse auth uses x_auth_mod e not x_au th_type (@ drudge) | |
| 3375 | - [#369](h ttps://git hub.com/re quest/requ est/pull/3 69) Don't remove x_a uth_mode f or Twitter reverse a uth (@drud ge) | |
| 3376 | - [#344](h ttps://git hub.com/re quest/requ est/pull/3 44) Make A WS auth si gning find headers c orrectly ( @nlf) | |
| 3377 | - [#363](h ttps://git hub.com/re quest/requ est/pull/3 63) rfc398 6 on base_ uri, now p asses test s (@jeffma rshall) | |
| 3378 | - [#362](h ttps://git hub.com/re quest/requ est/pull/3 62) Runnin g `rfc3986 ` on `base _uri` in ` oauth.hmac sign` inst ead of jus t `encodeU RIComponen t` (@jeffm arshall) | |
| 3379 | - [#361](h ttps://git hub.com/re quest/requ est/pull/3 61) Don't create a C ontent-Len gth header if we alr eady have it set (@d anjenkins) | |
| 3380 | - [#360](h ttps://git hub.com/re quest/requ est/pull/3 60) Delete self._for m along wi th everyth ing else o n redirect (@jgautie r) | |
| 3381 | - [#355](h ttps://git hub.com/re quest/requ est/pull/3 55) stop s ending err oneous hea ders on re directed r equests (@ azylman) | |
| 3382 | - [#332](h ttps://git hub.com/re quest/requ est/pull/3 32) Fix #2 96 - Only set Conten t-Type if body exist s (@Marsup ) | |
| 3383 | - [#343](h ttps://git hub.com/re quest/requ est/pull/3 43) Allow AWS to wor k in more situations , added a note in th e README o n its usag e (@nlf) | |
| 3384 | - [#320](h ttps://git hub.com/re quest/requ est/pull/3 20) reques t.defaults () doesn't need to w rap jar() (@StuartHa rris) | |
| 3385 | - [#322](h ttps://git hub.com/re quest/requ est/pull/3 22) Fix + test for p iped into request bu mped into redirect. #321 (@ale xindigo) | |
| 3386 | - [#326](h ttps://git hub.com/re quest/requ est/pull/3 26) Do not try to re move liste ner from a n undefine d connecti on (@strk) | |
| 3387 | - [#318](h ttps://git hub.com/re quest/requ est/pull/3 18) Pass s ervername to tunneli ng secure socket cre ation (@is aacs) | |
| 3388 | - [#317](h ttps://git hub.com/re quest/requ est/pull/3 17) Workar ound for # 313 (@isaa cs) | |
| 3389 | - [#293](h ttps://git hub.com/re quest/requ est/pull/2 93) Allow parser err ors to bub ble up to request (@ mscdex) | |
| 3390 | - [#290](h ttps://git hub.com/re quest/requ est/pull/2 90) A test for #289 (@isaacs) | |
| 3391 | - [#280](h ttps://git hub.com/re quest/requ est/pull/2 80) Like i n node.js print opti ons if NOD E_DEBUG co ntains the word requ est (@Fili rom1) | |
| 3392 | - [#207](h ttps://git hub.com/re quest/requ est/pull/2 07) Fix #2 06 Change HTTP/HTTPS agent whe n redirect ing betwee n protocol s (@isaacs ) | |
| 3393 | - [#214](h ttps://git hub.com/re quest/requ est/pull/2 14) docume nting addi tional beh avior of j son option (@jphaas) | |
| 3394 | - [#272](h ttps://git hub.com/re quest/requ est/pull/2 72) Bounda ry begins with CRLF? (@elspoon o, @timsha del, @naho lyr, @nano documet, @ TehShrike) | |
| 3395 | - [#284](h ttps://git hub.com/re quest/requ est/pull/2 84) Remove stray `co nsole.log( )` call in multipart generator . (@bcherr y) | |
| 3396 | - [#241](h ttps://git hub.com/re quest/requ est/pull/2 41) Compos ability up dates sugg ested by i ssue #239 (@polotek) | |
| 3397 | - [#282](h ttps://git hub.com/re quest/requ est/pull/2 82) OAuth Authorizat ion header contains non-"oauth _" paramet ers (@jplo ck) | |
| 3398 | - [#279](h ttps://git hub.com/re quest/requ est/pull/2 79) fix te sts with b oundary by injecting boundry f rom header (@benatki n) | |
| 3399 | - [#273](h ttps://git hub.com/re quest/requ est/pull/2 73) Pipe b ack pressu re issue ( @mafintosh ) | |
| 3400 | - [#268](h ttps://git hub.com/re quest/requ est/pull/2 68) I'm no t OCD seri ously (@Te hShrike) | |
| 3401 | - [#263](h ttps://git hub.com/re quest/requ est/pull/2 63) Bug in OAuth key generatio n for sha1 (@nanodoc umet) | |
| 3402 | - [#265](h ttps://git hub.com/re quest/requ est/pull/2 65) uncaug htExceptio n when red irected to invalid U RI (@nahol yr) | |
| 3403 | - [#262](h ttps://git hub.com/re quest/requ est/pull/2 62) JSON t est should check for equality (@timshade l) | |
| 3404 | - [#261](h ttps://git hub.com/re quest/requ est/pull/2 61) Settin g 'pool' t o 'false' does NOT d isable Age nt pooling (@timshad el) | |
| 3405 | - [#249](h ttps://git hub.com/re quest/requ est/pull/2 49) Fix fo r the fix of your (c losed) iss ue #89 whe re self.he aders[cont ent-length ] is set t o 0 for al l methods (@sethbrid ges, @polo tek, @zeph rax, @jero megn) | |
| 3406 | - [#255](h ttps://git hub.com/re quest/requ est/pull/2 55) multip art allow body === ' ' ( the em pty string ) (@Filir om1) | |
| 3407 | - [#260](h ttps://git hub.com/re quest/requ est/pull/2 60) fixed just anoth er leak of 'i' (@sre uter) | |
| 3408 | - [#246](h ttps://git hub.com/re quest/requ est/pull/2 46) Fixing the set-c ookie head er (@jerom egn) | |
| 3409 | - [#243](h ttps://git hub.com/re quest/requ est/pull/2 43) Dynami c boundary (@zephrax ) | |
| 3410 | - [#240](h ttps://git hub.com/re quest/requ est/pull/2 40) don't error when null is p assed for options (@ polotek) | |
| 3411 | - [#211](h ttps://git hub.com/re quest/requ est/pull/2 11) Replac e all occu rrences of special c hars in RF C3986 (@ch riso) | |
| 3412 | - [#224](h ttps://git hub.com/re quest/requ est/pull/2 24) Multip art conten t-type cha nge (@janj ongboom) | |
| 3413 | - [#217](h ttps://git hub.com/re quest/requ est/pull/2 17) need t o use Auth orization (titlecase ) header w ith Tumblr OAuth (@v isnup) | |
| 3414 | - [#203](h ttps://git hub.com/re quest/requ est/pull/2 03) Fix co okie and r edirect bu gs and add auth supp ort for HT TPS tunnel (@milewis e) | |
| 3415 | - [#199](h ttps://git hub.com/re quest/requ est/pull/1 99) Tunnel (@isaacs) | |
| 3416 | - [#198](h ttps://git hub.com/re quest/requ est/pull/1 98) Bugfix on foreve r usage of util.inhe rits (@isa acs) | |
| 3417 | - [#197](h ttps://git hub.com/re quest/requ est/pull/1 97) Make F oreverAgen t work wit h HTTPS (@ isaacs) | |
| 3418 | - [#193](h ttps://git hub.com/re quest/requ est/pull/1 93) Fixes GH-119 (@g oatslacker ) | |
| 3419 | - [#188](h ttps://git hub.com/re quest/requ est/pull/1 88) Add ab ort suppor t to the r eturned re quest (@it ay) | |
| 3420 | - [#176](h ttps://git hub.com/re quest/requ est/pull/1 76) Querys tring opti on (@csain ty) | |
| 3421 | - [#182](h ttps://git hub.com/re quest/requ est/pull/1 82) Fix re quest.defa ults to su pport (uri , options, callback) api (@twi lson63) | |
| 3422 | - [#180](h ttps://git hub.com/re quest/requ est/pull/1 80) Modifi ed the pos t, put, he ad and del shortcuts to suppor t uri opti onal param (@twilson 63) | |
| 3423 | - [#179](h ttps://git hub.com/re quest/requ est/pull/1 79) fix to add opts in .pipe(s tream, opt s) (@subst ack) | |
| 3424 | - [#177](h ttps://git hub.com/re quest/requ est/pull/1 77) Issue #173 Suppo rt uri as first and optional c onfig as s econd argu ment (@twi lson63) | |
| 3425 | - [#170](h ttps://git hub.com/re quest/requ est/pull/1 70) can't create a c ookie in a wrapped r equest (de faults) (@ fabianonun es) | |
| 3426 | - [#168](h ttps://git hub.com/re quest/requ est/pull/1 68) Pickin g off an E asyFix by adding som e missing mimetypes. (@serby) | |
| 3427 | - [#161](h ttps://git hub.com/re quest/requ est/pull/1 61) Fix co okie jar/h eaders.coo kie collis ion (#125) (@papandr eou) | |
| 3428 | - [#162](h ttps://git hub.com/re quest/requ est/pull/1 62) Fix is sue #159 ( @dpetukhov ) | |
| 3429 | - [#90](ht tps://gith ub.com/req uest/reque st/pull/90 ) add opti on followA llRedirect s to follo w post/put redirects (@jroes) | |
| 3430 | - [#148](h ttps://git hub.com/re quest/requ est/pull/1 48) Retry Agent (@th ejh) | |
| 3431 | - [#146](h ttps://git hub.com/re quest/requ est/pull/1 46) Multip art should respect c ontent-typ e if previ ously set (@apeace) | |
| 3432 | - [#144](h ttps://git hub.com/re quest/requ est/pull/1 44) added "form" opt ion to rea dme (@pete jkim) | |
| 3433 | - [#133](h ttps://git hub.com/re quest/requ est/pull/1 33) Fixed cookies pa rsing (@af anasy) | |
| 3434 | - [#135](h ttps://git hub.com/re quest/requ est/pull/1 35) host v s hostname (@iangree nleaf) | |
| 3435 | - [#132](h ttps://git hub.com/re quest/requ est/pull/1 32) return the body as a Buffe r when enc oding is s et to null (@jahewso n) | |
| 3436 | - [#112](h ttps://git hub.com/re quest/requ est/pull/1 12) Suppor t using a custom htt p-like mod ule (@jhs) | |
| 3437 | - [#104](h ttps://git hub.com/re quest/requ est/pull/1 04) Cookie handling contains b ugs (@janj ongboom) | |
| 3438 | - [#121](h ttps://git hub.com/re quest/requ est/pull/1 21) Anothe r patch fo r cookie h andling re gression ( @jhurliman ) | |
| 3439 | - [#117](h ttps://git hub.com/re quest/requ est/pull/1 17) Remove the globa l `i` (@3r d-Eden) | |
| 3440 | - [#110](h ttps://git hub.com/re quest/requ est/pull/1 10) Update to Iris C ouch URL ( @jhs) | |
| 3441 | - [#86](ht tps://gith ub.com/req uest/reque st/pull/86 ) Can't po st binary to multipa rt request s (@kkaefe r) | |
| 3442 | - [#105](h ttps://git hub.com/re quest/requ est/pull/1 05) added test for p roxy optio n. (@domin ictarr) | |
| 3443 | - [#102](h ttps://git hub.com/re quest/requ est/pull/1 02) Implem ented cook ies - clos es issue 8 2: https:/ /github.co m/mikeal/r equest/iss ues/82 (@a lessioalex ) | |
| 3444 | - [#97](ht tps://gith ub.com/req uest/reque st/pull/97 ) Typo in previous p ull causes TypeError in non-0. 5.11 versi ons (@isaa cs) | |
| 3445 | - [#96](ht tps://gith ub.com/req uest/reque st/pull/96 ) Authless parsed ur l host sup port (@isa acs) | |
| 3446 | - [#81](ht tps://gith ub.com/req uest/reque st/pull/81 ) Enhance redirect h andling (@ danmactoug h) | |
| 3447 | - [#78](ht tps://gith ub.com/req uest/reque st/pull/78 ) Don't tr y to do st rictSSL fo r non-ssl connection s (@isaacs ) | |
| 3448 | - [#76](ht tps://gith ub.com/req uest/reque st/pull/76 ) Bug when a request fails and a timeout is set (@ Marsup) | |
| 3449 | - [#70](ht tps://gith ub.com/req uest/reque st/pull/70 ) add test script to package.j son (@isaa cs, @aheck mann) | |
| 3450 | - [#73](ht tps://gith ub.com/req uest/reque st/pull/73 ) Fix #71 Respect th e strictSS L flag (@i saacs) | |
| 3451 | - [#69](ht tps://gith ub.com/req uest/reque st/pull/69 ) Flatten chunked re quests pro perly (@is aacs) | |
| 3452 | - [#67](ht tps://gith ub.com/req uest/reque st/pull/67 ) fixed gl obal varia ble leaks (@aheckman n) | |
| 3453 | - [#66](ht tps://gith ub.com/req uest/reque st/pull/66 ) Do not o verwrite e stablished content-t ype header s for read stream de liver (@vo odootikigo d) | |
| 3454 | - [#53](ht tps://gith ub.com/req uest/reque st/pull/53 ) Parse js on: Issue #51 (@bena tkin) | |
| 3455 | - [#45](ht tps://gith ub.com/req uest/reque st/pull/45 ) Added ti meout opti on (@mbrev oort) | |
| 3456 | - [#35](ht tps://gith ub.com/req uest/reque st/pull/35 ) The "end " event is n't emitte d for some responses (@voxpell i) | |
| 3457 | - [#31](ht tps://gith ub.com/req uest/reque st/pull/31 ) Error on piping a request to a destina tion (@tob owers)\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000package/ lib/auth.j s\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000000664 \x0000 001750 \x000000 1750 \x00000000 011251 \x000012 676423610\x0000 012607 \x00000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000u star\x000000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000000000 \x00000 00000 \x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000'use s trict' | |
| 3458 | ||
| 3459 | var casele ss = requi re('casele ss') | |
| 3460 | , uuid = require(' node-uuid' ) | |
| 3461 | , helper s = requir e('./helpe rs') | |
| 3462 | ||
| 3463 | var md5 = helpers.md 5 | |
| 3464 | , toBase 64 = helpe rs.toBase6 4 | |
| 3465 | ||
| 3466 | ||
| 3467 | function A uth (reque st) { | |
| 3468 | // defin e all publ ic propert ies here | |
| 3469 | this.req uest = req uest | |
| 3470 | this.has Auth = fal se | |
| 3471 | this.sen tAuth = fa lse | |
| 3472 | this.bea rerToken = null | |
| 3473 | this.use r = null | |
| 3474 | this.pas s = null | |
| 3475 | } | |
| 3476 | ||
| 3477 | Auth.proto type.basic = functio n (user, p ass, sendI mmediately ) { | |
| 3478 | var self = this | |
| 3479 | if (type of user != = 'string' || (pass !== undefi ned && typ eof pass ! == 'string ')) { | |
| 3480 | self.r equest.emi t('error', new Error ('auth() r eceived in valid user or passwo rd')) | |
| 3481 | } | |
| 3482 | self.use r = user | |
| 3483 | self.pas s = pass | |
| 3484 | self.has Auth = tru e | |
| 3485 | var head er = user + ':' + (p ass || '') | |
| 3486 | if (send Immediatel y || typeo f sendImme diately == = 'undefin ed') { | |
| 3487 | var au thHeader = 'Basic ' + toBase64 (header) | |
| 3488 | self.s entAuth = true | |
| 3489 | return authHeade r | |
| 3490 | } | |
| 3491 | } | |
| 3492 | ||
| 3493 | Auth.proto type.beare r = functi on (bearer , sendImme diately) { | |
| 3494 | var self = this | |
| 3495 | self.bea rerToken = bearer | |
| 3496 | self.has Auth = tru e | |
| 3497 | if (send Immediatel y || typeo f sendImme diately == = 'undefin ed') { | |
| 3498 | if (ty peof beare r === 'fun ction') { | |
| 3499 | bear er = beare r() | |
| 3500 | } | |
| 3501 | var au thHeader = 'Bearer ' + (bearer || '') | |
| 3502 | self.s entAuth = true | |
| 3503 | return authHeade r | |
| 3504 | } | |
| 3505 | } | |
| 3506 | ||
| 3507 | Auth.proto type.diges t = functi on (method , path, au thHeader) { | |
| 3508 | // TODO: More comp lete imple mentation of RFC 261 7. | |
| 3509 | // - h andle chal lenge.doma in | |
| 3510 | // - s upport qop ="auth-int " only | |
| 3511 | // - h andle Auth entication -Info (not necessari ly?) | |
| 3512 | // - c heck chall enge.stale (not nece ssarily?) | |
| 3513 | // - i ncrease nc (not nece ssarily?) | |
| 3514 | // For r eference: | |
| 3515 | // http: //tools.ie tf.org/htm l/rfc2617# section-3 | |
| 3516 | // https ://github. com/bagder /curl/blob /master/li b/http_dig est.c | |
| 3517 | ||
| 3518 | var self = this | |
| 3519 | ||
| 3520 | var chal lenge = {} | |
| 3521 | var re = /([a-z0-9 _-]+)=(?:" ([^"]+)"|( [a-z0-9_-] +))/gi | |
| 3522 | for (;;) { | |
| 3523 | var ma tch = re.e xec(authHe ader) | |
| 3524 | if (!m atch) { | |
| 3525 | brea k | |
| 3526 | } | |
| 3527 | challe nge[match[ 1]] = matc h[2] || ma tch[3] | |
| 3528 | } | |
| 3529 | ||
| 3530 | /** | |
| 3531 | * RFC 2 617: handl e both MD5 and MD5-s ess algori thms. | |
| 3532 | * | |
| 3533 | * If th e algorith m directiv e's value is "MD5" o r unspecif ied, then HA1 is | |
| 3534 | * HA1 =MD5(usern ame:realm: password) | |
| 3535 | * If th e algorith m directiv e's value is "MD5-se ss", then HA1 is | |
| 3536 | * HA1 =MD5(MD5(u sername:re alm:passwo rd):nonce: cnonce) | |
| 3537 | */ | |
| 3538 | var ha1C ompute = f unction (a lgorithm, user, real m, pass, n once, cnon ce) { | |
| 3539 | var ha 1 = md5(us er + ':' + realm + ' :' + pass) | |
| 3540 | if (al gorithm && algorithm .toLowerCa se() === ' md5-sess') { | |
| 3541 | retu rn md5(ha1 + ':' + n once + ':' + cnonce) | |
| 3542 | } else { | |
| 3543 | retu rn ha1 | |
| 3544 | } | |
| 3545 | } | |
| 3546 | ||
| 3547 | var qop = /(^|,)\s *auth\s*($ |,)/.test( challenge. qop) && 'a uth' | |
| 3548 | var nc = qop && '0 0000001' | |
| 3549 | var cnon ce = qop & & uuid().r eplace(/-/ g, '') | |
| 3550 | var ha1 = ha1Compu te(challen ge.algorit hm, self.u ser, chall enge.realm , self.pas s, challen ge.nonce, cnonce) | |
| 3551 | var ha2 = md5(meth od + ':' + path) | |
| 3552 | var dige stResponse = qop | |
| 3553 | ? md5( ha1 + ':' + challeng e.nonce + ':' + nc + ':' + cno nce + ':' + qop + ': ' + ha2) | |
| 3554 | : md5( ha1 + ':' + challeng e.nonce + ':' + ha2) | |
| 3555 | var auth Values = { | |
| 3556 | userna me: self.u ser, | |
| 3557 | realm: challenge .realm, | |
| 3558 | nonce: challenge .nonce, | |
| 3559 | uri: p ath, | |
| 3560 | qop: q op, | |
| 3561 | respon se: digest Response, | |
| 3562 | nc: nc , | |
| 3563 | cnonce : cnonce, | |
| 3564 | algori thm: chall enge.algor ithm, | |
| 3565 | opaque : challeng e.opaque | |
| 3566 | } | |
| 3567 | ||
| 3568 | authHead er = [] | |
| 3569 | for (var k in auth Values) { | |
| 3570 | if (au thValues[k ]) { | |
| 3571 | if ( k === 'qop ' || k === 'nc' || k === 'algo rithm') { | |
| 3572 | au thHeader.p ush(k + '= ' + authVa lues[k]) | |
| 3573 | } el se { | |
| 3574 | au thHeader.p ush(k + '= "' + authV alues[k] + '"') | |
| 3575 | } | |
| 3576 | } | |
| 3577 | } | |
| 3578 | authHead er = 'Dige st ' + aut hHeader.jo in(', ') | |
| 3579 | self.sen tAuth = tr ue | |
| 3580 | return a uthHeader | |
| 3581 | } | |
| 3582 | ||
| 3583 | Auth.proto type.onReq uest = fun ction (use r, pass, s endImmedia tely, bear er) { | |
| 3584 | var self = this | |
| 3585 | , requ est = self .request | |
| 3586 | ||
| 3587 | var auth Header | |
| 3588 | if (bear er === und efined && user === u ndefined) { | |
| 3589 | self.r equest.emi t('error', new Error ('no auth mechanism defined')) | |
| 3590 | } else i f (bearer !== undefi ned) { | |
| 3591 | authHe ader = sel f.bearer(b earer, sen dImmediate ly) | |
| 3592 | } else { | |
| 3593 | authHe ader = sel f.basic(us er, pass, sendImmedi ately) | |
| 3594 | } | |
| 3595 | if (auth Header) { | |
| 3596 | reques t.setHeade r('authori zation', a uthHeader) | |
| 3597 | } | |
| 3598 | } | |
| 3599 | ||
| 3600 | Auth.proto type.onRes ponse = fu nction (re sponse) { | |
| 3601 | var self = this | |
| 3602 | , requ est = self .request | |
| 3603 | ||
| 3604 | if (!sel f.hasAuth || self.se ntAuth) { return nul l } | |
| 3605 | ||
| 3606 | var c = caseless(r esponse.he aders) | |
| 3607 | ||
| 3608 | var auth Header = c .get('www- authentica te') | |
| 3609 | var auth Verb = aut hHeader && authHeade r.split(' ')[0].toLo werCase() | |
| 3610 | request. debug('rea uth', auth Verb) | |
| 3611 | ||
| 3612 | switch ( authVerb) { | |
| 3613 | case ' basic': | |
| 3614 | retu rn self.ba sic(self.u ser, self. pass, true ) | |
| 3615 | ||
| 3616 | case ' bearer': | |
| 3617 | retu rn self.be arer(self. bearerToke n, true) | |
| 3618 | ||
| 3619 | case ' digest': | |
| 3620 | retu rn self.di gest(reque st.method, request.p ath, authH eader) | |
| 3621 | } | |
| 3622 | } | |
| 3623 | ||
| 3624 | exports.Au th = Auth | |
| 3625 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000package /lib/cooki es.js\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000000664 \x0000001750 \x00000 01750 \x0000000 0001711 \x00001 2676423610 \x0000013302 \x00000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 ustar\x000000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000000000 \x0000 000000 \x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000'use strict' | |
| 3626 | ||
| 3627 | var tough = require( 'tough-coo kie') | |
| 3628 | ||
| 3629 | var Cookie = tough.C ookie | |
| 3630 | , Cookie Jar = toug h.CookieJa r | |
| 3631 | ||
| 3632 | ||
| 3633 | exports.pa rse = func tion(str) { | |
| 3634 | if (str && str.uri ) { | |
| 3635 | str = str.uri | |
| 3636 | } | |
| 3637 | if (type of str !== 'string') { | |
| 3638 | throw new Error( 'The cooki e function only acce pts STRING as param' ) | |
| 3639 | } | |
| 3640 | return C ookie.pars e(str, {lo ose: true} ) | |
| 3641 | } | |
| 3642 | ||
| 3643 | // Adapt t he sometim es-Async a pi of toug h.CookieJa r to our r equirement s | |
| 3644 | function R equestJar( store) { | |
| 3645 | var self = this | |
| 3646 | self._ja r = new Co okieJar(st ore, {loos eMode: tru e}) | |
| 3647 | } | |
| 3648 | RequestJar .prototype .setCookie = functio n(cookieOr Str, uri, options) { | |
| 3649 | var self = this | |
| 3650 | return s elf._jar.s etCookieSy nc(cookieO rStr, uri, options | | {}) | |
| 3651 | } | |
| 3652 | RequestJar .prototype .getCookie String = f unction(ur i) { | |
| 3653 | var self = this | |
| 3654 | return s elf._jar.g etCookieSt ringSync(u ri) | |
| 3655 | } | |
| 3656 | RequestJar .prototype .getCookie s = functi on(uri) { | |
| 3657 | var self = this | |
| 3658 | return s elf._jar.g etCookiesS ync(uri) | |
| 3659 | } | |
| 3660 | ||
| 3661 | exports.ja r = functi on(store) { | |
| 3662 | return n ew Request Jar(store) | |
| 3663 | } | |
| 3664 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000packa ge/lib/get ProxyFromU RI.js\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x000000066 4 \x0000001750 \x0000001750 \x00000 000004334 \x0000126764236 10\x0000014677 \x00000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000ustar\x000000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000000000 \x0000000000 \x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000'us e strict' | |
| 3665 | ||
| 3666 | function f ormatHostn ame(hostna me) { | |
| 3667 | // canon icalize th e hostname , so that 'oogle.com ' won't ma tch 'googl e.com' | |
| 3668 | return h ostname.re place(/^\. */, '.').t oLowerCase () | |
| 3669 | } | |
| 3670 | ||
| 3671 | function p arseNoProx yZone(zone ) { | |
| 3672 | zone = z one.trim() .toLowerCa se() | |
| 3673 | ||
| 3674 | var zone Parts = zo ne.split(' :', 2) | |
| 3675 | , zone Host = for matHostnam e(zonePart s[0]) | |
| 3676 | , zone Port = zon eParts[1] | |
| 3677 | , hasP ort = zone .indexOf(' :') > -1 | |
| 3678 | ||
| 3679 | return { hostname: zoneHost, port: zone Port, hasP ort: hasPo rt} | |
| 3680 | } | |
| 3681 | ||
| 3682 | function u riInNoProx y(uri, noP roxy) { | |
| 3683 | var port = uri.por t || (uri. protocol = == 'https: ' ? '443' : '80') | |
| 3684 | , host name = for matHostnam e(uri.host name) | |
| 3685 | , noPr oxyList = noProxy.sp lit(',') | |
| 3686 | ||
| 3687 | // itera te through the noPro xyList unt il it find s a match. | |
| 3688 | return n oProxyList .map(parse NoProxyZon e).some(fu nction(noP roxyZone) { | |
| 3689 | var is MatchedAt = hostname .indexOf(n oProxyZone .hostname) | |
| 3690 | , ho stnameMatc hed = ( | |
| 3691 | isMatchedA t > -1 && | |
| 3692 | (isMatched At === hos tname.leng th - noPro xyZone.hos tname.leng th) | |
| 3693 | ) | |
| 3694 | ||
| 3695 | if (no ProxyZone. hasPort) { | |
| 3696 | retu rn (port = == noProxy Zone.port) && hostna meMatched | |
| 3697 | } | |
| 3698 | ||
| 3699 | return hostnameM atched | |
| 3700 | }) | |
| 3701 | } | |
| 3702 | ||
| 3703 | function g etProxyFro mURI(uri) { | |
| 3704 | // Decid e the prop er request proxy to use based on the req uest URI o bject and the | |
| 3705 | // envir onmental v ariables ( NO_PROXY, HTTP_PROXY , etc.) | |
| 3706 | // respe ct NO_PROX Y environm ent variab les (see: http://lyn x.isc.org/ current/br eakout/lyn x_help/key strokes/en vironments .html) | |
| 3707 | ||
| 3708 | var noPr oxy = proc ess.env.NO _PROXY || process.en v.no_proxy || '' | |
| 3709 | ||
| 3710 | // if th e noProxy is a wildc ard then r eturn null | |
| 3711 | ||
| 3712 | if (noPr oxy === '* ') { | |
| 3713 | return null | |
| 3714 | } | |
| 3715 | ||
| 3716 | // if th e noProxy is not emp ty and the uri is fo und return null | |
| 3717 | ||
| 3718 | if (noPr oxy !== '' && uriInN oProxy(uri , noProxy) ) { | |
| 3719 | return null | |
| 3720 | } | |
| 3721 | ||
| 3722 | // Check for HTTP or HTTPS P roxy in en vironment Else defau lt to null | |
| 3723 | ||
| 3724 | if (uri. protocol = == 'http:' ) { | |
| 3725 | return process.e nv.HTTP_PR OXY || | |
| 3726 | process.e nv.http_pr oxy || nul l | |
| 3727 | } | |
| 3728 | ||
| 3729 | if (uri. protocol = == 'https: ') { | |
| 3730 | return process.e nv.HTTPS_P ROXY || | |
| 3731 | process.e nv.https_p roxy || | |
| 3732 | process.e nv.HTTP_PR OXY || | |
| 3733 | process.e nv.http_pr oxy || nu ll | |
| 3734 | } | |
| 3735 | ||
| 3736 | // if no ne of that works, re turn null | |
| 3737 | // (What uri proto col are yo u using th en?) | |
| 3738 | ||
| 3739 | return n ull | |
| 3740 | } | |
| 3741 | ||
| 3742 | module.exp orts = get ProxyFromU RI | |
| 3743 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000package/ lib/har.js \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000000664 \x0000 001750 \x000000 1750 \x00000000 011325 \x000012 676423610\x0000 012422 \x00000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000u star\x000000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000000000 \x00000 00000 \x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000'use s trict' | |
| 3744 | ||
| 3745 | var fs = r equire('fs ') | |
| 3746 | var qs = r equire('qu erystring' ) | |
| 3747 | var valida te = requi re('har-va lidator') | |
| 3748 | var extend = require ('extend') | |
| 3749 | ||
| 3750 | function H ar (reques t) { | |
| 3751 | this.req uest = req uest | |
| 3752 | } | |
| 3753 | ||
| 3754 | Har.protot ype.reduce r = functi on (obj, p air) { | |
| 3755 | // new p roperty ? | |
| 3756 | if (obj[ pair.name] === undef ined) { | |
| 3757 | obj[pa ir.name] = pair.valu e | |
| 3758 | return obj | |
| 3759 | } | |
| 3760 | ||
| 3761 | // exist ing? conve rt to arra y | |
| 3762 | var arr = [ | |
| 3763 | obj[pa ir.name], | |
| 3764 | pair.v alue | |
| 3765 | ] | |
| 3766 | ||
| 3767 | obj[pair .name] = a rr | |
| 3768 | ||
| 3769 | return o bj | |
| 3770 | } | |
| 3771 | ||
| 3772 | Har.protot ype.prep = function (data) { | |
| 3773 | // const ruct utili ty propert ies | |
| 3774 | data.que ryObj = {} | |
| 3775 | data.hea dersObj = {} | |
| 3776 | data.pos tData.json Obj = fals e | |
| 3777 | data.pos tData.para msObj = fa lse | |
| 3778 | ||
| 3779 | // const ruct query objects | |
| 3780 | if (data .queryStri ng && data .queryStri ng.length) { | |
| 3781 | data.q ueryObj = data.query String.red uce(this.r educer, {} ) | |
| 3782 | } | |
| 3783 | ||
| 3784 | // const ruct heade rs objects | |
| 3785 | if (data .headers & & data.hea ders.lengt h) { | |
| 3786 | // low eCase head er keys | |
| 3787 | data.h eadersObj = data.hea ders.reduc eRight(fun ction (hea ders, head er) { | |
| 3788 | head ers[header .name] = h eader.valu e | |
| 3789 | retu rn headers | |
| 3790 | }, {}) | |
| 3791 | } | |
| 3792 | ||
| 3793 | // const ruct Cooki e header | |
| 3794 | if (data .cookies & & data.coo kies.lengt h) { | |
| 3795 | var co okies = da ta.cookies .map(funct ion (cooki e) { | |
| 3796 | retu rn cookie. name + '=' + cookie. value | |
| 3797 | }) | |
| 3798 | ||
| 3799 | if (co okies.leng th) { | |
| 3800 | data .headersOb j.cookie = cookies.j oin('; ') | |
| 3801 | } | |
| 3802 | } | |
| 3803 | ||
| 3804 | // prep body | |
| 3805 | function some (arr ) { | |
| 3806 | return arr.some( function ( type) { | |
| 3807 | retu rn data.po stData.mim eType.inde xOf(type) === 0 | |
| 3808 | }) | |
| 3809 | } | |
| 3810 | ||
| 3811 | if (some ([ | |
| 3812 | 'multi part/mixed ', | |
| 3813 | 'multi part/relat ed', | |
| 3814 | 'multi part/form- data', | |
| 3815 | 'multi part/alter native'])) { | |
| 3816 | ||
| 3817 | // res et values | |
| 3818 | data.p ostData.mi meType = ' multipart/ form-data' | |
| 3819 | } | |
| 3820 | ||
| 3821 | else if (some([ | |
| 3822 | 'appli cation/x-w ww-form-ur lencoded'] )) { | |
| 3823 | ||
| 3824 | if (!d ata.postDa ta.params) { | |
| 3825 | data .postData. text = '' | |
| 3826 | } else { | |
| 3827 | data .postData. paramsObj = data.pos tData.para ms.reduce( this.reduc er, {}) | |
| 3828 | ||
| 3829 | // a lways over write | |
| 3830 | data .postData. text = qs. stringify( data.postD ata.params Obj) | |
| 3831 | } | |
| 3832 | } | |
| 3833 | ||
| 3834 | else if (some([ | |
| 3835 | 'text/ json', | |
| 3836 | 'text/ x-json', | |
| 3837 | 'appli cation/jso n', | |
| 3838 | 'appli cation/x-j son'])) { | |
| 3839 | ||
| 3840 | data.p ostData.mi meType = ' applicatio n/json' | |
| 3841 | ||
| 3842 | if (da ta.postDat a.text) { | |
| 3843 | try { | |
| 3844 | da ta.postDat a.jsonObj = JSON.par se(data.po stData.tex t) | |
| 3845 | } ca tch (e) { | |
| 3846 | th is.request .debug(e) | |
| 3847 | ||
| 3848 | // force bac k to text/ plain | |
| 3849 | da ta.postDat a.mimeType = 'text/p lain' | |
| 3850 | } | |
| 3851 | } | |
| 3852 | } | |
| 3853 | ||
| 3854 | return d ata | |
| 3855 | } | |
| 3856 | ||
| 3857 | Har.protot ype.option s = functi on (option s) { | |
| 3858 | // skip if no har property d efined | |
| 3859 | if (!opt ions.har) { | |
| 3860 | return options | |
| 3861 | } | |
| 3862 | ||
| 3863 | var har = {} | |
| 3864 | extend(h ar, option s.har) | |
| 3865 | ||
| 3866 | // only process th e first en try | |
| 3867 | if (har. log && har .log.entri es) { | |
| 3868 | har = har.log.en tries[0] | |
| 3869 | } | |
| 3870 | ||
| 3871 | // add o ptional pr operties t o make val idation su ccessful | |
| 3872 | har.url = har.url || options .url || op tions.uri || options .baseUrl | | '/' | |
| 3873 | har.http Version = har.httpVe rsion || ' HTTP/1.1' | |
| 3874 | har.quer yString = har.queryS tring || [ ] | |
| 3875 | har.head ers = har. headers || [] | |
| 3876 | har.cook ies = har. cookies || [] | |
| 3877 | har.post Data = har .postData || {} | |
| 3878 | har.post Data.mimeT ype = har. postData.m imeType || 'applicat ion/octet- stream' | |
| 3879 | ||
| 3880 | har.body Size = 0 | |
| 3881 | har.head ersSize = 0 | |
| 3882 | har.post Data.size = 0 | |
| 3883 | ||
| 3884 | if (!val idate.requ est(har)) { | |
| 3885 | return options | |
| 3886 | } | |
| 3887 | ||
| 3888 | // clean up and ge t some uti lity prope rties | |
| 3889 | var req = this.pre p(har) | |
| 3890 | ||
| 3891 | // const ruct new o ptions | |
| 3892 | if (req. url) { | |
| 3893 | option s.url = re q.url | |
| 3894 | } | |
| 3895 | ||
| 3896 | if (req. method) { | |
| 3897 | option s.method = req.metho d | |
| 3898 | } | |
| 3899 | ||
| 3900 | if (Obje ct.keys(re q.queryObj ).length) { | |
| 3901 | option s.qs = req .queryObj | |
| 3902 | } | |
| 3903 | ||
| 3904 | if (Obje ct.keys(re q.headersO bj).length ) { | |
| 3905 | option s.headers = req.head ersObj | |
| 3906 | } | |
| 3907 | ||
| 3908 | function test (typ e) { | |
| 3909 | return req.postD ata.mimeTy pe.indexOf (type) === 0 | |
| 3910 | } | |
| 3911 | if (test ('applicat ion/x-www- form-urlen coded')) { | |
| 3912 | option s.form = r eq.postDat a.paramsOb j | |
| 3913 | } | |
| 3914 | else if (test('app lication/j son')) { | |
| 3915 | if (re q.postData .jsonObj) { | |
| 3916 | opti ons.body = req.postD ata.jsonOb j | |
| 3917 | opti ons.json = true | |
| 3918 | } | |
| 3919 | } | |
| 3920 | else if (test('mul tipart/for m-data')) { | |
| 3921 | option s.formData = {} | |
| 3922 | ||
| 3923 | req.po stData.par ams.forEac h(function (param) { | |
| 3924 | var attachment = {} | |
| 3925 | ||
| 3926 | if ( !param.fil eName && ! param.file Name && !p aram.conte ntType) { | |
| 3927 | op tions.form Data[param .name] = p aram.value | |
| 3928 | re turn | |
| 3929 | } | |
| 3930 | ||
| 3931 | // a ttempt to read from disk! | |
| 3932 | if ( param.file Name && !p aram.value ) { | |
| 3933 | at tachment.v alue = fs. createRead Stream(par am.fileNam e) | |
| 3934 | } el se if (par am.value) { | |
| 3935 | at tachment.v alue = par am.value | |
| 3936 | } | |
| 3937 | ||
| 3938 | if ( param.file Name) { | |
| 3939 | at tachment.o ptions = { | |
| 3940 | filename: param.file Name, | |
| 3941 | contentTyp e: param.c ontentType ? param.c ontentType : null | |
| 3942 | } | |
| 3943 | } | |
| 3944 | ||
| 3945 | opti ons.formDa ta[param.n ame] = att achment | |
| 3946 | }) | |
| 3947 | } | |
| 3948 | else { | |
| 3949 | if (re q.postData .text) { | |
| 3950 | opti ons.body = req.postD ata.text | |
| 3951 | } | |
| 3952 | } | |
| 3953 | ||
| 3954 | return o ptions | |
| 3955 | } | |
| 3956 | ||
| 3957 | exports.Ha r = Har | |
| 3958 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000p ackage/lib /helpers.j s\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x00000 00664 \x0000001 750 \x000000175 0 \x00000000003 130 \x000012676 423610\x0000013 305 \x00000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000usta r\x000000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x000000 0000 \x00000000 00 \x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000'use stri ct' | |
| 3959 | ||
| 3960 | var jsonSa feStringif y = requir e('json-st ringify-sa fe') | |
| 3961 | , crypto = require ('crypto') | |
| 3962 | ||
| 3963 | function d eferMethod () { | |
| 3964 | if (type of setImme diate === 'undefined ') { | |
| 3965 | return process.n extTick | |
| 3966 | } | |
| 3967 | ||
| 3968 | return s etImmediat e | |
| 3969 | } | |
| 3970 | ||
| 3971 | function i sFunction( value) { | |
| 3972 | return t ypeof valu e === 'fun ction' | |
| 3973 | } | |
| 3974 | ||
| 3975 | function p aramsHaveR equestBody (params) { | |
| 3976 | return ( | |
| 3977 | params .body || | |
| 3978 | params .requestBo dyStream | | | |
| 3979 | (param s.json && typeof par ams.json ! == 'boolea n') || | |
| 3980 | params .multipart | |
| 3981 | ) | |
| 3982 | } | |
| 3983 | ||
| 3984 | function s afeStringi fy (obj, r eplacer) { | |
| 3985 | var ret | |
| 3986 | try { | |
| 3987 | ret = JSON.strin gify(obj, replacer) | |
| 3988 | } catch (e) { | |
| 3989 | ret = jsonSafeSt ringify(ob j, replace r) | |
| 3990 | } | |
| 3991 | return r et | |
| 3992 | } | |
| 3993 | ||
| 3994 | function m d5 (str) { | |
| 3995 | return c rypto.crea teHash('md 5').update (str).dige st('hex') | |
| 3996 | } | |
| 3997 | ||
| 3998 | function i sReadStrea m (rs) { | |
| 3999 | return r s.readable && rs.pat h && rs.mo de | |
| 4000 | } | |
| 4001 | ||
| 4002 | function t oBase64 (s tr) { | |
| 4003 | return ( new Buffer (str || '' , 'utf8')) .toString( 'base64') | |
| 4004 | } | |
| 4005 | ||
| 4006 | function c opy (obj) { | |
| 4007 | var o = {} | |
| 4008 | Object.k eys(obj).f orEach(fun ction (i) { | |
| 4009 | o[i] = obj[i] | |
| 4010 | }) | |
| 4011 | return o | |
| 4012 | } | |
| 4013 | ||
| 4014 | function v ersion () { | |
| 4015 | var numb ers = proc ess.versio n.replace( 'v', '').s plit('.') | |
| 4016 | return { | |
| 4017 | major: parseInt( numbers[0] , 10), | |
| 4018 | minor: parseInt( numbers[1] , 10), | |
| 4019 | patch: parseInt( numbers[2] , 10) | |
| 4020 | } | |
| 4021 | } | |
| 4022 | ||
| 4023 | exports.is Function = isFuncti on | |
| 4024 | exports.pa ramsHaveRe questBody = paramsHa veRequestB ody | |
| 4025 | exports.sa feStringif y = safeStri ngify | |
| 4026 | exports.md 5 = md5 | |
| 4027 | exports.is ReadStream = isReadSt ream | |
| 4028 | exports.to Base64 = toBase64 | |
| 4029 | exports.co py = copy | |
| 4030 | exports.ve rsion = version | |
| 4031 | exports.de fer = deferMet hod() | |
| 4032 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000packag e/lib/mult ipart.js\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000000664 \x0000001750 \x0000 001750 \x000000 00005111 \x0000 1267642361 0\x0000013665 \x0000 0\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000ustar\x000000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000000000 \x0000000000 \x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000'use strict' | |
| 4033 | ||
| 4034 | var uuid = require(' node-uuid' ) | |
| 4035 | , Combin edStream = require(' combined-s tream') | |
| 4036 | , isstre am = requi re('isstre am') | |
| 4037 | ||
| 4038 | ||
| 4039 | function M ultipart ( request) { | |
| 4040 | this.req uest = req uest | |
| 4041 | this.bou ndary = uu id() | |
| 4042 | this.chu nked = fal se | |
| 4043 | this.bod y = null | |
| 4044 | } | |
| 4045 | ||
| 4046 | Multipart. prototype. isChunked = function (options) { | |
| 4047 | var self = this | |
| 4048 | , chun ked = fals e | |
| 4049 | , part s = option s.data || options | |
| 4050 | ||
| 4051 | if (!par ts.forEach ) { | |
| 4052 | self.r equest.emi t('error', new Error ('Argument error, op tions.mult ipart.')) | |
| 4053 | } | |
| 4054 | ||
| 4055 | if (opti ons.chunke d !== unde fined) { | |
| 4056 | chunke d = option s.chunked | |
| 4057 | } | |
| 4058 | ||
| 4059 | if (self .request.g etHeader(' transfer-e ncoding') === 'chunk ed') { | |
| 4060 | chunke d = true | |
| 4061 | } | |
| 4062 | ||
| 4063 | if (!chu nked) { | |
| 4064 | parts. forEach(fu nction (pa rt) { | |
| 4065 | if ( typeof par t.body === 'undefine d') { | |
| 4066 | se lf.request .emit('err or', new E rror('Body attribute missing i n multipar t.')) | |
| 4067 | } | |
| 4068 | if ( isstream(p art.body)) { | |
| 4069 | ch unked = tr ue | |
| 4070 | } | |
| 4071 | }) | |
| 4072 | } | |
| 4073 | ||
| 4074 | return c hunked | |
| 4075 | } | |
| 4076 | ||
| 4077 | Multipart. prototype. setHeaders = functio n (chunked ) { | |
| 4078 | var self = this | |
| 4079 | ||
| 4080 | if (chun ked && !se lf.request .hasHeader ('transfer -encoding' )) { | |
| 4081 | self.r equest.set Header('tr ansfer-enc oding', 'c hunked') | |
| 4082 | } | |
| 4083 | ||
| 4084 | var head er = self. request.ge tHeader('c ontent-typ e') | |
| 4085 | ||
| 4086 | if (!hea der || hea der.indexO f('multipa rt') === - 1) { | |
| 4087 | self.r equest.set Header('co ntent-type ', 'multip art/relate d; boundar y=' + self .boundary) | |
| 4088 | } else { | |
| 4089 | if (he ader.index Of('bounda ry') !== - 1) { | |
| 4090 | self .boundary = header.r eplace(/.* boundary=( [^\s;]+).* /, '$1') | |
| 4091 | } else { | |
| 4092 | self .request.s etHeader(' content-ty pe', heade r + '; bou ndary=' + self.bound ary) | |
| 4093 | } | |
| 4094 | } | |
| 4095 | } | |
| 4096 | ||
| 4097 | Multipart. prototype. build = fu nction (pa rts, chunk ed) { | |
| 4098 | var self = this | |
| 4099 | var body = chunked ? new Com binedStrea m() : [] | |
| 4100 | ||
| 4101 | function add (part ) { | |
| 4102 | if (ty peof part === 'numbe r') { | |
| 4103 | part = part.to String() | |
| 4104 | } | |
| 4105 | return chunked ? body.appe nd(part) : body.push (new Buffe r(part)) | |
| 4106 | } | |
| 4107 | ||
| 4108 | if (self .request.p reambleCRL F) { | |
| 4109 | add('\ r\n') | |
| 4110 | } | |
| 4111 | ||
| 4112 | parts.fo rEach(func tion (part ) { | |
| 4113 | var pr eamble = ' --' + self .boundary + '\r\n' | |
| 4114 | Object .keys(part ).forEach( function ( key) { | |
| 4115 | if ( key === 'b ody') { re turn } | |
| 4116 | prea mble += ke y + ': ' + part[key] + '\r\n' | |
| 4117 | }) | |
| 4118 | preamb le += '\r\ n' | |
| 4119 | add(pr eamble) | |
| 4120 | add(pa rt.body) | |
| 4121 | add('\ r\n') | |
| 4122 | }) | |
| 4123 | add('--' + self.bo undary + ' --') | |
| 4124 | ||
| 4125 | if (self .request.p ostambleCR LF) { | |
| 4126 | add('\ r\n') | |
| 4127 | } | |
| 4128 | ||
| 4129 | return b ody | |
| 4130 | } | |
| 4131 | ||
| 4132 | Multipart. prototype. onRequest = function (options) { | |
| 4133 | var self = this | |
| 4134 | ||
| 4135 | var chun ked = self .isChunked (options) | |
| 4136 | , part s = option s.data || options | |
| 4137 | ||
| 4138 | self.set Headers(ch unked) | |
| 4139 | self.chu nked = chu nked | |
| 4140 | self.bod y = self.b uild(parts , chunked) | |
| 4141 | } | |
| 4142 | ||
| 4143 | exports.Mu ltipart = Multipart | |
| 4144 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000p ackage/lib /oauth.js\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x00000 00664 \x0000001 750 \x000000175 0 \x00000000007 562 \x000012676 423610\x0000013 000 \x00000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000usta r\x000000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x000000 0000 \x00000000 00 \x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000'use stri ct' | |
| 4145 | ||
| 4146 | var url = require('u rl') | |
| 4147 | , qs = r equire('qs ') | |
| 4148 | , casele ss = requi re('casele ss') | |
| 4149 | , uuid = require(' node-uuid' ) | |
| 4150 | , oauth = require( 'oauth-sig n') | |
| 4151 | , crypto = require ('crypto') | |
| 4152 | ||
| 4153 | ||
| 4154 | function O Auth (requ est) { | |
| 4155 | this.req uest = req uest | |
| 4156 | this.par ams = null | |
| 4157 | } | |
| 4158 | ||
| 4159 | OAuth.prot otype.buil dParams = function ( _oauth, ur i, method, query, fo rm, qsLib) { | |
| 4160 | var oa = {} | |
| 4161 | for (var i in _oau th) { | |
| 4162 | oa['oa uth_' + i] = _oauth[ i] | |
| 4163 | } | |
| 4164 | if (!oa. oauth_vers ion) { | |
| 4165 | oa.oau th_version = '1.0' | |
| 4166 | } | |
| 4167 | if (!oa. oauth_time stamp) { | |
| 4168 | oa.oau th_timesta mp = Math. floor( Dat e.now() / 1000 ).toS tring() | |
| 4169 | } | |
| 4170 | if (!oa. oauth_nonc e) { | |
| 4171 | oa.oau th_nonce = uuid().re place(/-/g , '') | |
| 4172 | } | |
| 4173 | if (!oa. oauth_sign ature_meth od) { | |
| 4174 | oa.oau th_signatu re_method = 'HMAC-SH A1' | |
| 4175 | } | |
| 4176 | ||
| 4177 | var cons umer_secre t_or_priva te_key = o a.oauth_co nsumer_sec ret || oa. oauth_priv ate_key | |
| 4178 | delete o a.oauth_co nsumer_sec ret | |
| 4179 | delete o a.oauth_pr ivate_key | |
| 4180 | ||
| 4181 | var toke n_secret = oa.oauth_ token_secr et | |
| 4182 | delete o a.oauth_to ken_secret | |
| 4183 | ||
| 4184 | var real m = oa.oau th_realm | |
| 4185 | delete o a.oauth_re alm | |
| 4186 | delete o a.oauth_tr ansport_me thod | |
| 4187 | ||
| 4188 | var base url = uri. protocol + '//' + ur i.host + u ri.pathnam e | |
| 4189 | var para ms = qsLib .parse([]. concat(que ry, form, qsLib.stri ngify(oa)) .join('&') ) | |
| 4190 | ||
| 4191 | oa.oauth _signature = oauth.s ign( | |
| 4192 | oa.oau th_signatu re_method, | |
| 4193 | method , | |
| 4194 | baseur l, | |
| 4195 | params , | |
| 4196 | consum er_secret_ or_private _key, | |
| 4197 | token_ secret) | |
| 4198 | ||
| 4199 | if (real m) { | |
| 4200 | oa.rea lm = realm | |
| 4201 | } | |
| 4202 | ||
| 4203 | return o a | |
| 4204 | } | |
| 4205 | ||
| 4206 | OAuth.prot otype.buil dBodyHash = function (_oauth, b ody) { | |
| 4207 | if (['HM AC-SHA1', 'RSA-SHA1' ].indexOf( _oauth.sig nature_met hod || 'HM AC-SHA1') < 0) { | |
| 4208 | this.r equest.emi t('error', new Error ('oauth: ' + _oauth. signature_ method + | |
| 4209 | ' si gnature_me thod not s upported w ith body_h ash signin g.')) | |
| 4210 | } | |
| 4211 | ||
| 4212 | var shas um = crypt o.createHa sh('sha1') | |
| 4213 | shasum.u pdate(body || '') | |
| 4214 | var sha1 = shasum. digest('he x') | |
| 4215 | ||
| 4216 | return n ew Buffer( sha1).toSt ring('base 64') | |
| 4217 | } | |
| 4218 | ||
| 4219 | OAuth.prot otype.conc atParams = function (oa, sep, wrap) { | |
| 4220 | wrap = w rap || '' | |
| 4221 | ||
| 4222 | var para ms = Objec t.keys(oa) .filter(fu nction (i) { | |
| 4223 | return i !== 're alm' && i !== 'oauth _signature ' | |
| 4224 | }).sort( ) | |
| 4225 | ||
| 4226 | if (oa.r ealm) { | |
| 4227 | params .splice(0, 0, 'realm ') | |
| 4228 | } | |
| 4229 | params.p ush('oauth _signature ') | |
| 4230 | ||
| 4231 | return p arams.map( function ( i) { | |
| 4232 | return i + '=' + wrap + oa uth.rfc398 6(oa[i]) + wrap | |
| 4233 | }).join( sep) | |
| 4234 | } | |
| 4235 | ||
| 4236 | OAuth.prot otype.onRe quest = fu nction (_o auth) { | |
| 4237 | var self = this | |
| 4238 | self.par ams = _oau th | |
| 4239 | ||
| 4240 | var uri = self.req uest.uri | | {} | |
| 4241 | , meth od = self. request.me thod || '' | |
| 4242 | , head ers = case less(self. request.he aders) | |
| 4243 | , body = self.re quest.body || '' | |
| 4244 | , qsLi b = self.r equest.qsL ib || qs | |
| 4245 | ||
| 4246 | var form | |
| 4247 | , quer y | |
| 4248 | , cont entType = headers.ge t('content -type') || '' | |
| 4249 | , form ContentTyp e = 'appli cation/x-w ww-form-ur lencoded' | |
| 4250 | , tran sport = _o auth.trans port_metho d || 'head er' | |
| 4251 | ||
| 4252 | if (cont entType.sl ice(0, for mContentTy pe.length) === formC ontentType ) { | |
| 4253 | conten tType = fo rmContentT ype | |
| 4254 | form = body | |
| 4255 | } | |
| 4256 | if (uri. query) { | |
| 4257 | query = uri.quer y | |
| 4258 | } | |
| 4259 | if (tran sport === 'body' && (method != = 'POST' | | contentT ype !== fo rmContentT ype)) { | |
| 4260 | self.r equest.emi t('error', new Error ('oauth: t ransport_m ethod of b ody requir es POST ' + | |
| 4261 | 'and content-t ype ' + fo rmContentT ype)) | |
| 4262 | } | |
| 4263 | ||
| 4264 | if (!for m && typeo f _oauth.b ody_hash = == 'boolea n') { | |
| 4265 | _oauth .body_hash = self.bu ildBodyHas h(_oauth, self.reque st.body.to String()) | |
| 4266 | } | |
| 4267 | ||
| 4268 | var oa = self.buil dParams(_o auth, uri, method, q uery, form , qsLib) | |
| 4269 | ||
| 4270 | switch ( transport) { | |
| 4271 | case ' header': | |
| 4272 | self .request.s etHeader(' Authorizat ion', 'OAu th ' + sel f.concatPa rams(oa, ' ,', '"')) | |
| 4273 | brea k | |
| 4274 | ||
| 4275 | case ' query': | |
| 4276 | var href = sel f.request. uri.href + = (query ? '&' : '?' ) + self.c oncatParam s(oa, '&') | |
| 4277 | self .request.u ri = url.p arse(href) | |
| 4278 | self .request.p ath = self .request.u ri.path | |
| 4279 | brea k | |
| 4280 | ||
| 4281 | case ' body': | |
| 4282 | self .request.b ody = (for m ? form + '&' : '') + self.co ncatParams (oa, '&') | |
| 4283 | brea k | |
| 4284 | ||
| 4285 | defaul t: | |
| 4286 | self .request.e mit('error ', new Err or('oauth: transport _method in valid')) | |
| 4287 | } | |
| 4288 | } | |
| 4289 | ||
| 4290 | exports.OA uth = OAut h | |
| 4291 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000package/ lib/querys tring.js\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000000664 \x0000 001750 \x000000 1750 \x00000000 002465 \x000012 676423610\x0000 014251 \x00000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000u star\x000000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000000000 \x00000 00000 \x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000'use s trict' | |
| 4292 | ||
| 4293 | var qs = r equire('qs ') | |
| 4294 | , querys tring = re quire('que rystring') | |
| 4295 | ||
| 4296 | ||
| 4297 | function Q uerystring (request) { | |
| 4298 | this.req uest = req uest | |
| 4299 | this.lib = null | |
| 4300 | this.use Querystrin g = null | |
| 4301 | this.par seOptions = null | |
| 4302 | this.str ingifyOpti ons = null | |
| 4303 | } | |
| 4304 | ||
| 4305 | Querystrin g.prototyp e.init = f unction (o ptions) { | |
| 4306 | if (this .lib) {ret urn} | |
| 4307 | ||
| 4308 | this.use Querystrin g = option s.useQuery string | |
| 4309 | this.lib = (this.u seQuerystr ing ? quer ystring : qs) | |
| 4310 | ||
| 4311 | this.par seOptions = options. qsParseOpt ions || {} | |
| 4312 | this.str ingifyOpti ons = opti ons.qsStri ngifyOptio ns || {} | |
| 4313 | } | |
| 4314 | ||
| 4315 | Querystrin g.prototyp e.stringif y = functi on (obj) { | |
| 4316 | return ( this.useQu erystring) | |
| 4317 | ? this .rfc3986(t his.lib.st ringify(ob j, | |
| 4318 | this .stringify Options.se p || null, | |
| 4319 | this .stringify Options.eq || null, | |
| 4320 | this .stringify Options)) | |
| 4321 | : this .lib.strin gify(obj, this.strin gifyOption s) | |
| 4322 | } | |
| 4323 | ||
| 4324 | Querystrin g.prototyp e.parse = function ( str) { | |
| 4325 | return ( this.useQu erystring) | |
| 4326 | ? this .lib.parse (str, | |
| 4327 | this .parseOpti ons.sep || null, | |
| 4328 | this .parseOpti ons.eq || null, | |
| 4329 | this .parseOpti ons) | |
| 4330 | : this .lib.parse (str, this .parseOpti ons) | |
| 4331 | } | |
| 4332 | ||
| 4333 | Querystrin g.prototyp e.rfc3986 = function (str) { | |
| 4334 | return s tr.replace (/[!'()*]/ g, functio n (c) { | |
| 4335 | return '%' + c.c harCodeAt( 0).toStrin g(16).toUp perCase() | |
| 4336 | }) | |
| 4337 | } | |
| 4338 | ||
| 4339 | Querystrin g.prototyp e.unescape = queryst ring.unesc ape | |
| 4340 | ||
| 4341 | exports.Qu erystring = Querystr ing | |
| 4342 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000package /lib/redir ect.js\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000000664 \x0000001750 \x00000 01750 \x0000000 0010520 \x00001 2676423610 \x0000013445 \x00000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 ustar\x000000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000000000 \x0000 000000 \x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000'use strict' | |
| 4343 | ||
| 4344 | var url = require('u rl') | |
| 4345 | var isUrl = /^https? :/ | |
| 4346 | ||
| 4347 | function R edirect (r equest) { | |
| 4348 | this.req uest = req uest | |
| 4349 | this.fol lowRedirec t = true | |
| 4350 | this.fol lowRedirec ts = true | |
| 4351 | this.fol lowAllRedi rects = fa lse | |
| 4352 | this.all owRedirect = functio n () {retu rn true} | |
| 4353 | this.max Redirects = 10 | |
| 4354 | this.red irects = [ ] | |
| 4355 | this.red irectsFoll owed = 0 | |
| 4356 | this.rem oveReferer Header = f alse | |
| 4357 | } | |
| 4358 | ||
| 4359 | Redirect.p rototype.o nRequest = function (options) { | |
| 4360 | var self = this | |
| 4361 | ||
| 4362 | if (opti ons.maxRed irects !== undefined ) { | |
| 4363 | self.m axRedirect s = option s.maxRedir ects | |
| 4364 | } | |
| 4365 | if (type of options .followRed irect === 'function' ) { | |
| 4366 | self.a llowRedire ct = optio ns.followR edirect | |
| 4367 | } | |
| 4368 | if (opti ons.follow Redirect ! == undefin ed) { | |
| 4369 | self.f ollowRedir ects = !!o ptions.fol lowRedirec t | |
| 4370 | } | |
| 4371 | if (opti ons.follow AllRedirec ts !== und efined) { | |
| 4372 | self.f ollowAllRe directs = options.fo llowAllRed irects | |
| 4373 | } | |
| 4374 | if (self .followRed irects || self.follo wAllRedire cts) { | |
| 4375 | self.r edirects = self.redi rects || [ ] | |
| 4376 | } | |
| 4377 | if (opti ons.remove RefererHea der !== un defined) { | |
| 4378 | self.r emoveRefer erHeader = options.r emoveRefer erHeader | |
| 4379 | } | |
| 4380 | } | |
| 4381 | ||
| 4382 | Redirect.p rototype.r edirectTo = function (response ) { | |
| 4383 | var self = this | |
| 4384 | , requ est = self .request | |
| 4385 | ||
| 4386 | var redi rectTo = n ull | |
| 4387 | if (resp onse.statu sCode >= 3 00 && resp onse.statu sCode < 40 0 && respo nse.casele ss.has('lo cation')) { | |
| 4388 | var lo cation = r esponse.ca seless.get ('location ') | |
| 4389 | reques t.debug('r edirect', location) | |
| 4390 | ||
| 4391 | if (se lf.followA llRedirect s) { | |
| 4392 | redi rectTo = l ocation | |
| 4393 | } else if (self. followRedi rects) { | |
| 4394 | swit ch (reques t.method) { | |
| 4395 | ca se 'PATCH' : | |
| 4396 | ca se 'PUT': | |
| 4397 | ca se 'POST': | |
| 4398 | ca se 'DELETE ': | |
| 4399 | // Do not follow red irects | |
| 4400 | break | |
| 4401 | de fault: | |
| 4402 | redirectTo = locatio n | |
| 4403 | break | |
| 4404 | } | |
| 4405 | } | |
| 4406 | } else i f (respons e.statusCo de === 401 ) { | |
| 4407 | var au thHeader = request._ auth.onRes ponse(resp onse) | |
| 4408 | if (au thHeader) { | |
| 4409 | requ est.setHea der('autho rization', authHeade r) | |
| 4410 | redi rectTo = r equest.uri | |
| 4411 | } | |
| 4412 | } | |
| 4413 | return r edirectTo | |
| 4414 | } | |
| 4415 | ||
| 4416 | Redirect.p rototype.o nResponse = function (response ) { | |
| 4417 | var self = this | |
| 4418 | , requ est = self .request | |
| 4419 | ||
| 4420 | var redi rectTo = s elf.redire ctTo(respo nse) | |
| 4421 | if (!red irectTo || !self.all owRedirect .call(requ est, respo nse)) { | |
| 4422 | return false | |
| 4423 | } | |
| 4424 | ||
| 4425 | request. debug('red irect to', redirectT o) | |
| 4426 | ||
| 4427 | // ignor e any pote ntial resp onse body. it canno t possibly be useful | |
| 4428 | // to us at this p oint. | |
| 4429 | // respo nse.resume should be defined, but check anyway bef ore callin g. Workaro und for br owserify. | |
| 4430 | if (resp onse.resum e) { | |
| 4431 | respon se.resume( ) | |
| 4432 | } | |
| 4433 | ||
| 4434 | if (self .redirects Followed > = self.max Redirects) { | |
| 4435 | reques t.emit('er ror', new Error('Exc eeded maxR edirects. Probably s tuck in a redirect l oop ' + re quest.uri. href)) | |
| 4436 | return false | |
| 4437 | } | |
| 4438 | self.red irectsFoll owed += 1 | |
| 4439 | ||
| 4440 | if (!isU rl.test(re directTo)) { | |
| 4441 | redire ctTo = url .resolve(r equest.uri .href, red irectTo) | |
| 4442 | } | |
| 4443 | ||
| 4444 | var uriP rev = requ est.uri | |
| 4445 | request. uri = url. parse(redi rectTo) | |
| 4446 | ||
| 4447 | // handl e the case where we change pro tocol from https to http or vi ce versa | |
| 4448 | if (requ est.uri.pr otocol !== uriPrev.p rotocol) { | |
| 4449 | delete request.a gent | |
| 4450 | } | |
| 4451 | ||
| 4452 | self.red irects.pus h( | |
| 4453 | { stat usCode : r esponse.st atusCode | |
| 4454 | , redi rectUri: r edirectTo | |
| 4455 | } | |
| 4456 | ) | |
| 4457 | if (self .followAll Redirects && request .method != = 'HEAD' | |
| 4458 | && res ponse.stat usCode !== 401 && re sponse.sta tusCode != = 307) { | |
| 4459 | reques t.method = 'GET' | |
| 4460 | } | |
| 4461 | // reque st.method = 'GET' // Force all redirects to use GE T || comme nted out f ixes #215 | |
| 4462 | delete r equest.src | |
| 4463 | delete r equest.req | |
| 4464 | delete r equest._st arted | |
| 4465 | if (resp onse.statu sCode !== 401 && res ponse.stat usCode !== 307) { | |
| 4466 | // Rem ove parame ters from the previo us respons e, unless this is th e second r equest | |
| 4467 | // for a server that requi res digest authentic ation. | |
| 4468 | delete request.b ody | |
| 4469 | delete request._ form | |
| 4470 | if (re quest.head ers) { | |
| 4471 | requ est.remove Header('ho st') | |
| 4472 | requ est.remove Header('co ntent-type ') | |
| 4473 | requ est.remove Header('co ntent-leng th') | |
| 4474 | if ( request.ur i.hostname !== reque st.origina lHost.spli t(':')[0]) { | |
| 4475 | // Remove au thorizatio n if chang ing hostna mes (but n ot if just | |
| 4476 | // changing ports or p rotocols). This mat ches the b ehavior of curl: | |
| 4477 | // https://g ithub.com/ bagder/cur l/blob/6be b0eee/lib/ http.c#L71 0 | |
| 4478 | re quest.remo veHeader(' authorizat ion') | |
| 4479 | } | |
| 4480 | } | |
| 4481 | } | |
| 4482 | ||
| 4483 | if (!sel f.removeRe fererHeade r) { | |
| 4484 | reques t.setHeade r('referer ', uriPrev .href) | |
| 4485 | } | |
| 4486 | ||
| 4487 | request. emit('redi rect') | |
| 4488 | ||
| 4489 | request. init() | |
| 4490 | ||
| 4491 | return t rue | |
| 4492 | } | |
| 4493 | ||
| 4494 | exports.Re direct = R edirect | |
| 4495 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000pack age/lib/tu nnel.js\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x00000006 64 \x0000001750 \x0000001750 \x0000 0000010671 \x000012676423 610\x0000013160 \x00000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000ustar\x00000 0\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x000000000 0 \x0000000000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000'u se strict' | |
| 4496 | ||
| 4497 | var url = require('u rl') | |
| 4498 | , tunnel = require ('tunnel-a gent') | |
| 4499 | ||
| 4500 | var defaul tProxyHead erWhiteLis t = [ | |
| 4501 | 'accept' , | |
| 4502 | 'accept- charset', | |
| 4503 | 'accept- encoding', | |
| 4504 | 'accept- language', | |
| 4505 | 'accept- ranges', | |
| 4506 | 'cache-c ontrol', | |
| 4507 | 'content -encoding' , | |
| 4508 | 'content -language' , | |
| 4509 | 'content -location' , | |
| 4510 | 'content -md5', | |
| 4511 | 'content -range', | |
| 4512 | 'content -type', | |
| 4513 | 'connect ion', | |
| 4514 | 'date', | |
| 4515 | 'expect' , | |
| 4516 | 'max-for wards', | |
| 4517 | 'pragma' , | |
| 4518 | 'referer ', | |
| 4519 | 'te', | |
| 4520 | 'user-ag ent', | |
| 4521 | 'via' | |
| 4522 | ] | |
| 4523 | ||
| 4524 | var defaul tProxyHead erExclusiv eList = [ | |
| 4525 | 'proxy-a uthorizati on' | |
| 4526 | ] | |
| 4527 | ||
| 4528 | function c onstructPr oxyHost(ur iObject) { | |
| 4529 | var port = uriObje ct.port | |
| 4530 | , prot ocol = uri Object.pro tocol | |
| 4531 | , prox yHost = ur iObject.ho stname + ' :' | |
| 4532 | ||
| 4533 | if (port ) { | |
| 4534 | proxyH ost += por t | |
| 4535 | } else i f (protoco l === 'htt ps:') { | |
| 4536 | proxyH ost += '44 3' | |
| 4537 | } else { | |
| 4538 | proxyH ost += '80 ' | |
| 4539 | } | |
| 4540 | ||
| 4541 | return p roxyHost | |
| 4542 | } | |
| 4543 | ||
| 4544 | function c onstructPr oxyHeaderW hiteList(h eaders, pr oxyHeaderW hiteList) { | |
| 4545 | var whit eList = pr oxyHeaderW hiteList | |
| 4546 | .reduc e(function (set, hea der) { | |
| 4547 | set[ header.toL owerCase() ] = true | |
| 4548 | retu rn set | |
| 4549 | }, {}) | |
| 4550 | ||
| 4551 | return O bject.keys (headers) | |
| 4552 | .filte r(function (header) { | |
| 4553 | retu rn whiteLi st[header. toLowerCas e()] | |
| 4554 | }) | |
| 4555 | .reduc e(function (set, hea der) { | |
| 4556 | set[ header] = headers[he ader] | |
| 4557 | retu rn set | |
| 4558 | }, {}) | |
| 4559 | } | |
| 4560 | ||
| 4561 | function c onstructTu nnelOption s (request , proxyHea ders) { | |
| 4562 | var prox y = reques t.proxy | |
| 4563 | ||
| 4564 | var tunn elOptions = { | |
| 4565 | proxy : { | |
| 4566 | host : pr oxy.hostna me, | |
| 4567 | port : +p roxy.port, | |
| 4568 | prox yAuth : pr oxy.auth, | |
| 4569 | head ers : pr oxyHeaders | |
| 4570 | }, | |
| 4571 | header s : reque st.headers , | |
| 4572 | ca : reque st.ca, | |
| 4573 | cert : reque st.cert, | |
| 4574 | key : reque st.key, | |
| 4575 | passph rase : reque st.passphr ase, | |
| 4576 | pfx : reque st.pfx, | |
| 4577 | cipher s : reque st.ciphers , | |
| 4578 | reject Unauthoriz ed : reque st.rejectU nauthorize d, | |
| 4579 | secure Options : reque st.secureO ptions, | |
| 4580 | secure Protocol : reque st.secureP rotocol | |
| 4581 | } | |
| 4582 | ||
| 4583 | return t unnelOptio ns | |
| 4584 | } | |
| 4585 | ||
| 4586 | function c onstructTu nnelFnName (uri, prox y) { | |
| 4587 | var uriP rotocol = (uri.proto col === 'h ttps:' ? ' https' : ' http') | |
| 4588 | var prox yProtocol = (proxy.p rotocol == = 'https:' ? 'Https' : 'Http') | |
| 4589 | return [ uriProtoco l, proxyPr otocol].jo in('Over') | |
| 4590 | } | |
| 4591 | ||
| 4592 | function g etTunnelFn (request) { | |
| 4593 | var uri = request. uri | |
| 4594 | var prox y = reques t.proxy | |
| 4595 | var tunn elFnName = construct TunnelFnNa me(uri, pr oxy) | |
| 4596 | return t unnel[tunn elFnName] | |
| 4597 | } | |
| 4598 | ||
| 4599 | ||
| 4600 | function T unnel (req uest) { | |
| 4601 | this.req uest = req uest | |
| 4602 | this.pro xyHeaderWh iteList = defaultPro xyHeaderWh iteList | |
| 4603 | this.pro xyHeaderEx clusiveLis t = [] | |
| 4604 | if (type of request .tunnel != = 'undefin ed') { | |
| 4605 | this.t unnelOverr ide = requ est.tunnel | |
| 4606 | } | |
| 4607 | } | |
| 4608 | ||
| 4609 | Tunnel.pro totype.isE nabled = f unction () { | |
| 4610 | var self = this | |
| 4611 | , requ est = self .request | |
| 4612 | // Tunne l HTTPS by default. Allow the user to ov erride thi s setting. | |
| 4613 | ||
| 4614 | // If se lf.tunnelO verride is set (the user speci fied a val ue), use i t. | |
| 4615 | if (type of self.tu nnelOverri de !== 'un defined') { | |
| 4616 | return self.tunn elOverride | |
| 4617 | } | |
| 4618 | ||
| 4619 | // If th e destinat ion is HTT PS, tunnel . | |
| 4620 | if (requ est.uri.pr otocol === 'https:') { | |
| 4621 | return true | |
| 4622 | } | |
| 4623 | ||
| 4624 | // Other wise, do n ot use tun nel. | |
| 4625 | return f alse | |
| 4626 | } | |
| 4627 | ||
| 4628 | Tunnel.pro totype.set up = funct ion (optio ns) { | |
| 4629 | var self = this | |
| 4630 | , requ est = self .request | |
| 4631 | ||
| 4632 | options = options || {} | |
| 4633 | ||
| 4634 | if (type of request .proxy === 'string') { | |
| 4635 | reques t.proxy = url.parse( request.pr oxy) | |
| 4636 | } | |
| 4637 | ||
| 4638 | if (!req uest.proxy || !reque st.tunnel) { | |
| 4639 | return false | |
| 4640 | } | |
| 4641 | ||
| 4642 | // Setup Proxy Hea der Exclus ive List a nd White L ist | |
| 4643 | if (opti ons.proxyH eaderWhite List) { | |
| 4644 | self.p roxyHeader WhiteList = options. proxyHeade rWhiteList | |
| 4645 | } | |
| 4646 | if (opti ons.proxyH eaderExclu siveList) { | |
| 4647 | self.p roxyHeader ExclusiveL ist = opti ons.proxyH eaderExclu siveList | |
| 4648 | } | |
| 4649 | ||
| 4650 | var prox yHeaderExc lusiveList = self.pr oxyHeaderE xclusiveLi st.concat( defaultPro xyHeaderEx clusiveLis t) | |
| 4651 | var prox yHeaderWhi teList = s elf.proxyH eaderWhite List.conca t(proxyHea derExclusi veList) | |
| 4652 | ||
| 4653 | // Setup Proxy Hea ders and P roxy Heade rs Host | |
| 4654 | // Only send the P roxy White Listed He ader names | |
| 4655 | var prox yHeaders = construct ProxyHeade rWhiteList (request.h eaders, pr oxyHeaderW hiteList) | |
| 4656 | proxyHea ders.host = construc tProxyHost (request.u ri) | |
| 4657 | ||
| 4658 | proxyHea derExclusi veList.for Each(reque st.removeH eader, req uest) | |
| 4659 | ||
| 4660 | // Set A gent from Tunnel Dat a | |
| 4661 | var tunn elFn = get TunnelFn(r equest) | |
| 4662 | var tunn elOptions = construc tTunnelOpt ions(reque st, proxyH eaders) | |
| 4663 | request. agent = tu nnelFn(tun nelOptions ) | |
| 4664 | ||
| 4665 | return t rue | |
| 4666 | } | |
| 4667 | ||
| 4668 | Tunnel.def aultProxyH eaderWhite List = def aultProxyH eaderWhite List | |
| 4669 | Tunnel.def aultProxyH eaderExclu siveList = defaultPr oxyHeaderE xclusiveLi st | |
| 4670 | exports.Tu nnel = Tun nel | |
| 4671 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000package/C ONTRIBUTIN G.md\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000000664 \x00000 01750 \x0000001 750 \x000000000 06300 \x0000126 76423610\x00000 12772 \x00000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000us tar\x000000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 000000 \x000000 0000 \x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000 | |
| 4672 | # Contribu ting to Re quest | |
| 4673 | ||
| 4674 | :+1::tada: First off , thanks f or taking the time t o contribu te! :tada: :+1: | |
| 4675 | ||
| 4676 | The follow ing is a s et of guid elines for contribut ing to Req uest and i ts package s, which a re hosted in the [Re quest Orga nization]( https://gi thub.com/r equest) on GitHub. | |
| 4677 | These are just guide lines, not rules, us e your bes t judgment and feel free to pr opose chan ges to thi s document in a pull request. | |
| 4678 | ||
| 4679 | ||
| 4680 | ## Submitt ing an Iss ue | |
| 4681 | ||
| 4682 | 1. Provide a small s elf **suff icient** c ode exampl e to **rep roduce** t he issue. | |
| 4683 | 2. Run you r test cod e using [r equest-deb ug](https: //github.c om/request /request-d ebug) and copy/paste the resul ts inside the issue. | |
| 4684 | 3. You sho uld **alwa ys** use f enced code blocks wh en submitt ing code e xamples or any other formatted output: | |
| 4685 | <pre> | |
| 4686 | ```js | |
| 4687 | put your javascrip t code her e | |
| 4688 | ``` | |
| 4689 | ||
| 4690 | ``` | |
| 4691 | put any other form atted outp ut here, | |
| 4692 | like for example t he one ret urned from using req uest-debug | |
| 4693 | ``` | |
| 4694 | </pre> | |
| 4695 | ||
| 4696 | If the pro blem canno t be relia bly reprod uced, the issue will be marked as `Not e nough info (see CONT RIBUTING.m d)`. | |
| 4697 | ||
| 4698 | If the pro blem is no t related to request the issue will be m arked as ` Help (plea se use Sta ckoverflow )`. | |
| 4699 | ||
| 4700 | ||
| 4701 | ## Submitt ing a Pull Request | |
| 4702 | ||
| 4703 | 1. In almo st all of the cases your PR ** needs test s**. Make sure you h ave any. | |
| 4704 | 2. Run `np m test` lo cally. Fix any error s before p ushing to GitHub. | |
| 4705 | 3. After s ubmitting the PR a b uild will be trigger ed on Trav isCI. Wait for it to ends and make sure all jobs a re passing . | |
| 4706 | ||
| 4707 | ||
| 4708 | ---------- ---------- ---------- ---------- - | |
| 4709 | ||
| 4710 | ||
| 4711 | ## Becomin g a Contri butor | |
| 4712 | ||
| 4713 | Individual s making s ignificant and valua ble contri butions ar e given | |
| 4714 | commit-acc ess to the project t o contribu te as they see fit. This proje ct is | |
| 4715 | more like an open wi ki than a standard g uarded ope n source p roject. | |
| 4716 | ||
| 4717 | ||
| 4718 | ## Rules | |
| 4719 | ||
| 4720 | There are a few basi c ground-r ules for c ontributor s: | |
| 4721 | ||
| 4722 | 1. **No `- -force` pu shes** or modifying the Git hi story in a ny way. | |
| 4723 | 1. **Non-m aster bran ches** oug ht to be u sed for on going work . | |
| 4724 | 1. **Any** change sh ould be ad ded throug h Pull Req uest. | |
| 4725 | 1. **Exter nal API ch anges and significan t modifica tions** ou ght to be subject | |
| 4726 | to an * *internal pull-reque st** to so licit feed back from other cont ributors. | |
| 4727 | 1. Interna l pull-req uests to s olicit fee dback are *encourage d* for any other | |
| 4728 | non-tri vial contr ibution bu t left to the discre tion of th e contribu tor. | |
| 4729 | 1. For sig nificant c hanges wai t a full 2 4 hours be fore mergi ng so that active | |
| 4730 | contrib utors who are distri buted thro ughout the world hav e a chance to weigh | |
| 4731 | in. | |
| 4732 | 1. Contrib utors shou ld attempt to adhere to the pr evailing c ode-style. | |
| 4733 | 1. Run `np m test` lo cally befo re submitt ing your P R, to catc h any easy to miss | |
| 4734 | style & testing i ssues. To diagnose test failu res, there are two w ays to | |
| 4735 | run a s ingle test file: | |
| 4736 | - `no de_modules /.bin/tape r tests/te st-file.js ` - run us ing the de fault | |
| 4737 | [`t aper`](htt ps://githu b.com/nyle n/taper) t est report er. | |
| 4738 | - `no de tests/t est-file.j s` - view the raw | |
| 4739 | [ta p](https:/ /testanyth ing.org/) output. | |
| 4740 | ||
| 4741 | ||
| 4742 | ## Release s | |
| 4743 | ||
| 4744 | Declaring formal rel eases rema ins the pr erogative of the pro ject maint ainer. | |
| 4745 | ||
| 4746 | ||
| 4747 | ## Changes to this a rrangement | |
| 4748 | ||
| 4749 | This is an experimen t and feed back is we lcome! Thi s document may also be | |
| 4750 | subject to pull-requ ests or ch anges by c ontributor s where yo u believe you have | |
| 4751 | something valuable t o add or c hange. | |
| 4752 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 package/.e slintrc\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 000664 \x000000 1750 \x00000017 50 \x0000000000 2671 \x00001267 6423610\x000001 2374 \x00000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000ust ar\x000000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x00000 00000 \x0000000 000 \x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000{ | |
| 4753 | "env": { | |
| 4754 | "node" : true | |
| 4755 | }, | |
| 4756 | "rules": { | |
| 4757 | // 2-s pace inden tation | |
| 4758 | "inden t": [2, 2, {"SwitchC ase": 1}], | |
| 4759 | // Dis allow semi -colons, u nless need ed to disa mbiguate s tatement | |
| 4760 | "semi" : [2, "nev er"], | |
| 4761 | // Req uire strin gs to use single quo tes | |
| 4762 | "quote s": [2, "s ingle"], | |
| 4763 | // Req uire curly braces fo r all cont rol statem ents | |
| 4764 | "curly ": 2, | |
| 4765 | // Dis allow usin g variable s and func tions befo re they've been defi ned | |
| 4766 | "no-us e-before-d efine": 2, | |
| 4767 | // All ow any cas e for vari able namin g | |
| 4768 | "camel case": 0, | |
| 4769 | // Dis allow unus ed variabl es, except as functi on argumen ts | |
| 4770 | "no-un used-vars" : [2, {"ar gs":"none" }], | |
| 4771 | // All ow leading underscor es for met hod names | |
| 4772 | // REA SON: we us e undersco res to den ote privat e methods | |
| 4773 | "no-un derscore-d angle": 0, | |
| 4774 | // All ow multi s paces arou nd operato rs since t hey are | |
| 4775 | // use d for alig nment. Th is is not consistent in the | |
| 4776 | // cod e. | |
| 4777 | "no-mu lti-spaces ": 0, | |
| 4778 | // Sty le rule is : most obj ects use { beforeCol on: false, afterColo n: true }, unless al igning whi ch uses: | |
| 4779 | // | |
| 4780 | // { | |
| 4781 | // b eforeColon : true, | |
| 4782 | // a fterColon : true | |
| 4783 | // } | |
| 4784 | // | |
| 4785 | // esl int can't handle thi s, so the check is d isabled. | |
| 4786 | "key-s pacing": 0 , | |
| 4787 | // All ow shadowi ng vars in outer sco pe (needs discussion ) | |
| 4788 | "no-sh adow": 0, | |
| 4789 | // Use if () { } | |
| 4790 | // ^ space | |
| 4791 | "keywo rd-spacing ": [2, {"a fter": tru e}], | |
| 4792 | // Use if () { } | |
| 4793 | // ^ sp ace | |
| 4794 | "space -before-bl ocks": [2, "always"] | |
| 4795 | } | |
| 4796 | } | |
| 4797 | \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000\x0000 \x0000\x0000\x0000\x0000\x0000 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.