php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #72671 Add support for adding HTTP headers to SolrRequest?
Submitted: 2016-07-25 17:55 UTC Modified: -
From: tandre at ifwe dot co Assigned:
Status: Open Package: solr (PECL)
PHP Version: Irrelevant OS: All
Private report: No CVE-ID: None
 [2016-07-25 17:55 UTC] tandre at ifwe dot co
Description:
------------
On our java solr servers, we use a custom HTTP header (with a value of the user id) as a part of a key for caching requests, and send that in HTTP requests.

(If the requesting user id is the same as a cache entry, and the query params are the same, the cached result is returned. )

We currently do this via a patched version of this extension, but was wondering if this would be useful elsewhere.

Proposed interface:

// $params is SolrParams or subclass
$params->setHTTPHeader(string $key, string $value) for SolrParams and all subclasses.
(Throwing an exception if $key is reserved)
$params->addHTTPHeader(string $key, string $value)

(Alternately, add it as a possible optional field, called like $client->query($params, ['request_headers' => ['custom_header' => 'value', 'custom_header2' => ['value1', 'value2']]])

If this is useful to others, I should be able to put together a patch.


Patches

Pull Requests

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 15:01:30 2024 UTC