Skip to content

Support a proxy in splunk log driver #36220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 8, 2018

Conversation

dnephin
Copy link
Member

@dnephin dnephin commented Feb 6, 2018

No description provided.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@anusha-ragunathan
Copy link
Contributor

anusha-ragunathan commented Feb 6, 2018

Can we check to see if ProxyFromEnvironment doesnt return err?
Never mind. Got mixed up with the function https://golang.org/src/net/http/transport.go#L266

LGTM for sure

@thaJeztah
Copy link
Member

I think this is the way it's supposed to be used (also see https://golang.org/pkg/net/http/#ProxyFromEnvironment, and the example on that page)

A nil URL and nil error are returned if no proxy is defined in the environment, or a proxy should not be used for the given request, as defined by NO_PROXY.

As a special case, if req.URL.Host is "localhost" (with or without a port number), then a nil URL and nil error will be returned.

So an error is only returned in situations where no proxy should be used (in which case nil is returned)

@thaJeztah
Copy link
Member

PowerPC node has some issues; https://jenkins.dockerproject.org/job/Docker-PRs-powerpc/8278/console

17:36:15 Step 6/31 : RUN curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-ppc64le.tar.gz" 	| tar -xzC /usr/local
17:36:15  ---> Running in 4abd3531a716
17:36:16 curl: (56) SSL read: error:00000000:lib(0):func(0):reason(0), errno 104
17:36:16 
17:36:16 gzip: stdin: unexpected end of file
17:36:16 tar: Unexpected EOF in archive
17:36:16 tar: Unexpected EOF in archive
17:36:16 tar: Error is not recoverable: exiting now

Copy link
Contributor

@mavenugo mavenugo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dnephin can you pls add a test-case ?

Signed-off-by: Daniel Nephin <dnephin@docker.com>
@dnephin dnephin force-pushed the support-proxy-in-splunk-driver branch from becf86a to 88aa839 Compare February 7, 2018 19:46
@dnephin
Copy link
Member Author

dnephin commented Feb 7, 2018

Added a unit test.

I tried adding a more complete test using the NewHTTPEventCollectorMock mock in this package but that won't work because golang refuses to use a proxy for any localhost/127.x.x.x url (https://github.com/golang/go/blob/release-branch.go1.9/src/net/http/transport.go#L1218-L1225)

Since the rest of this code is part of the stdlib, all we really need to test is that the transport has the correct proxy factory, which is covered by this test.

@dnephin dnephin force-pushed the support-proxy-in-splunk-driver branch from 88aa839 to 0823c9b Compare February 7, 2018 19:50
Signed-off-by: Daniel Nephin <dnephin@docker.com>
@dnephin dnephin force-pushed the support-proxy-in-splunk-driver branch from 0823c9b to 3c4537d Compare February 7, 2018 19:52
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a unit test sounds sane to me

LGTM

Copy link
Contributor

@mavenugo mavenugo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dnephin . LGTM

@vdemeester vdemeester merged commit f653485 into moby:master Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants