Skip to content
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

Simple web server for testing ingress-gce features #312

Merged
merged 1 commit into from
Jun 6, 2018

Conversation

nicksardo
Copy link
Contributor

No description provided.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 6, 2018
@nicksardo nicksardo requested review from bowei and rramkumar1 June 6, 2018 00:49
w.Write([]byte(html.EscapeString(v)))
}

w.Write([]byte(fmt.Sprintf("remote-address: %v\n", r.RemoteAddr)))
Copy link
Member

Choose a reason for hiding this comment

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

Can we put this in a JSON and make it easier to parse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Problem is that there's only value in JSON if the entire body is JSON. The httputil dumper only returns a []byte, so we have no easy way of incorporating that into a JSON struct without killing the readability.

GET / HTTP/1.1
Host: localhost:8080
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cache-Control: max-age=0
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36

{
	"env": {
		"Node": "",
		"Pod": "",
		"Namespace": ""
	},
	"remoteAddr": "[::1]:46372",
	"tls": false,
	"dump": "GET / HTTP/1.1\r\nHost: localhost:8080\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: en-US,en;q=0.9\r\nCache-Control: max-age=0\r\nConnection: keep-alive\r\nUpgrade-Insecure-Requests: 1\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36\r\n\r\n"
}

Copy link
Contributor Author

@nicksardo nicksardo Jun 6, 2018

Choose a reason for hiding this comment

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

Will stop using httputil dump and hand-roll it:

{
	"method": "GET",
	"uri": "/",
	"httpVersion": "1.1",
	"k8sEnv": {
		"Node": "",
		"Pod": "",
		"Namespace": ""
	},
	"remoteAddr": "[::1]:53408",
	"tls": false,
	"header": {
		"Accept": [
			"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
		],
		"Accept-Encoding": [
			"gzip, deflate, br"
		],
		"Accept-Language": [
			"en-US,en;q=0.9"
		],
		"Cache-Control": [
			"max-age=0"
		],
		"Connection": [
			"keep-alive"
		],
		"Upgrade-Insecure-Requests": [
			"1"
		],
		"User-Agent": [
			"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36"
		]
	}
}

"github.com/golang/glog"
)

func createCert() (string, string) {
Copy link
Member

Choose a reason for hiding this comment

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

docstring

@bowei
Copy link
Member

bowei commented Jun 6, 2018

/lgtm after you fix comments

@rramkumar1
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Jun 6, 2018
@rramkumar1
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 6, 2018
@nicksardo nicksardo merged commit cc79eaf into kubernetes:master Jun 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants