Revigniter Basics

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Revigniter Basics

Post by sphere » Mon Aug 26, 2019 2:20 pm

Hi Ralph,

well if they don't set the forum back to the state where it was...

I did what you asked in your last message. And to remind, this was the outcome:
after line 19:
system
after line 64:
C:/Portable/xampp/htdocs/lc2/index.lc/blog
after line 70:
C:/Portable/xampp/htdocs/lc2/system

and

An Error Was Encountered
The URI you submitted has disallowed characters.

rabit
Posts: 40
Joined: Wed May 31, 2006 8:30 am

Re: Revigniter Basics

Post by rabit » Mon Aug 26, 2019 3:23 pm

Indeed, some of our posts have gone. Furthermore I had to
renew my password to be able to log in.
sphere wrote:
Mon Aug 26, 2019 2:20 pm
I did what you asked in your last message. And to remind, this was the outcome:
after line 19:
system
after line 64:
C:/Portable/xampp/htdocs/lc2/index.lc/blog
after line 70:
C:/Portable/xampp/htdocs/lc2/system
All correct.

I can imagine that you are slowly but surely going cracy,
but could you please check the value of sUriString right
after:

Code: Select all

	# SEGMENT BASED URLs
	if gConfig["enableQueryStrings"] is not TRUE then
		replace "\\" with "/" in sUriString
		if char 1 of sUriString is "/" then
			put char 2 to -1 of sUriString into sUriString
		end if
		set the itemDelimiter to "/"
in handler _rigExplodeSegments of library URI.livecodescript?
-- Ralf Bitter

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Revigniter Basics

Post by sphere » Mon Aug 26, 2019 6:18 pm

rabit wrote:
Mon Aug 26, 2019 3:23 pm
I can imagine that you are slowly but surely going cracy,
It must work, but yes a bit, nevertheless, it's not build for nothing.
You believe in it and have years spend. Maybe if it works and we fix this then maybe we can start building :D
Bugs can happen everywhere. Livecode itself has also some long standing bugs and we have to be patient else we should become better programmers and build software with C++ or whatever more difficult language.

sUristring is index.lc\blog

rabit
Posts: 40
Joined: Wed May 31, 2006 8:30 am

Re: Revigniter Basics

Post by rabit » Mon Aug 26, 2019 11:36 pm

sphere wrote:
Mon Aug 26, 2019 6:18 pm
rabit wrote:
Mon Aug 26, 2019 3:23 pm
I can imagine that you are slowly but surely going cracy,
It must work, but yes a bit, nevertheless, it's not build for nothing.
You believe in it and have years spend. Maybe if it works and we fix this then maybe we can start building :D
Bugs can happen everywhere. Livecode itself has also some long standing bugs and we have to be patient else we should become better programmers and build software with C++ or whatever more difficult language.
The thing is that your server environment behaves quite different.
But with your friendly support we can find the required adjustments.
sphere wrote:
Mon Aug 26, 2019 6:18 pm
sUristring is index.lc\blog
sUriString should be “blog”

OK, let’s analyse this issue step by step. Following my assumptions.
According to your infos the value of $_SERVER["PATH_TRANSLATED"] is

C:\Portable\xampp\htdocs\lc\index.lc\blog

So, the value of the local variable sURIstring right after:

Code: Select all

if tUri is "PATH_TRANSLATED" then
	put $_SERVER["PATH_TRANSLATED"] into sUriString
of the additional code in function _rigFetchUriString of URI.ivecodescript must be

C:\Portable\xampp\htdocs\lc\index.lc\blog

right? After the next 3 lines the backslashes in sUriString are replaced
with slashes, so the value is

C:/Portable/xampp/htdocs/lc/index.lc/blog

right? Then after line:

Code: Select all

put char offset("index" & gRigA["EXT"], sUriString) to -1 of sUriString into sUriString
the value of sUriString must be

index.lc/blog

right? After the next line:

Code: Select all

put "/" & item 2 to -1 of sUriString into sUriString
the value is

/blog

should be blog, but it doesn’t matter in this case. Anyway you should replace
this line with:

Code: Select all

put item 2 to -1 of sUriString into sUriString
After line:

Code: Select all

put rigUriAdjusted(sUriString) into sUriString
the value of sUriString is still

blog


Exact this value is used in handler _rigExplodeSegments of URI.livecodescript
which checks for disallowed characters in URI segments (in this case in “blog”)
using the _rigFilterUri() function. This function yields the “The URI you submitted has
disallowed characters.” error, in case a segment includes disallowed characters.
And this is the error you see because according to your info the value of sUriString
in your tests is “index.lc\blog” which of course includes disallowed characters.
But provided that my considerations are right how can sUriString be “index.lc\blog”?
How can sUriString include a backslash although backslashes are replaced?
Are you really sure that gConfig["uriProtocol"] in config.lc is set to "PATH_TRANSLATED”?
-- Ralf Bitter

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Revigniter Basics

