Skip to content

Commit c9b632b

Browse files
committed
fixing the _detect_method with more general way
1 parent bc4b8fb commit c9b632b

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

application/libraries/REST_Controller.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -406,23 +406,16 @@ protected function _detect_method()
406406
{
407407
$method = strtolower($this->input->server('REQUEST_METHOD'));
408408

409-
if(function_exists('apache_request_headers')) {
410-
$request_headers = apache_request_headers();
411-
}else{
412-
$request_headers['X-HTTP-Method-Override'] = getenv('X-HTTP-Method-Override');
413-
}
414-
415-
416409
if ($this->config->item('enable_emulate_request'))
417410
{
418411
if ($this->input->post('_method'))
419412
{
420413
$method = strtolower($this->input->post('_method'));
421414
}
422-
else if (isset($request_headers['X-HTTP-Method-Override']))
423-
{
424-
$method = strtolower($request_headers['X-HTTP-Method-Override']);
425-
}
415+
else if ($this->input->server('HTTP_X_HTTP_METHOD_OVERRIDE'))
416+
{
417+
$method = strtolower($this->input->server('HTTP_X_HTTP_METHOD_OVERRIDE'));
418+
}
426419
}
427420

428421
if (in_array($method, array('get', 'delete', 'post', 'put')))

0 commit comments

Comments
 (0)