When the host header is specified in the http call as such:

drupal_http_request($request_url, array('method' => $this->request->method, 'data' => $this->request->data, 'headers' => ['Host' => 'some.domain.tld']));

the _chr_curl_set_port function will override that value based on the uri. Patch to follow.

CommentFileSizeAuthor
#2 stomps_on_host_header-2845334-2.patch1009 bytesdelzhand
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

delzhand created an issue. See original summary.

delzhand’s picture

Patch attached. You'll need to specify the port if you're providing a host manually, like so:

drupal_http_request($request_url, array('method' => $this->request->method, 'data' => $this->request->data, 'headers' => ['Host' => 'some.domain.tld:80']));

silverham’s picture

Patch tested and works.

You'll need to specify the port if you're providing a host manually [...]

Seems the port is not required in the host header, it is picked up automatically in parse_url().

silverham’s picture

Status: Active » Reviewed & tested by the community
stevetweeddale’s picture

The maintainers, I believe this patch will conflict with the one in #2355631: Problem to retrieve info from MySpace - Flickr (patch provided), but both are worthwhile and different changes I think.