Post by sphere » Tue Aug 27, 2019 1:35 pm

Hi Ralph,

yes i understand your thinking.
And yes i'm sure it's set correct.
sUriString is still with backslash
yes.PNG
Maybe the issue is that it does not work ok with Xampp.
Perhaps that when it is put on VPS that it works correct. i did not try it yet.
I'd like to test things locally first, before putting it on a live server.

Maybe you are willing to install Xampp: https://www.apachefriends.org/download.html
So it becomes easier for you to figure out why it is not working as supposed?
I expect you would have the same results.

But while writing this and looking to what you meant, which i did not get completely:
should be blog, but it doesn’t matter in this case. Anyway you should replace
this line with:

Code: Select all

put item 2 to -1 of sUriString into sUriString

After line:

Code: Select all

put rigUriAdjusted(sUriString) into sUriString
But it doesn't matter further.

I understand that the backslash was an issue
I tried this:

Code: Select all

# SEGMENT BASED URLs
	if gConfig["enableQueryStrings"] is not TRUE then
		replace "\\" with "/" in sUriString
		if char 1 of sUriString is "/" then
			put char 2 to -1 of sUriString into sUriString
				end if
				replace "\" with "/" in sUriString   -------i added this line in URI.livecodescript
		set the itemDelimiter to "/"
		###########test##########
		put "sUriString = " & sUriString
		####################################
and this seems to work now:
blog_ok.PNG

rabit
Posts: 40
Joined: Wed May 31, 2006 8:30 am

Re: Revigniter Basics

Post by rabit » Tue Aug 27, 2019 3:23 pm

Found the mistake. Sorry, didn’t see the forest for the trees.
The source of the issue was a copy/past thingy.
The flaw is in:

Code: Select all

if the platform is "Win32" is TRUE then
  replace "\" with "/" in sTempPath
end if
of the additional code in function _rigFetchUriString of URI.ivecodescript.

Code: Select all

replace "\" with "/" in sTempPath
must read

Code: Select all

replace "\" with "/" in sUriString
You see, the variable name was wrong.

Here is the code to be added to system/libraries/URI.livecodescript
right after line 225 (end if) again:

Code: Select all

if tUri is "PATH_TRANSLATED" then
  put $_SERVER["PATH_TRANSLATED"] into sUriString

  if the platform is "Win32" is TRUE then
    replace "\" with "/" in sUriString
  end if

  put char offset("index" & gRigA["EXT"], sUriString) to -1 of sUriString into sUriString

  set the itemDel to "/"
  put item 2 to -1 of sUriString into sUriString

  # IF THE URI CONTAINS ONLY A SLASH WE'LL KILL IT
  if sUriString is "/" then
    put "" into sUriString
  end if
  put rigUriAdjusted(sUriString) into sUriString
  return sUriString
end if
-- Ralf Bitter

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Revigniter Basics

Post by sphere » Tue Aug 27, 2019 6:43 pm

I copied a new URI.livecodescript from the zip and copied the snippet into it.
It works as expected now!

I already today started with the chat script and got the first login page.
So tomorrow i will continue with that and see if it works with this URI file.

Thank you Ralph for staying patient , you're the best :)

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Revigniter Basics

Post by sphere » Fri Sep 06, 2019 9:42 am

Don't think i'm doing nothing...

As i know a bit of html and a bit of css, just enough to alter some things of Joomla templates and such.
But it's not enough...

So i'm following the excellent written course on internetingishard.com, it tells you all from scratch how to use HTML & CSS. And it's free of any charge.
I'm starting lesson 9 today, and taking it easy as i just got surgery on my knee friday a week ago.

As it is a easy and good read with nice to do examples i hope to get the grip soon and start with some simple tests to use the cgi server/revigniter/html&css to read some database data and have it displayed.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Revigniter Basics

Post by bogs » Fri Sep 06, 2019 12:40 pm

sphere wrote:
Fri Sep 06, 2019 9:42 am
So i'm following the excellent written course on internetingishard.com, it tells you all from scratch how to use HTML & CSS.
Along those lines, there is also https://www.w3schools.com/ , which has among other things, a 'Try it yourself' section where you can type in and see the code run. I've always found it an excellent way to learn at least the basics of something.

Hope your knee feels better soon!
Image

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Revigniter Basics

Post by sphere » Fri Sep 06, 2019 1:21 pm

Yes i know that one too :)
But i helps when someone explains a bit, so it becomes easier to understand.
Thanks for your kind words Bogs.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Revigniter Basics

Post by sphere » Wed Sep 11, 2019 9:57 am

I saw there is an update for Revigniter to 2.1.1, so this issue with Xampp helped.
People can use it now to develop local more easily. Thank you Ralph.

First i will update according this: https://revigniter.com/userGuide/instal ... e_211.html

Next i will copy my database for this project into Xampp and see if i can retrieve some data.

Post Reply

Return to “CGIs and the Server”