Skip to content

Add a warning about missing headers on the request #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2016

Conversation

joelwurtz
Copy link
Member

No description provided.

.. warning::

This client assume that the request is compliant with HTTP 2.0, 1.1 or 1.0 standard. So a request without a ``Host`` header, or
with a body but wihout a ``Content-Length`` will certainly fail. You can make sure that requests used by this client are valid, by
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/wihout/without/

@joelwurtz joelwurtz force-pushed the joelwurtz-patch-1 branch from 8be844c to eec920b Compare July 29, 2016 11:22
@@ -63,4 +63,10 @@ use case would be::
];
$client = new Client($messageFactory, $options);

.. warning::

This client assume that the request is compliant with HTTP 2.0, 1.1 or 1.0 standard. So a request without a ``Host`` header, or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"This client assumes" (s at the end)

@dbu
Copy link
Contributor

dbu commented Aug 3, 2016

is this specific to the socket client? do curl client and guzzle adapter (resp. guzzle) handle that automatically?

@joelwurtz
Copy link
Member Author

I think they do (but not sure)

@Nyholm
Copy link
Member

Nyholm commented Aug 3, 2016

Guzzle is handling it automatically.

decorating it with :doc:`plugins </plugins/introduction>` like ``ContentLengthPlugin`` or ``HeaderDefaultsPlugin``.
This client assumes that the request is compliant with HTTP 2.0, 1.1 or 1.0 standard. So a request without a ``Host`` header, or
with a body but without a ``Content-Length`` will certainly fail.
If you don't trust incoming requests, we heavily recommend you to use the ``PluginClient`` with the following plugins:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incoming requests sounds strange for a client. i would say: "To make sure all requests will be sent out correctly, we recommend to use ...


* ``ContentLengthPlugin`` sets the correct ``Content-Length`` header, or decorate the stream to use chunked encoding
* ``DecoderPlugin`` decodes encoding coming from the response (chunked, gzip, deflate and compress)
* ``HeaderDefaultsPlugin`` sets default headers values if not present (like for the ``Host`` header)
Copy link
Contributor

@dbu dbu Aug 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

erm. HeaderDefaultsHeader just accepts default values for headers. and AddHostPlugin is about adding host (and scheme and port) to a path if the request is only for a path.

it sounds like we should come up with a new plugin SetHostHeaderFromUriPlugin or something like that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SetHostHeaderFromUriPlugin i believe it's already handle by the implementation as there is a long description on setting host and request target url on the PSR7 standard

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay. so we can drop this line?

@dbu
Copy link
Contributor

dbu commented Sep 16, 2016

ping @joelwurtz

@sagikazarmark
Copy link
Member

Is this still a thing?

@joelwurtz
Copy link
Member Author

Yes, it should be good now

@sagikazarmark sagikazarmark merged commit d01c53c into master Dec 3, 2016
@sagikazarmark sagikazarmark deleted the joelwurtz-patch-1 branch December 3, 2016 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants