rfc:curl_http2_push
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:curl_http2_push [2015/10/01 09:07] – davey | rfc:curl_http2_push [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2015-10-01 | * Date: 2015-10-01 | ||
* Author: Davey Shafik, davey@php.net | * Author: Davey Shafik, davey@php.net | ||
- | * Status: | + | * Status: |
* First Published at: https:// | * First Published at: https:// | ||
Line 12: | Line 12: | ||
Server push allows the server to push additional resources relevant to the requested resource directly to the client proactively. | Server push allows the server to push additional resources relevant to the requested resource directly to the client proactively. | ||
- | Server push is available in libcurl since 7.44.0. | + | Server push is available in libcurl since 7.44.0, but broken till the as-yet-unreleased 7.46.0 (See: [[https:// |
===== Libcurl Implementation ===== | ===== Libcurl Implementation ===== | ||
Line 28: | Line 28: | ||
<code php> | <code php> | ||
<?php | <?php | ||
- | $callable | + | $transfers = 1; |
- | { | + | |
- | if ($header_count > 0 && curl_pushheader_byname(" | + | $callback |
- | | + | $transfers++; |
- | } | + | return |
- | return CURL_PUSH_OK; | + | }; |
- | } | + | |
$mh = curl_multi_init(); | $mh = curl_multi_init(); | ||
- | $user_data = null; | ||
- | curl_multi_setopt($mh, | + | curl_multi_setopt($mh, |
- | curl_multi_setopt($mh, | + | curl_multi_setopt($mh, |
- | ?> | + | |
+ | $ch = curl_init(); | ||
+ | curl_setopt($ch, | ||
+ | curl_setopt($ch, CURLOPT_HTTP_VERSION, | ||
+ | curl_setopt($ch, | ||
+ | |||
+ | // Debugging/ | ||
+ | // | ||
+ | curl_setopt($ch, | ||
+ | curl_setopt($ch, | ||
+ | |||
+ | curl_multi_add_handle($mh, | ||
+ | |||
+ | $active = null; | ||
+ | do { | ||
+ | | ||
+ | |||
+ | do { | ||
+ | $info = curl_multi_info_read($mh); | ||
+ | if (false !== $info && $info[' | ||
+ | $handle = $info[' | ||
+ | if ($handle !== null) { | ||
+ | $transfers--; | ||
+ | $out = curl_multi_getcontent($info[' | ||
+ | curl_multi_remove_handle($mh, | ||
+ | curl_close($handle); | ||
+ | } | ||
+ | } | ||
+ | } while ($info); | ||
+ | } while ($transfers); | ||
+ | |||
+ | curl_multi_close($mh); | ||
</ | </ | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | Within [[https:// | + | Within [[https:// |
- | The user can also register a referenced variable ('' | + | We do not support |
- | We also have to handle | + | libcurl exposes |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | No breaks, except possibly the referenced value for '' | + | No breaks |
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
Line 76: | Line 105: | ||
==== New Constants ==== | ==== New Constants ==== | ||
- | | + | * '' |
- | - '' | + | |
- | | + | |
- | - '' | + | |
These are directly exposed from libcurl, and documentation can be taken from there. | These are directly exposed from libcurl, and documentation can be taken from there. | ||
Line 89: | Line 117: | ||
===== Open Issues ===== | ===== Open Issues ===== | ||
- | - Adding | + | Possibly |
===== Future Scope ===== | ===== Future Scope ===== | ||
Line 95: | Line 123: | ||
This change should track libcurl. | This change should track libcurl. | ||
- | ===== Proposed Voting Choices | + | ===== Vote ===== |
- | Two choices: Add, Deny | + | Simple Yes/No option. Requires 50%+1 to be accepted. |
- | 50% required as this is not a language change | + | |
+ | This vote will close on 13:00 UTC on Wed 2015-12-23 | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
- | Currently working on a patch, a mentor would be appreciated! | + | - Working |
+ | - Docker container for easy testing can be found [[http:// | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | After the project is implemented, this section should contain | + | Server push support has been implemented |
- | - the version(s) it was merged to | + | |
- | | + | The language specification is not affected by this RFC. |
- | - a link to the PHP manual | + | |
===== References ===== | ===== References ===== | ||
- | - [[https:// | + | |
- | - [[http:// | + | - [[http:// |
===== Rejected Features ===== | ===== Rejected Features ===== | ||
- | Keep this updated with features that were discussed on the mail lists. | + | None |
rfc/curl_http2_push.1443690477.txt.gz · Last modified: 2017/09/22 13:28 (external edit)