Skip to content

Pushes: support a x-http2-push-only attribute #1169

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 3 commits into from
Jan 20, 2017

Conversation

deweerdt
Copy link
Member

When this is set, H2O will interpret the rel=preload link as a header
we only want to use for H2 pushes, rather than something we also want to
push to the client. So we'll be removing that attribute from the link
header. If there's only one link, we remove the full header.

This is change is there to allow HTTP/1 clients to express HTTP/2 pushes
in a way that doesn't affect the response sent to the client.

When this is set, H2O will interpret the `rel=preload` link as a header
we only want to use for H2 pushes, rather than something we also want to
push to the client. So we'll be removing that attribute from the link
header. If there's only one link, we remove the full header.

This is change is there to allow HTTP/1 clients to express HTTP/2 pushes
in a way that doesn't affect the response sent to the client.
}
}

if (!nopush && preload)
push_one_path(pool, &paths_to_push, &url, base_path, input_scheme, input_authority, base_scheme, base_authority);
} while (token != NULL);
Copy link
Member

@kazuho kazuho Jan 18, 2017

Choose a reason for hiding this comment

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

How about doing the parsing and the rebuilding of filtered_value in one pas?

I suggest this because it wouldn't be too difficult to retain the start and end of each link element, and use it to build filtered value at the end of this do-while loop.

The start of the element can be calculated as url.base - 1 (or you might want to retain url with the surrounding brackets until passing the value to push_one_path).

The end of the element can be calculated as token != NULL ? token : value + value_len.

@deweerdt
Copy link
Member Author

Thank you for your feedback. 83ba870 has a version that does the transform in a single pass.

An improvement suggested by Kazuho: try to have the best of both worlds:
we only allocate from the pool if we know we're going to filter values,
otherwise, we don't allocate anything.
@deweerdt deweerdt force-pushed the x-http2-push-only-attribute branch from fe37365 to 8d937ff Compare January 18, 2017 22:36
@kazuho kazuho added this to the v2.2 milestone Jan 19, 2017
@kazuho kazuho merged commit 8d937ff into h2o:master Jan 20, 2017
kazuho added a commit that referenced this pull request Jan 20, 2017
Pushes: support a x-http2-push-only attribute
@kazuho
Copy link
Member

kazuho commented Jan 20, 2017

Thank you for the changes! Merged with small fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants