Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-04-10 13:29:53

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,196
Website

access logs weirdness - host/ip displayed as '1' (Admin > logs)

On one of my little used sites (hosted by Dreamhost – shared hosting) I noticed this: all ‘host’/IP’s are displayed as ‘1’ in the access logs (instead of the usual xxx.xxx.xxx.xxx format.

I’m using up-to-date svn builds, that might have something to do with it, although on my other (localhost) install those things are displayed correctly.

Do I have some bizarre setting somewhere (either in Txp or my Dreamhost account) ?


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#2 2012-04-10 13:37:00

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: access logs weirdness - host/ip displayed as '1' (Admin > logs)

phiw13 wrote:

all ‘host’/IP’s are displayed as ‘1’ in the access logs

I spotted this too. Probably something to do with r3682 and its related typo but I haven’t a clue why it does it. Hopefully Robert knows…

EDIT: oh wait, I wonder if $ips[0] is only taking the first character of the $ip string?

EDIT2: Hmph, maybe not… my IP begins with ‘86’ today and I still just see ‘1’ in the logs.

Last edited by Bloke (2012-04-10 13:50:43)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2012-04-10 13:47:22

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,196
Website

Re: access logs weirdness - host/ip displayed as '1' (Admin > logs)

phiw13 wrote:

… although on my other (localhost) install those things are displayed correctly.

I’m wrong there, when i access the local site (running on my OS X dev machine) from another Mac, it displays as ‘1’ in the logs.

PHP 5.2.17 @ dreamhost and PHP 5.3.8 on OS X / localhost

Bloke wrote

I spotted this too

Ah good, I’m not alone then… :-)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#4 2012-04-10 17:50:31

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: access logs weirdness - host/ip displayed as '1' (Admin > logs)

Bloke wrote:

I spotted this too. Probably something to do with r3682 and its related typo but I haven’t a clue why it does it. Hopefully Robert knows…

remote_addr() should work as expected as far as I see. Robert didn’t do any other changes to it than add additional IPv6 local addresses to the X_FORWARDED_FOR heading check, and then fix that single character typo.

As you are having issues, do you have X_FORWARDED_FOR header set? Any change your public IP you’re using to access the server is same as the server’s, or you are behind a proxy?

Philippe, Stef, please, could you put the following snippet to your page template and post the results here:

<txp:php> echo 
	'REMOTE_ADDR: ' . serverSet('REMOTE_ADDR') . '<br />'.
	'remote_addr(): ' . remote_addr() . '<br />' . 
	'SERVER_ADDR: ' . serverSet('SERVER_ADDR') . '<br />' .
	'X_FORWARDED_FOR: ' . serverSet('HTTP_X_FORWARDED_FOR');
</txp:php>

If any of the addresses is not a local IP or a public proxy, feel free to censor last two groups or so from the address.

Last edited by Gocom (2012-04-10 17:53:05)

Offline

#5 2012-04-10 18:45:46

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: access logs weirdness - host/ip displayed as '1' (Admin > logs)

Gocom wrote:

post the results here:

REMOTE_ADDR: 86.xx.yy.zz
remote_addr(): 1
SERVER_ADDR: 85.xx.yy.zz
X_FORWARDED_FOR: 

That gives some insight.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#6 2012-04-10 19:14:40

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: access logs weirdness - host/ip displayed as '1' (Admin > logs)

Took a look (again) to remote_addr() and what you a know, there is a small typo — still. The function is doing bit more than just comparing the IP in the statement. I’ve sent a patch to the issue tracker with issue #165.

Offline

#7 2012-04-10 19:37:51

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: access logs weirdness - host/ip displayed as '1' (Admin > logs)

Gocom = Eagle Eyes.

Thanks!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#8 2012-04-11 04:57:57

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,196
Website

Re: access logs weirdness - host/ip displayed as '1' (Admin > logs)

Gocom == hero !

Works perfectly fine now on both localhost and Dreamhost, thanks.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#9 2012-04-11 12:52:07

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: access logs weirdness - host/ip displayed as '1' (Admin > logs)

Looks like I have hit the high-score on the BPLOC meter there. Thanks for spotting!

Offline

Board footer

Powered by FluxBB