Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
test/ | 12-May-2024 | - | 333 | 272 | ||
.travis.yml | D | 12-May-2024 | 292 | 23 | 15 | |
History.md | D | 12-May-2024 | 2.5 KiB | 102 | 73 | |
README.md | D | 12-May-2024 | 2.4 KiB | 75 | 55 | |
index.js | D | 12-May-2024 | 3.4 KiB | 112 | 61 | |
package.json | D | 12-May-2024 | 1.8 KiB | 68 | 67 |
README.md
1http-proxy-agent 2================ 3### An HTTP(s) proxy `http.Agent` implementation for HTTP 4[](https://travis-ci.org/TooTallNate/node-http-proxy-agent) 5 6This module provides an `http.Agent` implementation that connects to a specified 7HTTP or HTTPS proxy server, and can be used with the built-in `http` module. 8 9__Note:__ For HTTP proxy usage with the `https` module, check out 10[`node-https-proxy-agent`](https://github.com/TooTallNate/node-https-proxy-agent). 11 12Installation 13------------ 14 15Install with `npm`: 16 17``` bash 18$ npm install http-proxy-agent 19``` 20 21 22Example 23------- 24 25``` js 26var url = require('url'); 27var http = require('http'); 28var HttpProxyAgent = require('http-proxy-agent'); 29 30// HTTP/HTTPS proxy to connect to 31var proxy = process.env.http_proxy || 'http://168.63.76.32:3128'; 32console.log('using proxy server %j', proxy); 33 34// HTTP endpoint for the proxy to connect to 35var endpoint = process.argv[2] || 'http://nodejs.org/api/'; 36console.log('attempting to GET %j', endpoint); 37var opts = url.parse(endpoint); 38 39// create an instance of the `HttpProxyAgent` class with the proxy server information 40var agent = new HttpProxyAgent(proxy); 41opts.agent = agent; 42 43http.get(opts, function (res) { 44 console.log('"response" event!', res.headers); 45 res.pipe(process.stdout); 46}); 47``` 48 49 50License 51------- 52 53(The MIT License) 54 55Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net> 56 57Permission is hereby granted, free of charge, to any person obtaining 58a copy of this software and associated documentation files (the 59'Software'), to deal in the Software without restriction, including 60without limitation the rights to use, copy, modify, merge, publish, 61distribute, sublicense, and/or sell copies of the Software, and to 62permit persons to whom the Software is furnished to do so, subject to 63the following conditions: 64 65The above copyright notice and this permission notice shall be 66included in all copies or substantial portions of the Software. 67 68THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 69EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 70MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 71IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 72CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 73TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 74SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 75