') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Curl: Add `CURL_HTTP_VERSION_3` constant by Ayesh · Pull Request #12543 · php/php-src · GitHub
Skip to content

Curl: Add CURL_HTTP_VERSION_3 constant - #12543

Closed
Ayesh wants to merge 1 commit into
php:masterfrom
Ayesh:curl-http3
Closed

Curl: Add CURL_HTTP_VERSION_3 constant#12543
Ayesh wants to merge 1 commit into
php:masterfrom
Ayesh:curl-http3

Conversation

@Ayesh

Copy link
Copy Markdown
Member

Declares the CURL_HTTP_VERSION_3 (libcurl >= 7.66), along with the arginfo updates.

We already have CURL_VERSION_HTTP3 constant declared. However, there are not the same. CURL_HTTP_VERSION_3 (int 30) is one of the CURLOPT_HTTP_VERSION options, while CURL_VERSION_HTTP3 is the feature flag bitmask.

None of the default repos include libcurl with HTTP/3 support enabled, but I could manually get it to work by compiling libcurl with nghttp3, ngtcp2, and patched openssl. Without this patch, it is still possible to make HTTP/3 requests with curl_setopt($ch, CURLOPT_HTTP_VERSION, 30);. This patch merely declares the constant for the parity.

Considering we already declare CURL_VERSION_HTTP3 feature-flag constant (since PHP 8.2), I think the lack of CURL_HTTP_VERSION_3 constant is a bit odd. Both constants were declared in the same upstream version (7.66). Also taking it into consideration the rapid HTTP/3 adoption, I would like to request to consider bringing this change to PHP-8.3 branch as well, although we are only a single release candidate behind the first GA.

Declares the `CURL_HTTP_VERSION_3`, along with the arginfo updates.
This should be supported in Curl 7.66 and later, and we already have
`CURL_VERSION_HTTP3` constant declared. However, there are not the same.
`CURL_HTTP_VERSION_3` (int 30) is one of the `CURLOPT_HTTP_VERSION` options,
while `CURL_VERSION_HTTP3` is the feature flag bitmask.
`CURL_VERSION_HTTP3` is declared since PHP 8.2.
@Ayesh
Ayesh requested a review from adoy as a code ownerOctober 28, 2023 09:07
Ayesh added a commit to Ayesh/php-src that referenced this pull request Oct 28, 2023
 - Updates the URL of Curl constant page from `https://curl.haxx.se/libcurl/c/symbols-in-versions.html`
to `https://curl.se/libcurl/c/symbols-in-versions.html`.
- Fixes the regex used to filter constants to match `CURL_HTTP` constants.
Related: php#12543
@Girgias

Copy link
Copy Markdown
Member

@bukka for the cURL constants.

Girgias pushed a commit that referenced this pull request Oct 28, 2023
- Updates the URL of Curl constant page from `https://curl.haxx.se/libcurl/c/symbols-in-versions.html`
to `https://curl.se/libcurl/c/symbols-in-versions.html`.
- Fixes the regex used to filter constants to match `CURL_HTTP` constants.
Related: GH-12543

@GrahamCampbellGrahamCampbell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this not a duplicate of #12000?

@Ayesh

Copy link
Copy Markdown
MemberAuthor

Apparently it is @GrahamCampbell, I will close this. Apologies about the noise.

@AyeshAyesh closed this Oct 29, 2023
@Ayesh
Ayesh deleted the curl-http3 branch October 29, 2023 22:33
@AyeshAyesh mentioned this pull request Aug 11, 2024
Ayesh added a commit to Ayesh/php-src that referenced this pull request Aug 12, 2024
This intends to supersede the two following PRs:
- php#12000 because it does not modify the stub file, but only update the
arginfo file. It also proposes to merge to GA branches, and is
currently marked as Requires RM Approval.
- php#12543 Essentially the same as this PR and from the same author, as
this, but its about a year old and requires rebasing anyway.
This adds the `CURL_HTTP_VERSION_3` and `CURL_HTTP_VERSION_3ONLY`
constants on relevant versions (7.66 and 7.88 respectively).
It is possible to use HTTP/3 without having these constants declared,
but having them declared in PHP makes things more approachable and
"official".
Girgias pushed a commit that referenced this pull request Aug 12, 2024
This intends to supersede the two following PRs:
- #12000 because it does not modify the stub file, but only update the
arginfo file. It also proposes to merge to GA branches, and is
currently marked as Requires RM Approval.
- #12543 Essentially the same as this PR and from the same author, as
this, but its about a year old and requires rebasing anyway.
This adds the `CURL_HTTP_VERSION_3` and `CURL_HTTP_VERSION_3ONLY`
constants on relevant versions (7.66 and 7.88 respectively).
It is possible to use HTTP/3 without having these constants declared,
but having them declared in PHP makes things more approachable and
"official".
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@Ayesh@Girgias@GrahamCampbell