From 1dee9fb764647d95429967cfc12359d2b13aae8e Mon Sep 17 00:00:00 2001 From: Italo Date: Wed, 10 Apr 2024 03:33:41 -0400 Subject: [PATCH] [2.x] Use HTTP/3 if possible. --- README.md | 12 +++++++----- composer.json | 6 ++++-- config/recaptcha.php | 5 +++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index fa6b0dc..0d511c8 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Sonarcloud Status](https://sonarcloud.io/api/project_badges/measure?project=Laragear_ReCaptcha&metric=alert_status)](https://sonarcloud.io/dashboard?id=Laragear_ReCaptcha) [![Laravel Octane Compatibility](https://img.shields.io/badge/Laravel%20Octane-Compatible-success?style=flat&logo=laravel)](https://laravel.com/docs/11.x/octane#introduction) -Integrate reCAPTCHA using **async HTTP/2**, making your app **fast** with a few lines. +Integrate reCAPTCHA using **async HTTP/3**, making your app **fast** with a few lines. ```php use Illuminate\Support\Facades\Route; @@ -449,14 +449,14 @@ This also control how many minutes to set the "remember". You can set `INF` cons ```php return [ 'client' => [ - 'version' => 2.0, + 'version' => 4.0, ], ]; ``` This array sets the options for the outgoing request to reCAPTCHA servers. [This is handled by Guzzle](https://docs.guzzlephp.org/en/stable/request-options.html), which in turn will pass it to the underlying transport. Depending on your system, it will probably be cURL. -By default, it instructs Guzzle to use HTTP/2 whenever possible. +By default, it instructs Guzzle to use HTTP/3 whenever possible. ### Credentials @@ -554,9 +554,11 @@ The file gets published into the `.stubs` folder of your project, while the meta There should be no problems using this package with Laravel Octane as intended. -## HTTP/3 +## HTTP/3 and cURL + +To use HTTP/3, [ensure you're using PHP 8.2 or later](https://php.watch/articles/php-curl-http3). cURL version [7.83.0](https://curl.se/changes.html#7_83_0) supports (stable) HTTP/3, and latest PHP 8.2 uses version 7.85. -Currently, HTTP/3 is [still on draft state](https://datatracker.ietf.org/doc/draft-ietf-quic-http/). Until it's [Internet Standard](https://en.wikipedia.org/wiki/Internet_Standard), cURL and Guzzle and reCAPTCHA servers must implement the finished state of the protocol, which as of today is still a moving target. +For more information about checking if your platform can make HTTP/3 requests, check this [PHP Watch article](https://php.watch/articles/php-curl-http3). ## Security diff --git a/composer.json b/composer.json index e9c5a61..05ea280 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "laragear/recaptcha", - "description": "Integrate reCAPTCHA using async HTTP/2, making your app fast with a few lines.", + "description": "Integrate reCAPTCHA using async HTTP/3, making your app fast with a few lines.", "type": "library", "license": "MIT", "minimum-stability": "dev", @@ -9,7 +9,9 @@ "laragear", "captcha", "recaptcha", - "google" + "google", + "http2", + "http3" ], "authors": [ { diff --git a/config/recaptcha.php b/config/recaptcha.php index acc1a6f..d96948c 100644 --- a/config/recaptcha.php +++ b/config/recaptcha.php @@ -1,5 +1,6 @@ [ - 'version' => 2.0, + RequestOptions::VERSION => 3.0, ], /*