Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getHeaders #27

Closed
exbit opened this issue Mar 16, 2016 · 7 comments
Closed

getHeaders #27

exbit opened this issue Mar 16, 2016 · 7 comments

Comments

@exbit
Copy link

exbit commented Mar 16, 2016

windows OS
...\system\Debug\Toolbar\View\toolbar.tpl.php

$value) : ?>
                <?php if (empty($value)) continue; ?>
                <tr>
                    <td><?= esc($value->getName()) ?></td>
                    <td><?= esc($value->getValueLine()) ?></td>
                </tr>
            <?php endforeach; ?>

var_dump($headers);

from this it follows that $value === string or $value === array

array(14) {
["Host"]=>
array(2) {
[0]=>
string(7) "ci4.loc"
[1]=>
object(CodeIgniter\HTTP\Header)#9 (2) {
["name":protected]=>
string(4) "Host"
["value":protected]=>
string(7) "ci4.loc"
}
}
["X-Real-IP"]=>
string(9) "127.0.0.1"
["X-Forwarded-For"]=>
array(2) {
[0]=>
string(9) "127.0.0.1"
[1]=>
object(CodeIgniter\HTTP\Header)#11 (2) {
["name":protected]=>
string(15) "X-Forwarded-For"
["value":protected]=>
string(9) "127.0.0.1"
}
}
["Connection"]=>
array(2) {
[0]=>
string(5) "close"
[1]=>
object(CodeIgniter\HTTP\Header)#12 (2) {
["name":protected]=>
string(10) "Connection"
["value":protected]=>
string(5) "close"
}
}
["User-Agent"]=>
array(2) {
[0]=>
string(78) "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"
[1]=>
object(CodeIgniter\HTTP\Header)#13 (2) {
["name":protected]=>
string(10) "User-Agent"
["value":protected]=>
string(78) "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"
}
}
["Accept"]=>
array(2) {
[0]=>
string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"
[1]=>
object(CodeIgniter\HTTP\Header)#14 (2) {
["name":protected]=>
string(6) "Accept"
["value":protected]=>
string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"
}
}
["Accept-Language"]=>
array(2) {
[0]=>
string(35) "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"
[1]=>
object(CodeIgniter\HTTP\Header)#15 (2) {
["name":protected]=>
string(15) "Accept-Language"
["value":protected]=>
string(35) "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"
}
}
["Accept-Encoding"]=>
array(2) {
[0]=>
string(13) "gzip, deflate"
[1]=>
object(CodeIgniter\HTTP\Header)#16 (2) {
["name":protected]=>
string(15) "Accept-Encoding"
["value":protected]=>
string(13) "gzip, deflate"
}
}
["DNT"]=>
string(1) "1"
["Pragma"]=>
array(2) {
[0]=>
string(8) "no-cache"
[1]=>
object(CodeIgniter\HTTP\Header)#18 (2) {
["name":protected]=>
string(6) "Pragma"
["value":protected]=>
string(8) "no-cache"
}
}
["Cache-Control"]=>
array(2) {
[0]=>
string(8) "no-cache"
[1]=>
object(CodeIgniter\HTTP\Header)#19 (2) {
["name":protected]=>
string(13) "Cache-Control"
["value":protected]=>
string(8) "no-cache"
}
}
["Content-Type"]=>
bool(false)
["X-Real-Ip"]=>
object(CodeIgniter\HTTP\Header)#10 (2) {
["name":protected]=>
string(9) "X-Real-Ip"
["value":protected]=>
string(9) "127.0.0.1"
}
["Dnt"]=>
object(CodeIgniter\HTTP\Header)#17 (2) {
["name":protected]=>
string(3) "Dnt"
["value":protected]=>
string(1) "1"
}
}

@lonnieezell
Copy link
Member

Then their might be an error still lingering around, but $value should always be an instance of CodeIgniter\HTTP\Header. Will need to verify the populateHeaders method.

@lonnieezell
Copy link
Member

What server are you using for this? Looking back through your data, the Header instances are there, but for some reason have duplicate as strings. Following through the code, this shouldn't happen. Are these headers from the request or the response data? They look to be the request?

@exbit
Copy link
Author

exbit commented Mar 17, 2016

W10-x64 php-7.0.4-Win32-VC14-x64 httpd-2.4.18-win64-VC14

...application\Config\App.php
$baseURL = 'http://ci4.loc:80';
$uriProtocol = 'QUERY_STRING';

var_dump($_SERVER);

