ZF2-119: serverParameters in Zend\Http\Request are ignored on toString
Investigating this issue https://github.com/Behat/Mink/issues/130 in Mink, which is located in Goutte (https://github.com/fabpot/Goutte) , which then uses Zend\Http, I ended here since the problems seems to be located in Zend\Http\Request.
A short description for everyone who doesn't know what Mink and Goutte is:
Mink is library for "Web acceptance testing" used by/with Behat. Goutte is a "simple PHP Web Scraper" using Zend\Http integrating it with the Symfony2 Components for Requests/Response which is one Driver for Mink (Others are Selenium, Sahi and Zombiejs).
Now the issue is, that creating a request from a former response currently does not transfer for example the referrer. I tried writing a patch for Goutte but I didn't find a working way to do that apart doing some ugly hacks for the referrer-header only.
So i looked further into Zend\Http and From what I see in Zend\Http\Request, the serverParameters are completely ignored in Zend\Http\Request::toString (I don't find any real usage of serverParameters in Zend\Http\Request at all, expect from setting it, only the subclass Zend\Http\PhpEnvironment\Request uses it) and there to is no transformation like it would be needed if you create a new http-request from a response involving e.g. the Referer (which would have to be transformed from HTTP_REFERER into REFERER) which transforms them from server-variables into headers.
Is the current usage in Goutte or my way of wanting to use setServer() wrong for passing the data from a former response to an new request ?
While investigating this problem I found Zend\Http\PhpEnvironment\Request::setServer which uses serverToHeaders() which does the transformation which I would need/expect in Zend\Http\Request::setServer, moving the Zend\Http\PhpEnvironment\Request::serverToHeaders into Zend\Http\Request and adding another method (maybe setHeadersFromServer() ? ) which uses serverToHeaders() could be a solution for fixing my current issue and adding referer support to
If someone gives me some direction I can make a PR with a fix for it or tell me if I simply overlooked something.