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

[TS-4457] Via header always reports http1 #1066

Merged
merged 1 commit into from
Oct 11, 2016

Conversation

ericcarlschwartz
Copy link
Contributor

old PR here. I majorly botched the rebase, sorry: #954

@atsci
Copy link

atsci commented Sep 29, 2016

Linux build failed! See https://ci.trafficserver.apache.org/job/Github-Linux/799/ for details.

@atsci
Copy link

atsci commented Sep 29, 2016

FreeBSD build failed! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/904/ for details.

@atsci
Copy link

atsci commented Sep 29, 2016

Linux build failed! See https://ci.trafficserver.apache.org/job/Github-Linux/800/ for details.

@ericcarlschwartz
Copy link
Contributor Author

ericcarlschwartz commented Sep 29, 2016

As a heads up, this simplifies things a bit, always relying on the HttpSM populate_client_protocol call on the client side. This changes our via header even for http/1.1.

An old via header that read:

Via: https/1.1 yahoo.com (ApacheTrafficServer), https/1.1 ubuntu (ApacheTrafficServer/7.1.0)

Would now read:

Via: https/1.1 yahoo.com (ApacheTrafficServer), http/1.1 tls/1.2 tcp ipv4 ubuntu (ApacheTrafficServer/7.1.0)

@ericcarlschwartz
Copy link
Contributor Author

The same request over http/2 has the additional h2 marker as follows:

via: https/1.1 yahoo.com (ApacheTrafficServer), http/1.1 h2 tls/1.2 tcp ipv4 ubuntu (ApacheTrafficServer/7.1.0)

@ericcarlschwartz
Copy link
Contributor Author

ericcarlschwartz commented Sep 29, 2016

Oh god sorry. I'll get the clang formatting right on the first time someday. Do I need someone to kick off the tests again? I've built and tested this on my box.

@atsci
Copy link

atsci commented Sep 29, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/905/ for details.

@atsci
Copy link

atsci commented Sep 29, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/906/ for details.

@atsci
Copy link

atsci commented Sep 29, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/801/ for details.

@zwoop zwoop added this to the 7.1.0 milestone Sep 30, 2016
@zwoop zwoop added the Core label Sep 30, 2016
*via_string++ = '.';
*via_string++ = '0' + HTTP_MINOR(hversion);
char const *proto_buf[10]; // 10 seems like a reasonable number of protos to print
int retval = s->state_machine->populate_client_protocol(proto_buf, 10);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit pick, but shouldn't this be something like countof(proto_buf) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

would be happy to make that change if you think it's better

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we generally use countof() in C++ code to avoid future messes :)

@@ -812,26 +813,16 @@ HttpTransactHeaders::insert_via_header_in_response(HttpTransact::State *s, HTTPH
}

char *incoming_via = s->via_string;
int scheme = s->next_hop_scheme;
ink_assert(s->state_machine);
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the code, it seems it's setup in the ::init(), and then never unset / cleared? If so, do we even need this assert? I guess it doesn't hurt, but I don't see us do this anywhere else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah you know what i missed that i'd be happy to drop this

char const *proto_buf[10]; // 10 seems like a reasonable number of protos to print
int retval = s->state_machine->populate_client_protocol(proto_buf, 10);
for (int i = 0; i < retval; i++) {
memcpy(via_string, proto_buf[i], strlen(proto_buf[i]));
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any risk that we'll end up consuming too much of the Via: string now? Or is the 1024 bytes still sufficient for all foreseeable protocol additions? (It'd be a crazy long header if it was anyways :).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so for http2 we get five entries, the largest of which is six chars. i guess it could be possible to get more in some far off future and we should plan for that. i think limiting the stack size would be a better approach if we want to prevent the string from getting too long

@zwoop zwoop self-assigned this Sep 30, 2016
@zwoop
Copy link
Contributor

zwoop commented Sep 30, 2016

I'm generally ok with this, up to you if you wish to clean anything up.

@ericcarlschwartz
Copy link
Contributor Author

i'll drop the assert and switch to the countof!

@ericcarlschwartz
Copy link
Contributor Author

ericcarlschwartz commented Sep 30, 2016

ok fixed those up will let the ci stuff build.

would we also want to make this change on the origin side? for the insert_via_header_in_req method?

@atsci
Copy link

atsci commented Sep 30, 2016

FreeBSD build successful! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/911/ for details.

@atsci
Copy link

atsci commented Sep 30, 2016

Linux build successful! See https://ci.trafficserver.apache.org/job/Github-Linux/806/ for details.

@shinrich
Copy link
Member

The clean up changes were done and look good. Deeper review and approve done by @zwoop

@shinrich shinrich merged commit 5cc389c into apache:master Oct 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants