Skip to content

Add HttpHeaderCollection #202

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
Oct 21, 2013

Conversation

DanielPlainview
Copy link
Contributor

Как я уже отмечал в #197, для HttpRequest требуется какой-то контейнер для заголовков, потому что в текущей реализации имя заголовка регистрозависимо.

$request = HttpRequest::createFromGlobals();

$userAgent = $request->getHeaderVar('User-Agent');

HttpHeaderCollection выдернул из #194.

{
$this->headers[$this->normalizeName($name)]=
array_values((array) $value);

Copy link
Member

Choose a reason for hiding this comment

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

http://www.ietf.org/rfc/rfc2616.txt p.4.2 последний абзац.
Это не обязывает нас при получении $value делать explode по \r\n и ";" ?

Насколько я понимаю, с точки зрения протокола
x-foo: bar;baz

равнозначно с
x-foo: bar
x-foo: baz

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Там речь про comma (","), а не semicolon (";"). Мне неясен это абзац совершенно. Если это так, то как различать значение и список значений? Экранирования нет, запятая не запрещена.

Copy link
Member

Choose a reason for hiding this comment

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

Тесты показали, что популярным веб-серверам и языкам разработки пофиг на это требование.

Если возражений от сообщества нет, то предлагаю вливать.

@dovg
Copy link
Member

dovg commented Oct 18, 2013

C остальным вроде бы согласен. Да и предыдущий комментарий - это скорее паранойя, чем реальная необходимость.

dovg added a commit that referenced this pull request Oct 21, 2013
@dovg dovg merged commit fda6590 into onPHP:master Oct 21, 2013
@DanielPlainview DanielPlainview deleted the feature-http-header-collection branch October 21, 2013 07:59
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.

2 participants