Comments (7)
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.
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.
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.
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.
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.
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.
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)
- HttpFulfilledPromise constructor parameter should be mixed HOT 3
- Circuit Breaker HOT 6
- Missing badges HOT 2
- Sending file from a multipart stream HOT 13
- How to set timeout for a request while being abstracted from a HttpClient implementation? HOT 6
- Implementation Question: how to code Client options in a library-agnostic way? HOT 5
- Benchmarks? HOT 2
- Prepare version 2.0 HOT 6
- HMAC Authentication Plugin HOT 4
- phpstan complains about Http\Client\Exception HOT 6
- Adding deprecated HOT 5
- HttpException create method self vs static HOT 1
- Symfony HTTP Client Adapter HOT 1
- PSR-18: Network / Request exception inheritance HOT 1
- Add psr-18 github tag HOT 1
- Throwable not supported HOT 8
- State of async HTTP clients and promises HOT 13
- PHP 8.0 support HOT 1
- "php-http/httplug" package is not installed HOT 7
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 httplug.