Comments (8)
Thanks for getting in touch. What does your code look like? Can you show the stack trace? What is your curl --version
- is it the same version as the lib-curl that PHP is linked against?
from guzzle.
Note that it is not a bug that if you manually specify crypto_method
to 1.2 and have a too old version of curl, even if it supports TLS 1.2 but does not have the constant. I'd only consider this a bug if the error happens even when not specifying a crypto_method
.
from guzzle.
This fact is documented at https://github.com/guzzle/guzzle/blob/429cb6702659329819fb40c9487eac3132bdd80b/docs/request-options.rst#crypto_method. The reason is we need to behave in a secure way. If we can't verify that tls 1.2 or higher is actually used, then we must fail.
from guzzle.
Hi, it's a bit roundabout, but I am hitting this issue via the Saloon project. They are passing through the crypto_method
.
I am accessing that project from the instructor-php
project, where they are creating a client for OpenAI.
from guzzle.
We are using curl 7.29 as the version that our PHP is linked against.
curl --version
curl 7.29.0 (x86_64-koji-linux-gnu) libcurl/7.29.0 NSS/3.28.4 zlib/1.2.7 libidn/1.28 libssh2/1.4.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz unix-sockets
from guzzle.
Full Stacktrace for you:
Fatal error: Uncaught InvalidArgumentException: Invalid crypto_method request option: TLS 1.2 not supported by your version of cURL in /home/asherrick/development/irccat/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:470
Stack trace:
#0 /some-project/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(59): GuzzleHttp\Handler\CurlFactory->applyHandlerOptions(Object(GuzzleHttp\Handler\EasyHandle), Array)
#1 /some-project/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory->create(Object(GuzzleHttp\Psr7\Request), Array)
#2 /some-project/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#3 /some-project/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(48): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#4 /some-project/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(64): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#5 /some-project/vendor/guzzlehttp/guzzle/src/Middleware.php(31): GuzzleHttp\PrepareBodyMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#6 /some-project/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(71): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#7 /some-project/vendor/guzzlehttp/guzzle/src/Middleware.php(66): GuzzleHttp\RedirectMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#8 /some-project/vendor/guzzlehttp/guzzle/src/HandlerStack.php(75): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Request), Array)
#9 /some-project/vendor/guzzlehttp/guzzle/src/Client.php(333): GuzzleHttp\HandlerStack->__invoke(Object(GuzzleHttp\Psr7\Request), Array)
#10 /some-project/vendor/guzzlehttp/guzzle/src/Client.php(106): GuzzleHttp\Client->transfer(Object(GuzzleHttp\Psr7\Request), Array)
#11 /some-project/vendor/guzzlehttp/guzzle/src/Client.php(124): GuzzleHttp\Client->sendAsync(Object(GuzzleHttp\Psr7\Request), Array)
#12 /some-project/vendor/saloonphp/saloon/src/Http/Senders/GuzzleSender.php(101): GuzzleHttp\Client->send(Object(GuzzleHttp\Psr7\Request), Array)
#13 /some-project/vendor/saloonphp/saloon/src/Traits/Connector/SendsRequests.php(72): Saloon\Http\Senders\GuzzleSender->send(Object(Saloon\Http\PendingRequest))
#14 /some-project/vendor/cognesy/instructor-php/src/ApiClient/Traits/HandlesApiResponse.php(36): Saloon\Http\Connector->send(Object(Cognesy\Instructor\Clients\OpenAI\OpenAIApiRequest))
#15 /some-project/vendor/cognesy/instructor-php/src/ApiClient/Traits/HandlesApiResponse.php(28): Cognesy\Instructor\ApiClient\ApiClient->respondRaw(Object(Cognesy\Instructor\Clients\OpenAI\OpenAIApiRequest))
#16 /some-project/vendor/cognesy/instructor-php/src/Core/RequestHandler.php(79): Cognesy\Instructor\ApiClient\ApiClient->get()
#17 /some-project/vendor/cognesy/instructor-php/src/Core/RequestHandler.php(41): Cognesy\Instructor\Core\RequestHandler->getApiResponse(Object(Cognesy\Instructor\Data\Request))
#18 /some-project/vendor/cognesy/instructor-php/src/Instructor.php(188): Cognesy\Instructor\Core\RequestHandler->respondTo(Object(Cognesy\Instructor\Data\Request))
#19 /some-project/vendor/cognesy/instructor-php/src/Instructor.php(162): Cognesy\Instructor\Instructor->handleRequest()
#20 /some-project/vendor/cognesy/instructor-php/src/Instructor.php(110): Cognesy\Instructor\Instructor->get()
#21 /some-project/modules/emojiembeddings.php(196): Cognesy\Instructor\Instructor->respond(...)
from guzzle.
Ok. The best thing to do here is to upgrade your curl version. I'm not sure if all the security fixes are backported to the build you have, but if not, it is horribly insecure. The other thing I would recommend if you'd prefer not doing that would be to downgrade to a version of that library before they added that code or to fork it and remove it. Finally, you could fork it and instruct guzzle to not use the curl handler, and use the PHP-native implementation which is slower, but may be fast enough for you. A similar approach would be to create your own GuzzleSender
implementation, and build up the object you need more manually in your code, which would avoid the fork.I see this last one doesn't work because of what they did in the EDIT 2: that's the stream constant, not the curl one.Config
class.
from guzzle.
I was thinking more about this. Maybe Guzzle should only try and use it's curl handler by default if libcurl is at least 7.34. That may be enough to fix your issue.
from guzzle.
Related Issues (20)
- Using `"stream" => true` in options makes PSR7 responses read-once HOT 3
- [DOCS] In online documentation, the request option connect_timeout still says that the default value of 0 waits indefinitely, which was never true HOT 4
- No exception gets thrown on responses with status code >= 400 HOT 1
- http://www.guzzlephp.org displays Indonesian gambling site advert HOT 3
- Organization Information HOT 1
- Can GuzzleHttp be used to listen to a specific event to obtain request body data? HOT 3
- Unable to parse URI in Ipv6 HOT 14
- Document `GuzzleHttp\Client::__construct()` parameters at type level? HOT 3
- endless yield problem HOT 1
- Proxy chain support HOT 1
- Security vulnerabilities in guzzlehttp/psr7 dependency in v6.x HOT 3
- Mistake
- Custom Global Default Config HOT 2
- Supports json to array conversion HOT 1
- Requesting a quick patch to 6.5.8 to fix fatal error if guzzle 6.x and 7.x exist concurrently HOT 2
- Deprecations causing test failures in PHP 8.4 HOT 1
- 400 Bad Value Push HOT 1
- RetryMiddleware class has incorrect annotation for the $delay parameter
- Mention httpd_can_network_connect SELinux option in the documentation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guzzle.