array(38) {
["HTTP_HOST"]=>
string(7) "ci4.loc"
["HTTP_X_REAL_IP"]=>
string(9) "127.0.0.1"
["HTTP_X_FORWARDED_FOR"]=>
string(9) "127.0.0.1"
["HTTP_CONNECTION"]=>
string(5) "close"
["HTTP_USER_AGENT"]=>
string(78) "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"
["HTTP_ACCEPT"]=>
string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"
["HTTP_ACCEPT_LANGUAGE"]=>
string(35) "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"
["HTTP_ACCEPT_ENCODING"]=>
string(13) "gzip, deflate"
["HTTP_DNT"]=>
string(1) "1"
["HTTP_PRAGMA"]=>
string(8) "no-cache"
["HTTP_CACHE_CONTROL"]=>
string(8) "no-cache"
["PATH"]=>
string(462) "C:\PROGRAMDATA\ORACLE\JAVA\JAVAPATH;C:\WINDOWS\SYSTEM32;C:\WINDOWS;"
["SystemRoot"]=>
string(10) "C:\Windows"
["COMSPEC"]=>
string(27) "C:\Windows\system32\cmd.exe"
["PATHEXT"]=>
string(53) ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
["WINDIR"]=>
string(10) "C:\Windows"
["SERVER_SIGNATURE"]=>
string(0) ""
["SERVER_SOFTWARE"]=>
string(21) "Apache/2.4.18 (Win64)"
["SERVER_NAME"]=>
string(7) "ci4.loc"
["SERVER_ADDR"]=>
string(9) "127.0.0.1"
["SERVER_PORT"]=>
string(2) "80"
["REMOTE_ADDR"]=>
string(9) "127.0.0.1"
["DOCUMENT_ROOT"]=>
string(18) "D:/WEB/www/ci4.loc"
["REQUEST_SCHEME"]=>
string(4) "http"
["CONTEXT_PREFIX"]=>
string(0) ""
["CONTEXT_DOCUMENT_ROOT"]=>
string(18) "D:/WEB/www/ci4.loc"
["SERVER_ADMIN"]=>
string(17) "webmaster@ci4.loc"
["SCRIPT_FILENAME"]=>
string(28) "D:/WEB/www/ci4.loc/index.php"
["REMOTE_PORT"]=>
string(5) "13297"
["GATEWAY_INTERFACE"]=>
string(7) "CGI/1.1"
["SERVER_PROTOCOL"]=>
string(8) "HTTP/1.0"
["REQUEST_METHOD"]=>
string(3) "GET"
["QUERY_STRING"]=>
string(0) ""
["REQUEST_URI"]=>
string(1) "/"
["SCRIPT_NAME"]=>
string(10) "/index.php"
["PHP_SELF"]=>
string(10) "/index.php"
["REQUEST_TIME_FLOAT"]=>
float(1458224779.914)
["REQUEST_TIME"]=>
int(1458224779)
}

@lonnieezell
Copy link
Member

Thanks. I was actually more curious about the server software itself. Apache, nginx, through XAMPP, etc.As mentioned on your other thread, I've just got a Windows setup about ready to use, but help debugging and providing solutions is always better than just stating a problem. I've only got so much time on my hands. :)

@exbit
Copy link
Author

exbit commented Mar 17, 2016

XAMPP, etc I do not use only php and apache

Distributor ID: Debian
Description: Debian GNU/Linux 8.3 (jessie)
Release: 8.3
Codename: jessie

PHP 7.0.4-1~dotdeb+8.1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Server version: Apache/2.4.10 (Debian)
Server built: Nov 28 2015 14:05:48

var_dump($headers);

array(9) {
["Host"]=>
array(2) {
[0]=>
string(13) "127.0.0.1"
[1]=>
object(CodeIgniter\HTTP\Header)#8 (2) {
["name":protected]=>
string(4) "Host"
["value":protected]=>
string(13) "127.0.0.1"
}
}
["User-Agent"]=>
array(2) {
[0]=>
string(78) "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"
[1]=>
object(CodeIgniter\HTTP\Header)#9 (2) {
["name":protected]=>
string(10) "User-Agent"
["value":protected]=>
string(78) "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"
}
}
["Accept"]=>
array(2) {
[0]=>
string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"
[1]=>
object(CodeIgniter\HTTP\Header)#10 (2) {
["name":protected]=>
string(6) "Accept"
["value":protected]=>
string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8"
}
}
["Accept-Language"]=>
array(2) {
[0]=>
string(35) "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"
[1]=>
object(CodeIgniter\HTTP\Header)#11 (2) {
["name":protected]=>
string(15) "Accept-Language"
["value":protected]=>
string(35) "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3"
}
}
["Accept-Encoding"]=>
array(2) {
[0]=>
string(13) "gzip, deflate"
[1]=>
object(CodeIgniter\HTTP\Header)#12 (2) {
["name":protected]=>
string(15) "Accept-Encoding"
["value":protected]=>
string(13) "gzip, deflate"
}
}
["DNT"]=>
string(1) "1"
["Connection"]=>
array(2) {
[0]=>
string(10) "keep-alive"
[1]=>
object(CodeIgniter\HTTP\Header)#14 (2) {
["name":protected]=>
string(10) "Connection"
["value":protected]=>
string(10) "keep-alive"
}
}
["Cache-Control"]=>
array(2) {
[0]=>
string(9) "max-age=0"
[1]=>
object(CodeIgniter\HTTP\Header)#15 (2) {
["name":protected]=>
string(13) "Cache-Control"
["value":protected]=>
string(9) "max-age=0"
}
}
["Dnt"]=>
object(CodeIgniter\HTTP\Header)#13 (2) {
["name":protected]=>
string(3) "Dnt"
["value":protected]=>
string(1) "1"
}
}

@lonnieezell
Copy link
Member

Oh! I think I figured it out. I've been running under nginx lately, so I didn't notice the old code that pulled straight from apache. Issuing fix now. Thanks!

@lonnieezell
Copy link
Member

On the plus side, I now have a version running under Apache and one running under nginx at all times so I should be able to find these types of issues easier. Which, shouldn't be all that often.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants