GithubHelp home page GithubHelp logo

Comments (8)

GrahamCampbell avatar GrahamCampbell commented on June 17, 2024

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.

GrahamCampbell avatar GrahamCampbell commented on June 17, 2024

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.

GrahamCampbell avatar GrahamCampbell commented on June 17, 2024

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.

thealmightygrant avatar thealmightygrant commented on June 17, 2024

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.

thealmightygrant avatar thealmightygrant commented on June 17, 2024

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.

thealmightygrant avatar thealmightygrant commented on June 17, 2024

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.

GrahamCampbell avatar GrahamCampbell commented on June 17, 2024

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 Config class. EDIT 2: that's the stream constant, not the curl one.

from guzzle.

GrahamCampbell avatar GrahamCampbell commented on June 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.