Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

[Zend\Http\Client] dupplicate header keys in prepareHeaders #5065

Closed
wants to merge 4 commits into from

Conversation

ClemensSahs
Copy link
Contributor

in my mind I found a bug in the Http Component. In my gist I write a TestCase to show the error.

if we you a toString-Methode from \Zend\Http\Header\ContentType

https://gist.github.com/ClemensSahs/6421612

The provenance from this issues is in the method \Zend\Http\Client::prepareHeaders here we use not the lowercase string for the header keys like the \Zend\Http\Header\* So we get this.

// 1st ( store )
array(6) {
  ["Host"]=>
  string(14) "127.0.0.1:5984"
  ["Connection"]=>
  string(5) "close"
  ["Accept-Encoding"]=>
  string(13) "gzip, deflate"
  ["User-Agent"]=>
  string(16) "Zend\Http\Client"
  ["Content-Length"]=>
  int(13)
  ["content-type"]=>
  string(16) "application/json"
}

// 2nd ( get )
array(5) {
  ["Host"]=>
  string(14) "127.0.0.1:5984"
  ["Connection"]=>
  string(5) "close"
  ["Accept-Encoding"]=>
  string(13) "gzip, deflate"
  ["User-Agent"]=>
  string(16) "Zend\Http\Client"
  ["Content-Type"]=>
  string(16) "application/json"
}
// 3rd ( store )
array(7) {
  ["Host"]=>
  string(14) "127.0.0.1:5984"
  ["Connection"]=>
  string(5) "close"
  ["Accept-Encoding"]=>
  string(13) "gzip, deflate"
  ["User-Agent"]=>
  string(16) "Zend\Http\Client"
  ["Content-Type"]=>
  string(16) "application/json"
  ["Content-Length"]=>
  int(13)
  ["content-type"]=>
  string(16) "application/json"
}

best regards

@weierophinney
Copy link
Member

Please add a unit test as well to document the why of the change. Thanks in advance!

@ClemensSahs
Copy link
Contributor Author

what kind of document you meen, I think you mean inline doc right?

@weierophinney
Copy link
Member

@ClemensSahs I meant that the test will document why the change is being made, not that you need to write documentation. :)

@ClemensSahs
Copy link
Contributor Author

@weierophinney ok the test control tow possible way for the same error case... currently I have no alternative error case for this isseus...

from my side we are fine, any feedback?

weierophinney added a commit that referenced this pull request Sep 4, 2013
[Zend\Http\Client] dupplicate header keys in prepareHeaders

Conflicts:
	tests/ZendTest/Http/ClientTest.php
weierophinney added a commit that referenced this pull request Sep 4, 2013
weierophinney added a commit that referenced this pull request Sep 4, 2013
@ghost ghost assigned weierophinney Sep 4, 2013
gianarb pushed a commit to zendframework/zend-http that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-http that referenced this pull request May 15, 2015
…hotfix/5042

[Zend\Http\Client] dupplicate header keys in prepareHeaders

Conflicts:
	tests/ZendTest/Http/ClientTest.php
weierophinney added a commit to zendframework/zend-http that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-http that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants