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

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

Merged
merged 3 commits into from Jan 20, 2017

Conversation

Projects
None yet
2 participants
@deweerdt
Member

deweerdt commented Jan 18, 2017

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.

Pushes: support a x-http2-push-only attribute
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.
Show outdated Hide outdated lib/core/util.c
}
}
if (!nopush && preload)
push_one_path(pool, &paths_to_push, &url, base_path, input_scheme, input_authority, base_scheme, base_authority);
} while (token != NULL);

This comment has been minimized.

@kazuho

kazuho Jan 18, 2017

Member

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.

@kazuho

kazuho Jan 18, 2017

Member

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

This comment has been minimized.

Show comment
Hide comment
@deweerdt

deweerdt Jan 18, 2017

Member

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

Member

deweerdt commented Jan 18, 2017

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

h2o_extract_push_path_from_link_header single pass improvement
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.

@kazuho kazuho added this to the v2.2 milestone Jan 19, 2017

@kazuho kazuho merged commit 8d937ff into h2o:master Jan 20, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

kazuho added a commit that referenced this pull request Jan 20, 2017

Merge pull request #1169
Pushes: support a x-http2-push-only attribute
@kazuho

This comment has been minimized.

Show comment
Hide comment
@kazuho

kazuho Jan 20, 2017

Member

Thank you for the changes! Merged with small fixes.

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