sabre-io/http

Client can't handle headers that appear multiple times

jorgelzpz opened this issue · 1 comments

I have run into an issue with your handy HTTP client. If a header appears more than once, only the last value will be taken into account. Seems that RFC2616 allows multiple headers with the same name if they contain comma-separated values.

Consider the following DAV header(s):

DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy

When retrieved by the client, a getHeader('Dav') will only return the last set of values:

array(5) {
  [0]=>
  string(14) "extended-mkcol"
  [1]=>
  string(4) "bind"
  [2]=>
  string(11) "addressbook"
  [3]=>
  string(22) "calendar-auto-schedule"
  [4]=>
  string(14) "calendar-proxy"
}

This happens on sabre/http 2.0.4

I'm going to fix this by implementing an interface similar to this:

https://github.com/php-fig/fig-standards/blob/master/proposed/http-message.md