NetTalk Central

Author Topic: Error in Javascript Web9 SSL Example  (Read 17672 times)

bruce2

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example
« Reply #15 on: June 26, 2012, 11:10:22 PM »
I will need to tweak example 9 to separate the two web server objects onto different windows.

In the meantime you can see Example 6 (Basic SSL) as a good starting example.

(all you actually have to do to your current app is delete the second NetTalk object on the window - the one which is serving on port 80.)

You will of course want to serve on port 80 in the long run, but I can show you how to do that next.

Cheers
Bruce

useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example
« Reply #16 on: July 11, 2012, 03:56:31 AM »
I've installed 6.37 as per this announcement "July 6
Build 6.37 is up
If you're doing SSL sites, this update is recommended."

Unfortunately I'm still seeing the same problem in my own websites and all the SSL example apps including Basic SLL (6) as mentioned in your previous post.

Whats the next step? I can only placate customers for so long and this has been ongoing since April.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Error in Javascript Web9 SSL Example
« Reply #17 on: July 11, 2012, 04:09:26 AM »
I suspect you did not re-deploy the NetTalk DLL (ClaNet.Dll / C60NetX.DLL) into the app folder. The SSL tweak is in the DLL.

If that doesn't help, then I'll ask again (as I have been doing with all your notes) for an example so I can replicate the effect here. So far I haven't been able to access your site (no URL) or implement an example here, so there's literally nothing I can do to help until I have one of those.

cheers
Bruce

useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example
« Reply #18 on: July 11, 2012, 05:25:08 AM »
I didnt see anything in the Release Notes and History section about redeploying the C60netx.dll and there is only one C60netx.dll on my system anyway but I did copy it to the app folder and still get the same problem "Error in site Javascript".

I've just created a new VM guest with XP SP3 installed, just installed C6, C6.2 & C6.3.9054 then installed nettalk 6.37 onto it and guess what the 3 examples I tested which are Basic SLL 6, Always SLL 9 and Mixed SLL 8 all display the same error message "Error in site Javascript".

Do you test the examples because if you did I'm sure you would see what I see, so shall we start with trying to get the shipping examples to work first because I'm confident the problems with my webservers will go away once the shipping examples work.

 

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Error in Javascript Web9 SSL Example
« Reply #19 on: July 11, 2012, 06:42:10 AM »
>> Do you test the examples because if you did I'm sure you would see what I see, so shall we start with trying to get the shipping examples to work first because I'm confident the problems with my webservers will go away once the shipping examples work.

unfortunately yes, they're all working (at least the 3 SSL ones are working here. caveat: they're old apps, so they may not "work right" - for example the Browse in example 9 should be changed to use Highlight, not Radio - but they work in the sense that you see the pages over the SSL connection, and there is no JavaScript error message.

>> "Error in site JavaScript"

Error in Javascript is not an SSL error. It refers to the JavaScript in the web folder (which hopefully you updated as well.)
Part of the compile process is copying the web folder from \clarion6\3rdparty\libsrc\netweb to your application folder, and then running the gzipall.bat file in the application folder.
you can run the two batch files manually (copyall.bat, and gzipall.bat) to see if either one fails for any reason. If they fail you will have an out-of-date web folder, which would result in an error message on the page - like the one you are seeing.

>> I've just created a new VM guest with XP SP3 installed, just installed C6, C6.2 & C6.3.9054 then installed nettalk 6.37 onto it and guess what the 3 examples I tested which are Basic SLL 6, Always SLL 9 and Mixed SLL 8 all display the same error message "Error in site Javascript".

I've had mixed success with Virtual Machines when it comes to copying files - depending on your file server's permissions some things may not be allowed. So check the copy, and gzip are working.

If at all possible run the server on a machine where I can "see" it from here - ie access it with my browser. I am then able to more completely diagnose the specific javascript error, or missing file etc. Failing that I'm happy to remote into your machine as well to help you diagnose it that way.

I agree that getting the examples to work in your setup will be crucial in getting your application to work as well.

Cheers
Bruce

useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example
« Reply #20 on: July 11, 2012, 07:10:12 AM »
Do the examples work in C8 then or is there something missing from the installation software which explains why I am seeing these problems.

Below is the source code from the webpage for example 8 which you would see if it was exposed to the web from any web browser, but I am curious what other remote facilities and thus information can you gain from the server if I was to expose the webserver to the web. For example in line 96 in nettalk.clw
if command ('/nettalkwindow')           ! You need a special version of the DLL for this
so such things exist which could be a security risk and its this that makes me wonder if this was how my servers got to be hacked despite all the other security in place which is why these servers have not been online since April.


<!DOCTYPE html><html class="nt-html no-js">
<head><title>NetTalk Example Site</title><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<link href="/themes/ui-lightness/theme.css" rel="stylesheet" />
<link href="/styles/msie8.css" rel="stylesheet" />
<script src="/scripts/all.js" type="text/javascript"></script>
</head>
<div id="pageheadertag_div" class="nt-site-header"  data-role="header"><div  class="nt-width-100 nt-margin-bottom"><fieldset  class="ui-corner-all">
      <table class="headingtable">
        <tr>
        <td width="10%"><img border="0" src="images/heading.png" /></td>
         <td width="80%">CapeSoft Email Server - Configuration</td>
         <td width="10%"><a href="javascript:top.close()"><img border="0" src="images/close.png" /></a></td>
         </tr>
        </table>
</fieldset></div>
</div>
<div id="_busy" class="nt-busy" data-nt-busy="busy"><img src="/images/_busy.gif" /></div><div id="_ver637" class="nt-alert ui-state-error ui-corner-all">Error in site JavaScript</div><script>versionCheck('6.37');getScreenSize()</script>
<div id="alert_div" class="nt-width-99 alert ui-state-error ui-corner-all ui-helper-hidden"></div>
 
 
<a href="secure/welcome.htm">Welcome Page</a>
<div id="mailboxesbrowsecontrol_div" class="adiv"><div id="_ntbc_" class="nt-hidden"></div><div class="MainHeading">Mailboxes</div>
<div id="mailboxesbrowsecontrol_table_div" class="ui-widget"><table class="BrowseTable" id="mailboxesbrowsecontrol_tbl" ><thead class="ui-widget-header">
<tr>
<th id="head_2"><div data-do="sh"  class="nt-left nt-fakeget">Mail Box</div></th>
<th id="head_4"><div data-do="sh"  class="nt-left nt-fakeget">Limit</div></th>
<th id="head_3"><div data-do="sh"  class="nt-left nt-fakeget">Forward To</div></th>
<th id="head_5"><div data-do="sh"  class="nt-left nt-fakeget">Start Date</div></th>
</tr>
</thead>
<tbody class="nt-browse-table-body">
<tr class="nt-browse-table-row" data-nt-id="UPUme21n" onclick="">
<td>
<div id="div2105287082_div" class="adiv">Bruce</div>
</td>
<td>
<div id="div3816647937_div" class="adiv">0</div>
</td>
<td>
<div id="div128200145_div" class="adiv"></div>
</td>
<td>
<div id="div857724190_div" class="adiv">18/01/2006</div>
</td>
</tr>
<tr class="nt-browse-table-row" data-nt-id="WexGsG4L" onclick="">
<td>
<div id="div2473738374_div" class="adiv">Gregory</div>
</td>
<td>
<div id="div225643565_div" class="adiv">0</div>
</td>
<td>
<div id="div3920252157_div" class="adiv"></div>
</td>
<td>
<div id="div3708924978_div" class="adiv">18/01/2006</div>
</td>
</tr>
<tr class="nt-browse-table-row" data-nt-id="dTUZfyic" onclick="">
<td>
<div id="div3832901648_div" class="adiv">James</div>
</td>
<td>
<div id="div2054438075_div" class="adiv">31</div>
</td>
<td>
<div id="div2662169707_div" class="adiv"></div>
</td>
<td>
<div id="div2853602468_div" class="adiv">24/01/1868</div>
</td>
</tr>
<tr class="nt-browse-table-row" data-nt-id="abgs2oi4" onclick="">
<td>
<div id="div219600165_div" class="adiv">Sean</div>
</td>
<td>
<div id="div2467797390_div" class="adiv">0</div>
</td>
<td>
<div id="div2010044766_div" class="adiv"></div>
</td>
<td>
<div id="div1131749777_div" class="adiv">17/02/2006</div>
</td>
</tr>
</tbody></table>
</div>
<div id="MailboxesBrowseControl_update_b" class=""><button type="button" name="insert_btn" id="insert_btnZFFH" value="Insert" class="MainButton"  title="Click here to Insert a new record"  data-do="insert">Insert</button>
<button type="button" name="change_btn" id="change_btnMGVT" value="Change" class="MainButton"  title="Click here to Change the highlighted record"  data-do="change">Change</button>
<button type="button" name="deleteb_btn" id="deleteb_btnVKQX" value="Delete" class="MainButton"  title="Click here to Delete the highlighted record"  data-do="deleteb">Delete</button>
 
</div>
</div>
<script defer="defer">
jQuery(function() {jQuery("#mailboxesbrowsecontrol_div").ntbrowse({ sproc:"mailboxesbrowsecontrol", id:"mailboxesbrowsecontrol", parent:"", value:"UPUme21n", form:"MailboxesFormControl", formInsert:"", formCopy:"", formChange:"", formView:"", formDelete:"", formpopup:0, selectAction:"", closeAction:"index.htm", lookupField:"", greenbar:0, confirmDeleteMessage:"Are you sure you want to delete this record?", confirmDelete:1, rowsHigh:1, popup:0});});
 
</script>
 
<div id="pagefootertag_div" class="nt-site-footer nt-left nt-width-100"  data-role="footer"><div  class="nt-width-100 nt-margin-top"><fieldset  class="ui-corner-all">
<table class="footertable">
  <tr>
    <td>(c) 2012 by CapeSoft Software</td>
  </tr>
</table>
</fieldset></div>
</div>
 
<body class="PageBody">
<div class="nt-body-div">
 
</div></body>
</html>

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Error in Javascript Web9 SSL Example
« Reply #21 on: July 11, 2012, 08:20:37 AM »
Hi Richard,

I'd do the following diagnostics in Firefox.

a) On the address line press F5.

b) right click on the page and choose "view source".

c) on the line;
<script src="/scripts/all.js" type="text/javascript"></script>
click on the all.js link to fetch the all.js file.
(if this gave an error I'd know your web folder was not deployed correctly)

d) search the all.js code for NetTalkVersion. This should take you to a code snippet of code where you can see the version number of the all.js file. (Should be 6.37) - if not either the web folder is not up to date, or GzipAll.bat is not working properly.

e) In Firefox, using Firebug (www.getfirebug.com) I'd look in the console window to see if any javascript errors are being reported.

If you like, follow the above steps and see which one, if any, gives you more information. If you feedback here, I can give you the next step.

>> For example in line 96 in nettalk.clw if command ('/nettalkwindow')           ! You need a special version of the DLL for this
>> so such things exist which could be a security risk

no, these can't be a security risk. For starters it's looking at your command line - so the person would need to start your exe with some set of parameters in order for this to kick in. If they can start an exe, then they can do anything they like already.
secondly the code is just a set of instructions to make the NetTalk Window visible for debugging purposes. the window exists, displaying it doesn't do anything in the way of security.

>> makes me wonder if this was how my servers got to be hacked

Unfortunately there are so many ways for servers to be "hacked" that trying to guess which one it was, without any sort of concrete data, is likely to not result in anything useful. Firstly one would need to know the nature of the "hack" - ie what actually happened, what artifacts there are and so on. the cause could be anything from a USB key, to an email, to running bad software to anything in between. I'm reasonably confident that the NetTalk server can't "do" more than what it's coded to do.

Cheers
Bruce





useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example
« Reply #22 on: July 11, 2012, 10:04:57 AM »
all.js is deployed properly but its empty there is no code in it whatsoever.


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Error in Javascript Web9 SSL Example
« Reply #23 on: July 11, 2012, 09:05:17 PM »
excellent. that's what we're looking for.
So, ok, look in your application\web\scripts folder.
How big is the all.js.gz file there? (I'm guessing 0 bytes).

So delete all the .gz files, open a command-prompt window and go to the app folder.
run gzipall.bat manually, and look to see if there are any errors.
afterwards check the size of the gz files again. If it's still 0, then find the line that Gzip's all.js
in my app it looks like this;
"C:\Clarion8NT6\accessory\bin\gzip" -9 -n -f -c web\scripts\all.js        > "web\scripts\all.js.gz"

and run that manually from the command prompt, looking for errors.

Let us know what happens

cheers
Bruce

useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example
« Reply #24 on: July 12, 2012, 12:12:57 AM »
Bruce. This is a reproducible bug. The midnight themes are missing as well which I hilighted in another post and then you gave me some bull about that as well. So why dont you just fix the installation software for C6 instead of sending me around the houses with these pathetic tasks.

Its taken 4months to get this far with a supplier.

Its no wonder other clarion users have ditched Capesoft and moved to other languages when people get the run around like this.

Its a pity there are not more users of Clarion because I would not be the only one reporting this problem but it speaks volumes that 4months on no one has reported this problem which say's I'm the only person using C6 with NT with 6.34 onwards!

For the record the C7/8 version works fine, its the C6 installation that is broken which shows its not been tested.


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Error in Javascript Web9 SSL Example
« Reply #25 on: July 12, 2012, 01:13:16 AM »
hi Richard,

While I understand your frustration, I think you are perhaps missing some key understandings and this is making it hard for you to diagnose what is going on.

The installer installs the "default" web folder into \clarion6\3rdparty\libsrc\netweb. So from the point of view of checking the installer behavior delete this folder, then install nettalk, then see if the folder now contains a "web" folder. (I just did that here, and on mine it does.)

Inside that folder you should find a bunch of stuff, including a scripts folder, and a themes folder. In the themes folder you'll see sub-folders - one for each theme (including Midnight.)

This is somewhat different to Nettalk 5, because NT5 installer then copied this web folder into each example preemptively. In NT6 the installer does not do this (for reasons I'll get to in a moment).

Given that the web folder is not copied by the installer, the template needs to copy the files into the app folder for you. It does this on the first compile, and reports to you, via the error window, that it has done so. In C6 this pauses the compile, in C8 it doesn't. The mechanism internally is that it creates a COPYALL.BAT file and a GZIPALL.BAT file, and then executes these during the generate of the app. If the copy, or Gzip fails for some reason then of course things are not going to work right.

The reasons for the change are several. Firstly, in all too many cases developers would forget to copy the updated web folder to their app folder when updating NetTalk. Making this automatic reduces problems. There is a version number in one of the files (netweb.js) and this is compared against the version number in the template. If they don't match, it does a copy. In this way your work-load reduces.

Another reason has to do with the improved Theme support, and specifically the ability for you to add themes, and for the user to change themes at runtime. In order to make this process manageable the GZIP has to be more automatic (in NT5 it's a manual process). As themes are added it also does a bit of work to re-zip and so on. When I added the Midnight theme for example it noticed that and initiated the zip (which you pointed out earlier.)

Of course whenever there is an automatic process there are things that may fail. For example, on one of my virtual machines, it doesn't like copying from one network drive to another. That's a permissions issue on the server. In order to diagnose the issue I can run the CopyAll.Bat file manually (and the GzipAll.Bat file manually), and hence look at the output to see if it worked, or didn't work.

As I alluded to earlier it's clear that something is not working on your machine, and thus following the steps allows you to determine what it is. Once you've got that, it's easier to be more specific as to the exact cause, or how you can fix it so it does work.

Again, I sympathize with your frustrations, but I assure you I'm not giving you the run around, nor am I giving you pathetic tasks. The problem you are having seems to lie between the \clarion6\3rdparty\libsrc\netweb folder and the app\web folder of the program you are trying to compile. If you follow the instructions I posted earlier, and report your findings, then I suspect you'll be a lot closer to the solution.

Your note that it's working ok in C8 is helpful. While many, if not most developers are now using C8, there are still a fair few on C6. I'm not having reports from others about this, and given that you've been having the problem since April it's unlikely that none of the C6 users have updated since then (especially given the volume of traffic on this forum - where many users are upgrading to every build.) Indeed we still have one web app compiling in C6, and that has been updated with most every build (including 6.37), on an XP machine, without problems. So I'm reasonably confident it works ok on a basic C6 / XP setup - but of course every machine is different and machine-related (network-related, permission-related) issues can, and do occur.

Cheers
Bruce




useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example
« Reply #26 on: July 12, 2012, 02:48:32 AM »
from the gzipall.bat file there is this line
C:\CLARION6\3rdparty\bin\gzip" -9 -n -f -c web\scripts\all.js        > "web\scripts\all.js.gz
when its run manually the response is
The system cannot find the path specified.

The windows environment variable path is C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Clarion6\BIN;C:\Clarion6\BIN;c:\Clarion6\3rdParty\Bin;


useless

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example
« Reply #27 on: July 12, 2012, 03:09:50 AM »
The other thing I have noticed is the all.js that ships in the C6 installation is 377kb in size the all.js that ships in the C8 installation is 414kb in size.

The C8 414kb all.js and thus the all.js.gz works, the C6 377kb all.js & all.js.gz doesnt work with the C6 webserver.

bruce2

  • Full Member
  • ***
  • Posts: 108
    • View Profile
    • Email
Re: Error in Javascript Web9 SSL Example
« Reply #28 on: July 12, 2012, 05:22:42 AM »
>> from the gzipall.bat file there is this line
>> C:\CLARION6\3rdparty\bin\gzip" -9 -n -f -c web\scripts\all.js        > "web\scripts\all.js.gz
>> when its run manually the response is
>> The system cannot find the path specified.

excellent. You're closing in on the source of your problems. So, it's not finding the path
c:\clarion6\3rdparty\bin
can you please check if that folder exists?
If it does check if there's a gzip.exe in that folder.
Is your Clarion 6 installed into c:\clarion6 in this virtual machine?


>> The windows environment variable path is
yes, that would come into play if I just called Gzip, but because the path to the gzip.exe is fully qualified, that's not going to come into play here.

>> The other thing I have noticed is the all.js that ships in the C6 installation is 377kb in size the all.js that ships in the C8 installation is 414kb in size.

actually, there's no all.js in the installation at all. (if you look in \3rdparty\libsrc\netweb\web\scripts you'll see it's not there.)
All.js is actually built for you by the Gzipall bat file - depending on your specific application.

In Gzipall you'll see a bunch of lines like this;

type web\scripts\modernizr.custom.js            > web\scripts\all.fat.js
type web\scripts\jquery-1.7.2.min.js            >> web\scripts\all.fat.js

the exact lines included here depend on some options in the app, and so there are a lot of possible all.js file sizes that are possible.

which are a way of concatenating all the individual js files together.
that section is followed by
"C:\CLARION6\3rdparty\bin\jsmin" < web\scripts\all.fat.js > web\scripts\all.js
which minifies the concatenated js.
and
"C:\CLARION6\3rdparty\bin\gzip" -9 -n -f -c web\scripts\all.js        > "web\scripts\all.js.gz"
which creates the compressed version.

now if gzip.exe is missing, or jsmin.exe is missing, or the folder(C:\CLARION6\3rdparty\bin) is wrong then obviously these steps will fail.

If the all.js.gz file was completely missing from your web\scripts folder, then actually your app would fall back to all.js, and would probably work just fine. The fact that it's zero length though means that is is served, but contains nothing. This is a problem because the pages need that JavaScript to work.

Bear in mind that the server doesn't "use" the all.js file. The browser does. So from that point of view it's not the clarion version making any difference. Having the 0 length all.js.gz is the problem that's causing the error to appear in the browser - what we're chasing at the moment is why that file is zero length.

Incidentally you can try deleting it before running the GzipAll Bat to see if it is re-created - and if it's recreated as zero length, or with some content. That would be an interesting test. Deleting it completely would also make the app work without the error, but that's fixing the symptom, not the cause - and it'll be much better to isolate the root cause.

Cheers
Bruce