bump. Is there anyone familiar with the http module that can answer this?

On Saturday, September 20, 2014 12:04:02 AM UTC-7, CoolAJ86 wrote:
>
> It seems to me that it's rather uncommon for people to use their own 
> http.Agent instances, but I'm creating a system with trusted peers and I 
> found the existing docs to be unclear.
>
> I have some questions here and if there is someone who understands that 
> code well willing to answer me, I'd much appreciate it.
> https://github.com/joyent/node/issues/8412
>
>
> Certainly I want to be reusing the agent and some of the parameters don't 
> need to / shouldn't be specified in the request each time.
>
>
> After poking around the docs and code a bit I'm guessing that the example 
> should be more like this:
>
> var agent = new https.Agent({
>   ca: [fs.readFileSync('test/fixtures/keys/agent2-ca.pem')]
> , key: fs.readFileSync('test/fixtures/keys/agent2-key.pem')
> , cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
> , maxSockets: 256
> });
>
> var req1 = https.request({
>   agent: agent
> , method: 'GET'
> , hostname: 'site-a.example.com'
> , port: 443
> , path: '/one-thing'
> }, function(res) {
>   ...
> }
>
> var req1 = https.request({
>   agent: agent
> , method: 'GET'
> , hostname: 'site-b.example.com'
> , port: 443
> , path: '/two-thing'
> }, function(res) {
>   ...
> }
>
>
>
> Or perhaps like this:
>
>
> var agent = new https.Agent({ maxSockets: 256 });
>
> var req1 = https.request({
>   agent: agent
> , method: 'GET'
> , hostname: 'site-a.example.com'
> , port: 443
> , path: '/one-thing'
> , ca: [fs.readFileSync('test/fixtures/keys/agent2-ca.pem')]
> , key: fs.readFileSync('test/fixtures/keys/agent2-key.pem')
> , cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
> }, function(res) {
>   ...
> }
>
> var req1 = https.request({
>   agent: agent
> , method: 'GET'
> , hostname: 'site-b.example.com'
> , port: 443
> , path: '/two-thing'
> , ca: [fs.readFileSync('test/fixtures/keys/agent2-ca.pem')]
> , key: fs.readFileSync('test/fixtures/keys/agent2-key.pem')
> , cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
> }, function(res) {
>   ...
> }
>
> Or maybe even
>
>
> var agent = new https.Agent({
>   maxSockets: 256
> , hostname: 'site-b.example.com'
> , port: 443
> , ca: [fs.readFileSync('test/fixtures/keys/agent2-ca.pem')]
> , key: fs.readFileSync('test/fixtures/keys/agent2-key.pem')
> , cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
> });
>
> var req1 = https.request({
>   agent: agent
> , method: 'GET'
> , path: '/one-thing'
> }, function(res) {
>   ...
> }
>
> var req1 = https.request({
>   agent: agent
> , method: 'GET'
> , path: '/two-thing'
> }, function(res) {
>   ...
> }
>
> AJ ONeal
>  

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/cd67b3e5-2283-41e0-8110-e24429705c71%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to