• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get_request_header broken

#1
Bug 
hi,

with the new version 3.0 the method input->get_request_header does not work properly anymore. There seem to be different formatting options on different servers to get a property from the HTTP headers.

Eg. to get custom HTTP header property "X-APP-IDENTIFIER" some server environments provide it as "X-App-Identifier" some as "X-APP-IDENTIFIER" and some all lowercase as "x-app-identifier".

I wrote a work around method to check all variants as followed:

public function get_request_header($name) {
$request = $this->_obj->input->get_request_header($name, TRUE);
if ($request) {
return $request;
}

$request = $this->_obj->input->get_request_header(strtolower($name), TRUE);
if ($request) {
return $request;
}

$key = strtoupper($name);
return array_key_exists($key, $_SERVER) && $_SERVER[$key] ? $_SERVER[$key] : NULL;
}



I would be nice to have codigniter take care of this, so that there is a unified way of getting these properties.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.