NetTalk Central

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - AtoB

Pages: [1] 2
1
Hi all,

I'm receiving utf postdata via nettalk and probably need to convert somewhere in the process as I don't save the international characters correctly, escpecially the euro-sign (although special characters like ??? etc. work fine).

I receive the following (as a json string within quotes), which seem to me like correctly encoded:

"\u00e4\u00e0\u00e2\u00e9\u20ac"

The last one displays as "?" in my screens and should be the euro sign (but the first four get "translated" somehow correctly)

Currently I use following code to load the json (gtSt is effectively a stringtheory object) into my queues

  gtSt.Setvalue(SELF.rP_web.Getvalue('_postdata_'))
 
  json.start()
  json.SetTagCase(jf:CaseAsIs)
  json.Load(element, gtSt) ! Load From a StringTheory object   

Where (and with what method) should I modify this string.

TIA,

Ton

2
I'm currently on NT 12.45 on several sites (used as an API-server), but my most havely used one is crashing a lot the last week. The crashing has been present since I upgraded to 12.45 (came from 9.15) last summer/fall, but not more than once every 6 weeks or so.

Currently traffic is exploding on this site (this always happens this period of the year, sometimes 5-10K requests per hour) and now it crashes 3-5 times a day and I notice that it's always the very same crash report that's generated (see attached GPFReport.txt)

I also attached a screenshot (see attached code.png) of the code (from version 12.45) it seems to point to line 1301 (but I'm not an expert in reading GPF logs ...)

I haven't upgraded to 12.55 as I could not find any fix related to this in de history docs (so to me it looks like more risks only ...)

Also problematic is that the "connectionchecker" (shipped with nettalk) I use doesn't seem to kill the exe most of the times (although it restarts a new instance ... but this new instance conflicts with the old instance).

Are there things I can do to make the connectionchecker work?

If you need additional info, let me know

3
Web Server - Ask For Help / (Nettalk) Webserver security?
« on: January 10, 2023, 02:35:54 PM »
Hi all,

I'm running the latest and greatest Nettalk for an api server (not a webserver, so only json in and out). Site runs secure (port 443 only) and tests as safe in for example ssllabs.com. I've read the nettalk docs on security and apart from Denial of Service attacks I can't see any vulnerabilities. SQL injection is covered (all clarion statements).

Now network folks want to install a fysical firewall (fortigate) and software called MalwareBytes to filter out "bad requests" and limit the requests only to certain ip-addresses (which is max. 25 in this case, but some don't have guaranteed fixed addresses).

Personally I think they are introducing a lot of costs for the client (fortigate) and quite a lot of hassle to keep the ip-addresses up to date (I know that I'm the one getting the first support calls when an ip-number has changed and traffic blocks ...)

But I've no real good arguments against these features. Problem is they don't trust the unknown Nettalk server ...

Does anybody have any insights on this matter or some source of info I can delve into to get me in a more knowledgeable state with regard to webservers and security.

Will a fortigate firewall for example be able to counter DoS attacks (and so be a valuable addition)?

TIA

4
Hi All,

in het NetWebClient.PageReceived method I can parse the HTTP error from the header, but is there a property for this?

5
Web Server - Ask For Help / jFiles : "pretty" JSON?
« on: October 24, 2022, 11:24:24 AM »
Hi all,

I've this json that I receive and I can nicely parse this with jFiles. But sometimes I need the json in "pretty" format (for debugging etc.). Is there an option in JFiles to convert the json to pretty (and back to compact)?

Currently I move the raw data to an external editor and format it there, but maybe jFiles has this feature somewhere in it ...

TIA

6
I've been strugling to get a locally installed wordpress/woocommerce api working. The site is local and I've not been able to get a certificate on the site working (tried several plugins at no avail).

I found out (using Postman) that the woocommerce api needs "https" in the GET in order to work, although the wordpress site is actually insecure. In Postman the GET with https will by default activate ssl, but you can optionally ignore the invalid certificate and so effictively work insecurely.

In Nettalk (NetWebClient, see "netwww.clw") I found out that commenting out the following line (no. 660) in the .fetch method

  if lower(self._CommandURLSt.UrlProtocolOnly()) = 'https' then self.SSL = true.

will do the "trick" for me. Now I the api (at least for GET works).

So can I (via Nettalk) send the text "https" without actually making traffic secure in a clean manner somehow?

Or is there another way to tell netwebclient to ignore the ssl stuff (so effectively disabling SSL certificate verification)?

B.t.w.

If someone knows how to get the local site secure easily, that suggestion is welcome too :)

TIA


7
Web Server - Ask For Help / Multiple instances of an API-server?
« on: April 07, 2021, 04:02:08 AM »
Hi All,

I'm running into several issues with a heavily used api-server (Clarion runtimes/driver not being totally thread safe and I actually need multiple database connections to the database server, while Clarion only allows one per exe). I sometimes use critical sections around my method/endpoints to accomplish what I need and the circumvent the threadsafety issues, but when there is a heavy workload, things are being served sequentially instead of concurrently.

So my plan was to start several instances of the exe/api-server (listening on different ports?) to accomplish this, but I probably need some "router" software to manage traffic.

Does anybody have any experience on this?
Is this a good plan?
Is there any documentation for this in the Nettalk docs?
Where to start looking :-)?

TIA

regards,
Ton

8
Web Server - Ask For Help / StringTheory : MakeGuid not so unique?
« on: April 02, 2021, 05:24:15 AM »
Hi All,

I'm posting this here is I ran into this when working with services in NetTalk. I created a webservice endpoint that needs a GUID for a record-ID and I ran some stress tests on this method. I noticed the backend sometimes gave errors "primary key not unique". Actually restarting the nettalk server several times in a row creates quite a lot of not unique guids.

I've looked at the StringTheory (latest version 3.36) procedure "SeedRandom" (see below) and I think (!) this is maybe where things go wrong. I'm not sure but several things seem strange (but I'm not an expert here ....):

- the "stSeedRandom" calll apparently always takes 0 as an argument (see the self.trace line I added), the clock() and ProcesId seem of no influence ...
- the MouseX/MouseY always return 0 (which maybe is not strange for a nettalk server)
- the seed is "only" determined once (via the static variable), is there a reason for doing this once?

At least the 16 char GUID is not unique enough ...


StringTheory.SeedRandom Procedure()
s1 long,auto
  code
  stSeedRandom(band(clock(),bshift(stGetCurrentProcessId(),24)))  ! process Id's are 16 bit, so we only get the low part of the process ID here
  self.trace('mouseex : ' & mousex() & ' stGetCurrentProcessId() : ' & stGetCurrentProcessId() & ' argument :' & band(clock(),bshift(stGetCurrentProcessId(),24)))
  loop mousex() TIMES         ! take some random calls off the random sequence just to add some more variability
    s1 += Chr(Random(1,100))
  end
  loop mousey() TIMES
    s1 += Chr(Random(1,100))
  end

9
Hi all,

a nettalk 9.15 webserver needs a new certificate and the tech. guy provided me one, but after replacing the old one the server doesn't work any longer. In the browser I get a "SSL_ERROR_NO_CYPHER_OVERLAP" error ...

I'm a little reluctant to upgrade to the latest and greatest (regressions), so really would like to get the certificate to work

Does anybody know what can be wrong here or what should be a next logical step?

Can I check the provided files (.crt and .key) somehow?

I've attached a .log file which indeed indicates something is wrong with SSL ...

TIA

regards,
Ton

10
Web Server - Ask For Help / JFiles : some questions
« on: December 12, 2017, 05:52:09 AM »
Hi Bruce,

I have some questions about jFiles:

- can I override the jFiles class somehow. Currently when I override it, the compiler starts complaining when I use methods that use "JSONClass" in the prototype, I guess I have to override all these method too?

- how can easily override the default properties of the constructor/start method globally. I currently hack the constructor to fill my needs (in jFiles.clw), but that's not the way it should work

- what is "MaxPrefixLengthInJSON" actually used for. Now it only deletes prefixes when the the prefix length is smaller than 4 characters and that gave some unexpected results when importing to a Queue with a prefix that is longer than 4 characters ...

- in the latest release there are tons of calls to .GetFieldName(A) and .AdjustFieldname that slow down considerablly when there is more than 2 records to import. Can this be resolved without hacking the jFiles.clw?

TIA,
Ton

11
Web Server - Ask For Help / JFiles : having troube importing into Queues
« on: December 11, 2017, 09:44:33 AM »
I'm probably not understanding something about JFiles:

I try to import two nodes ("P_docidQ" and "ids" both on the top level) into two queues ("P_docidQ" and "SELF.PrQ"), but the second one always is empty ... (I've attached a .json file as a .txt file)

Now If I don't load the first Q, the second will load ... I found out that the during the load of second Q it tries to map to the fields of the first Q ...

(I noticed that in  jFiles.clw in the JSONClass._GetFieldName method, that the

  names     cstring(50),dim(100),static,thread

might be why the second Q keeps looking at the fields of the first Q ...]


I probably need to clear/free something first, but I haven't got a clue what

Any help is most welcome!

TIA

The follwing is the code I use:

 
Code: [Select]
  ! data
lJSON                             JSONClass
jsonItem                          &JSONClass
lJP                               &JSONClass
lJP_PdocidQ                       &JSONClass
lJP_PrQ                           &JSONClass

  CODE
  ! ....
  lJSON.LoadFile(lFn)

  lJP &= lJSON.GetByName('doctype', 1)
  IF ~lJP &= NULL
    SELF.Doctype       = lJP.GetValue()
  END

  ! First Q
  FREE(P_DocidQ)
  CLEAR(P_DocidQ)

  lJP_PdocidQ &= lJSON.GetByName('P_docidQ', 1)
  IF ~lJP_PdocidQ &= NULL
    lJP_PdocidQ.Load(P_DocidQ)
  END

  ! Second Q
  FREE(SELF.PrQ)
  CLEAR(SELF.PrQ)
       
  lJP_PrQ &= lJSON.GetByName('ids', 1)
  IF ~lJP_PrQ &= NULL
    lJP_PrQ.Load(SELF.PrQ)
  END
  ods('records SELF.PrQ : ' & RECORDS(SELF.PrQ) )

12
Hi All,

I need to features added to my webservices:

1 a method to upload files:
client can send in files, currently one at a time (per request), I validate some key. and place this file in a folder on the server (I don't care where it as long as serving the file is possible via method two)

2 a method to download the most recent uploaded file (via method 1)
From all files updloaded (by method 1) I want the most recent one to be served to the client. So Client simply call GET wsGlobal\MostRecentFile and my application serves this (

File uploading/downloading is only allowed via these methods (client has to provide an api-key, that's the easy part ...), the uploading is not a problem either, I got that covered. But I'm not sure where to store the files (inside the web folder or not) and how to serve (not determine which file it is ...)  a file via a webservice method, without introducing security risks.

- should I store these files inside the "\web" folder? Best not to I guess, because I can't protect folders in there. If someone guesses the foldername and filename they can fetch it with a browser (and without an api-key), right?

- how can I return a file (just as if it was fetched like any other file directly from the \web folder "below" the app) to a http(s) client via a service method. Is this what the "stringtheory" return parameter is used for? Should I "encode" this object first before it is return to the client?

Thanks in advance,
regards,
Ton

13
Web Server - Ask For Help / Certificates part two (hopefully last)
« on: November 29, 2016, 09:36:12 AM »
Hi All,

I thought I try to get the production server working with a certicate (without ever getting test environment correct), but that's working very well either:

- when I fetch "myself" (through "netclient"), I get the following error :
The open command timed out or failed to connect: The error number was -53 which means Open Timeout or Failure error - [WinSock Error = 10061 : (WSAECONNREFUSED) Connection refused. No connection could be made because the target machine actively refused it

- the browse is much less verbose and simply says "cannot connect to  ...."

- I've installed my .crt en .pk files in the "certificates" folder below the webfolder, but I think the nettalk server moves them upwards (so it is able to find these ...). Is this intended?

- whenever I place files in there that don't mach the properties I fill in in the server settings for the .crt en .pk file. I get no errrors on the serverside .... Shouldn't I get one?

- I'm running with the "s_web.SuppressErrorMsg = 0" line generated, but I can't find any errormessages serverside ...

- additional question : I can rename the .crt and .pk file to anything I want to as long as it matches the two corresponding prompts in the webserver setting, right?

What I can I do to find out where things go wrong?

TIA,
Ton

14
Web Server - Ask For Help / UTF encoding in xFiles?
« on: November 29, 2016, 07:27:12 AM »
Hi all,

for my webservices I've written a class to handle JSON and I'm using xFiles to handle the XML output. I noticed that the xFiles produces "other" utf-8 than the json class.

for json I'm using StringTheory.ToUnicode method and I see that xFiles uses code in the ._WriteCurrentField procedure somewhere at the following comment line (around line 3010):

! -- Do UTF-8 Encoding ---

I think the StringTheory .ToUnicode method produces better UTF-8 output, as far as I can tell xFiles doesn't take into account what codepage it's originating from,  but I'm not entirely sure and by all means not an export with regard to encoding ...

Either way : one must be wrong ...

regards,
Ton

15
Web Server - Ask For Help / automatic webserver restart
« on: November 16, 2016, 01:54:04 PM »
Hi all,

I'm having some problems right now: webserver crashes irregulary and I'm intensively looking for the cause.

but meanwhile : is there some way I could automatically restart the webserver, in case of a crash? Currently the webserver is running as a normal exe, but eventually will run as a service

Thanks in advance,
Ton

Pages: [1] 2