cancel
Showing results for 
Search instead for 
Did you mean: 

My Perl cgi perl scrips have stopped working and get: http://ccgi.dougrice.plus.com/cgi-bin/wiki.pl

FIXED
Highlighted
Superuser
Superuser
Posts: 10,063
Thanks: 1,369
Fixes: 75
Registered: ‎06-04-2007

Re: My Perl cgi perl scrips have stopped working and get: http://ccgi.dougrice.plus.com/cgi-bin/wiki

Courtesy of Google I discovered the X-Pad header is a fudge Apache adds to bypass a bug in a very ancient version of Netscape triggered when header character 256 or 257 is a new-line character. It gets added for all user agents since doing this was quicker than working out the actual one being used. So the presence of that header was not significant.

By experiment with my wiki extract test I've discovered how to make this work. It seems any cookie containing '&' characters will fail if

  • all settings are numerical, or
  • it contains a variable called 'id'.

When I replace the value of randkey with a random string of 9 letters and change 'id' to 'idnum' it works..

This gives a cookie like

Name: wikipreferences
Value: randkey&VKCvwhRCz&rev&7&idnum&1347

In that the value of 'rev' is 7 which means 6 update cycles have been done after initialisation.

Clearly my testing is far from exhaustive, and you discovered avoiding ampersands also works. Smiley

David
Highlighted
Rising Star
Posts: 218
Thanks: 1
Fixes: 2
Registered: ‎06-08-2007

Re: My Perl cgi perl scrips have stopped working and get: http://ccgi.dougrice.plus.com/cgi-bin/wiki

Hi David,

I modified tt2.pl to send the cookie.

I reproduced the problem if I include &id& 

I changed it to &ie& - still works

I changed it to &ib& - still works

 

 

#http://ccgi.dougrice.plus.com/cgi-bin/tt2.pl
sub PrintHeader {
#breakes
#print "Set-Cookie:Wiki=rev&1&id&3989&randkey&286140683";
#okay if id is changed to ib or ie
print "Set-Cookie:Wiki=rev&1&ib&3989&randkey&286140683";
#okay if id is changed to ib or ie
print "Set-Cookie:Wiki=rev&1&ie&3989&randkey&286140683";
#okay
# print "Set-Cookie:Wiki=rev_1_ie_3989_randkey_286140683";
#okay
#print "Set-Cookie:Wiki=rev&1&ie_3989_randkey_286140683";
#okay
#print "Set-Cookie:Wiki=rev&1&ie_3989_randkey_286140683";
  return "Content-type: text/html\n\n";
}

 

Can PlusNet raise a ticket to the CCGI team? 

I do have a work around that works.

regards and many thanks,

 

Doug

Highlighted
Rising Star
Posts: 218
Thanks: 1
Fixes: 2
Registered: ‎06-08-2007

Re: My Perl cgi perl scrips have stopped working and get: http://ccgi.dougrice.plus.com/cgi-bin/wiki

Hi there must be another filter script in the web server that does not like id in the cookie. I modified tt2.pl to Set-Cookie and found it had to have "id".

I tried some different  combinations and positions and capitalisations.

it breaks if it finds id, but not for idi,idd,Id,iD.iid,ib,ic,ie.

It works on apache on my raspberry Pi and has worked for years.

I have a working workaround, so this is now just for curiousity.

Another cookie is reported. TS0194eee0. My script does not add this.

 

HTTP_COOKIE=TS0194eee0=01a7d14f7faf7bea938c3ab082e4d9fd3eadc2caea13d8a27b3bbb37cebaf6dc93bcb086d3aa88c3e7599da28bab15614b4169c1381c0ae75fabac8cf727cb23fcfd8b3e21; Wiki=& ie&3989rev&1&3989&randkey&286140683


# PrintHeader
# Returns the magic line which tells WWW that we're an HTML document

#http://ccgi.dougrice.plus.com/cgi-bin/tt2.pl
sub PrintHeader {
#breakes
#print "Set-Cookie:Wiki=rev&1&id&3989&randkey&286140683\n";
#okay if id is changed to ib or ie
#print "Set-Cookie:Wiki=rev&1&ib&3989&randkey&286140683\n";
#okay if id is changed to ib or ie
#print "Set-Cookie:Wiki=rev&1&ie&3989&randkey&286140683\n";
#okay if id is changed to ib or ie
#print "Set-Cookie:Wiki=rev&1&ic&3989&randkey&286140683\n";

#okay
#print "Set-Cookie:Wiki=rev_1_ie_3989_randkey_286140683\n";
#okay
#print "Set-Cookie:Wiki=rev&1&ie_3989_randkey_286140683\n";
#okay
#print "Set-Cookie:Wiki=rev&1&ie_3989_randkey_286140683\n";

#breaks
#print "Set-Cookie:Wiki=rev&1&3989&randkey&286140683&id&3989\n";
#breaks
#print "Set-Cookie:Wiki=&id&3989rev&1&3989&randkey&286140683\n";
#okay id is set to ID
#print "Set-Cookie:Wiki=&ID&3989rev&1&3989&randkey&286140683\n";

#okay id is set to iD
#print "Set-Cookie:Wiki=&iD&3989rev&1&3989&randkey&286140683\n";
#okay id is set to iD
#print "Set-Cookie:Wiki=&Id&3989rev&1&3989&randkey&286140683\n";
#okay id is set to Id
#print "Set-Cookie:Wiki=&iid&3989rev&1&3989&randkey&286140683\n";
#okay id is set to idi
#print "Set-Cookie:Wiki=&idi&3989rev&1&3989&randkey&286140683\n";
#breaks if okay id is set to id
#print "Set-Cookie:Wiki=&idd&3989rev&1&3989&randkey&286140683\n";
#breaks id is set to 'id '
#print "Set-Cookie:Wiki=&id &3989rev&1&3989&randkey&286140683; Thu, 01 Jan 1970 00:00:01 GMT; Path=/\n";
#breaks id is set to ' id'
print "Set-Cookie:Wiki=& id&3989rev&1&3989&randkey&286140683; Thu, 01 Jan 1970 00:00:01 GMT; Path=/\n";
#okay id is set to ' ie'
print "Set-Cookie:Wiki=& ie&3989rev&1&3989&randkey&286140683; Thu, 01 Jan 1970 00:00:01 GMT; Path=/\n";

#set HTTP_COOKIE=TS0194eee0=01a7d14f7faf7bea938c3ab082e4d9fd3eadc2caea13d8a27b3bbb37cebaf6dc93bcb086d3aa88c3e7599da28bab15614b4169c1381c0ae75fabac8cf727cb23fcfd8b3e21; Wiki=& ie&3989rev&1&3989&randkey&286140683
  return "Content-type: text/html\n\n";
}

 

Highlighted
Rising Star
Posts: 218
Thanks: 1
Fixes: 2
Registered: ‎06-08-2007

Re: My Perl cgi perl scrips have stopped working and get: http://ccgi.dougrice.plus.com/cgi-bin/wiki

If I have id& at the start of the cookie it works! e.g

set HTTP_COOKIE=Wiki=id&3989rev&1&3989&randkey&286140683; TS0194eee0=01a7d14f7f22f5883bb444e95972bb6b672b7c05f0e1a2149131c5ee7273bec2622e7be9a05db116eba2c031b743dcae530343cab7

Have &id& in the cookie and it breaks!

I have a working workaround!

Highlighted
Superuser
Superuser
Posts: 10,063
Thanks: 1,369
Fixes: 75
Registered: ‎06-04-2007

Re: My Perl cgi perl scrips have stopped working and get: http://ccgi.dougrice.plus.com/cgi-bin/wiki

I don't think that "TS" cookie is anything to do with the current scripts. I have a similarly named one and it's a session cookie for the whole site but I don't know what creates it. I have several "TS" cookies associated with different parts of my site, some for WordPress, some for phpMyAdmin, some for other apps.

I've confirmed that a cookie with all numeric values works for me as long as I don't have an "id" parameter. I created the cookie using standard CGI.pm method calls. I've tried to get that to put 'id' first but the software won't play ball. Huh

 

David
Highlighted
Superuser
Superuser
Posts: 10,063
Thanks: 1,369
Fixes: 75
Registered: ‎06-04-2007

Re: My Perl cgi perl scrips have stopped working and get: http://ccgi.dougrice.plus.com/cgi-bin/wiki

By overwriting the generated cookie I've confirmed that "id&" at the start of the cookie value works. Having "&id&" inside the cookie fails as does "&id" (as a parameter value) at the end.

David
Highlighted
Rising Star
Posts: 218
Thanks: 1
Fixes: 2
Registered: ‎06-08-2007

Re: My Perl cgi perl scrips have stopped working and get: http://ccgi.dougrice.plus.com/cgi-bin/wiki

Hi David,

 

Thanks for the post. I agree.

The PlusNet Webserver is adding TS0194eee0=01a7d14f7f22f5883bb444e95972bb6b672b7c05f0e1a2149131c5ee7273bec2622e7be9a05db116eba2c031b743dcae530343cab7

If I run tt2.pl on my raspberry Pi with Apachie web server, It does not add the S0194eee0= cookie.

The Wiki.pl does not add this cookie, so another filter / piped script, possibly a load balancer, or Advert Tracker script is adding it. 

This script is possibly using coookies and does not like &id&.

Thanks for your help. I have a good work around for editing my Wiki in place.

regards,

 

Doug