source: trip-planner-front/node_modules/http-proxy-agent/README.md@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.5 KB
Line 
1http-proxy-agent
2================
3### An HTTP(s) proxy `http.Agent` implementation for HTTP
4[![Build Status](https://github.com/TooTallNate/node-http-proxy-agent/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-http-proxy-agent/actions?workflow=Node+CI)
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 &lt;nathan@tootallnate.net&gt;
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.
Note: See TracBrowser for help on using the repository browser.