Coder Social home page Coder Social logo

Comments (7)

dbu avatar dbu commented on June 2, 2024 1

in my understanding, httplug is an interface that defines how a client can send a web request to receive a response. it is not a client configurator. proxies and https are implementation details that the client does not care about.

as far as i can see, PSR-7 also does not specifically support ssl, at least i found nothing in a quick search how one could add a client certificate. thus, i think we can't even provide support for this with a plugin in client-common. the only place this can be done is in the actual client implementation.

so for your library, it would be in the setup instructions. if you want, you could provide a client factory implementation that can create a guzzle adapter with a correctly configured guzzle inside. that way, the rest of your library is still decoupled from a concrete http client implementation and your users can build a different httplug object if they need anything special.

from httplug.

fbourigault avatar fbourigault commented on June 2, 2024

Features looks over-engineering to me. HttpClient is an interface intended to be substituable. This help library developers to not be stuck because of incompatible guzzle versions required by two libraries. Instead, the application developer choose one implementation and all is fine.

For your case, I would simply choose an implementation which allows you to do proxy and client certificate authentication. Guzzle supports proxy through environment variables (but only supports uppercase environment variables, see guzzle/guzzle#1821). You can also use cURL configuration.

Using the configuration would also allows you to do client authentication!

from httplug.

nickygerritsen avatar nickygerritsen commented on June 2, 2024

But ideally I do not want the users of my library to be forced to use Guzzle or cURL as a client, therefore I wanted to use HttpClient

from httplug.

fbourigault avatar fbourigault commented on June 2, 2024

IMHO client authentication and proxy are out of scope of HTTPlug as it's not about HTTP but about networking. This has probably be debated by php-http members before I join. I let them answering you!

from httplug.

nickygerritsen avatar nickygerritsen commented on June 2, 2024

The problem for my library is that it talks to a couple of API's and currently one needs to use a proxy and an SSL client certificate for authentication. The proxy part is not the biggest problem as indeed this could be used for all connections, but the client certificate is only for one specific endpoint.

from httplug.

dbu avatar dbu commented on June 2, 2024

then either use a specific guzzle plugin that only uses the certificate on certain domains, or inject 2 separate clients for the different end points. or write a httplug client that wraps the 2 clients and picks one or the other based on the domain.

from my point of view, it would be problematic if client code could change all kind of configuration in request arguments. i assume that the authors of PSR-7 also see it that way, as they did not add options to send along with a request to control how it should be sent.

from httplug.

Nyholm avatar Nyholm commented on June 2, 2024

As David says, It is way out of scope for a HTTP client interface. It is configuration of a specific client and we currently has no intention in creating an abstraction over configuration.

from httplug.

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.