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.


Messages - patrick de laet

Pages: [1] 2 3
1
Web Server - Ask For Help / How to get the complete HTTP data stream?
« on: October 14, 2015, 02:46:48 AM »
(Using NetTalk 5,45 (sorry  :-[ ) is used in an old Clarion 6.3 app.)

A JSON string is passed to my NetWebpage procedure.

JSON request:

{
"Login": "xxxx",
"Password": "yyyy",
"FiliaalID": "3"
}


How do I get the JSON string?

The following does the job for an XML string:
    pweb:DataJson         = p_web.GetValue('xml')

But how to I get the JSON string?

And if not possible in 5.45, how do I get the complete HTTP stream (headers and data)?

regards

Patrick De Laet



2
(NetTalk 6 - handcoded NetWebPage procedure)

I have to return a SOAP WSDL definition to everyone who requests www.xxxxx.com?wsdl.

How do I test in my netWebpage for the presence of the ?wsdl parameter?

I tried ...

    If p_web.IfExistsValue('wsdl')
        message('yes')
    Else
        message('no')
    End      

But it doesn't work for www.xxxxx.com?wsdl

It does work for www.xxxxx.com?wsdl=1

but this is not an option.

(and going to NetTalk 8 is also not an option, because my program is still in C6)
(and going to C9 is not an option, because I don't have the time for the moment :-) )

regards

patrick de laet



3
In a WebSource procedure, I assign some value to a v:PDL variable.
(not a SESSION variable, just an ordinary, short living variable).
After this, I include some HTML with the net:f include file directive and terminate my WebSource procedure.


p_web.SetValue('PDL', 'test')

 _('<!-- Net:f:/htm/navbar.htm -->')
 _('<!-- Net:f:/htm/logon.htm -->')

RETURN ! terminates my WebSource procedure

PS: the underscore is a home written procedure and just a shortcut for a Do SendPacket.
It keeps the html that I send to the browser clean and readable in my source code.

In my logon.htm I display the v.PDL variable as follows...

<!-- Net:v:PDL -->

It does display the correct contents of my PDL variable, but am I just lucky that my calling NetwebSource hasn't terminate in the meantime and my v:PDL variable is still valid?

Or remains my NetwebSource in memory until my complete page is send to the browser?

regards

Patrick De Laet


PS: the underscore procedure ...

_    Procedure(prmString)

  Code

    packet = clip(packet) & '<13,10>' & prmString

    Do SendPacket

!---
!---
!---
    Return




4
Web Server - Ask For Help / A SendPacket for every line: is this OK?
« on: March 18, 2012, 11:24:28 AM »
Bruce,

In order to make my source a little bit readable, I created a procedure (named _ yes, underscore). Just like the "echo()" in PHP.
Why underscore? It is less "polution" in my source and makes the HTML very readable.

To send some HTML, I have the following in my source:

_('<OL>')
    _('<LI>This line one</LI>')
    _('<LI>This line two</LI>')
    _('<LI>This line three</LI>')
_('</OL>')

The procedure is as follows:
_    Procedure(prmString)
  Code
    packet = clip(packet) & '<13,10>' & prmString
    Do SendPacket
    Return

Is this good practice?
Or does frequently calling the "Do SendPacket" generates extra overhead?

regards

Patrick De Laet


5
(Using NetTalk 5.45)
I load a Javascript file via the normal <script tag in the HEAD of my page.
I'd like to replace some variables in my Javascript.
eg: to specify the open tab in my JQuery accordion.
But, apparently, my <!-- Net:v:xxxx --> tags are not parsed for my Javascript files.
Anybody an idea how to do this?

regards

Patrick De Laet


<!-- NetWebServer -->

var jQueryAccordion1Opts = {
   active: <!-- Net:v:level3 -->,
   autoHeight:   true,
   clearStyle: false,
   event: 'click',
   animated: 'slide',
   header: 'h3',
   fillSpace: false,
   navigation: false
};

6
Web Server - Ask For Help / Re: Who is Bruce2?
« on: January 07, 2012, 11:30:47 AM »
His brain is to big for 1 person.

regards

Patrick

7
(Nettalk 5.45.)
I have problems with French characters (like "bébé" or "garçon").
A GET of a normal HTML page works OK.
But my Ajax calls translate the é, ç, ... to some weird characters.
When I change NetWeb.clw as follows, it works.
But of course, I don't want to change the NetWeb.clw source.
I tried several overrides in several embeds (eg CreateHeader, ParseHTML, ...), no result.

Anybody an idea.

ParseHTML

  If self.RequestAjax = 1
    self.ReplyContentType = 'text/xml; charset=iso-8859-1'
    ! this was the original ==> - self.ReplyContentType = 'text/xml'
  end

regards

Patrick De Laet

8
Bruce,

I changed the SetCookie method as you explained and everything works now.
I can land via Google on 1 of my 10000 SEO friendly pages and my Ajax calls are working !
There is only 1 SESSIONID cookie created with path=/

have a nice day.

regards

Patrick

9
Thanks Bruce,

I'll give it a try.

regards

Patrick De Laet

10
Another problem with Cookies.
I use a lot of AJAX POSTs.
In the ProcessRequest method, it is stated that AJAX needs a Cookie . . .
  ! Ajax requests must have a session ID set in a cookie, otherwise nothing is returned
  ! This is to prevent Javascript hacking as per http://www.fortifysoftware.com/advisory.jsp
  ! NOTE: NetTalk uses Rico which is not vunerable to Javascript Hacking, but
  If self.RequestAjax = 1 and self.SessionID = 0
    ! ignore ajax requests that do not include a SessionID in the cookie.
    return
  End


However, according to Wikepedia, Cookies are only be sent back to the server for the given domain and path.

When I enter my site via www.xprodin.be - a Cookie is created with path=/.
However, as I have 10000 SEO friendly pages (eg: www.xprodin.be/ladies/trousers/product1) Google has picked them up very nicely.
When I do a search in Google for "xprodin ladies trousers" it shows my page.
However, clicking to the Google URL for my page, brings me directly to www.xprodin.be/ladies/trousers/product1.
As this is the first visit to www.xprodin.be, a SetCookie is done for my new SESSIONID, BUT IN THE PATH=/ladies/trousers/.
That's why I have 5,6,7, ... SESSIONID Cookies.

However, when I go to my order page, www.xprodin.be/order and start an AJAX order request; my SESSIONID is not send to the server because of a different Cookie path.
No Cookie ==> AJAX does nothing. So my shopping cart doesn't work.
When I enter my site via www.xprodin.be - a cookie is created in the Path=/ - the same path as my order page ==> hence the SESSION ID cookie is send with the AJAX call and everything works.

My question: who is adding the page=/xxx/yyy stuff when creating my SESSIONID cookie? If all of my 10000 pages created a single cookie with path=/ - this would solve my problem.
But I can't find where to change this.

Maybe this behaviour has to do with my previous thread where SetCookie has 7 parameters in the prototype but use 8 parameters in the code?

regards

Patrick De Laet


11
Bruce,

SetCookie method in nethttp.clw is testing 8 parameters but there are online 7 in the prototype.
eg:isn't the p_Path the 6th parameter and not the 7th?
Maybe this is causing the creation of x cookies - one  cookie for every path combination (see my previous thread)

  If not omitted(7)!(p_Path)
    self._CookieQueue.Path = p_path
  end

I have NetTalk 5.45 - as indicated in the templates - but in nethttp.clw I see 5.44?

! NetTalk v5.44 - the premier TCP/IP solution. Copyright © 2000-2011 CapeSoft Software - www.capesoft.com
NetWebHttp.SetCookie  PROCEDURE (String p_name,String p_Value,<Long p_Date>,<Long p_Time>,<Long p_Secure>,<String p_Path>,<String p_Domain>)
  Code
  If p_name = '' then return.
  clear(self._CookieQueue)
  self._CookieQueue.Name = Upper(p_name)
  get(self._CookieQueue,self._CookieQueue.Name)
  if Errorcode()
    Add(self._CookieQueue)
  End
  self._CookieQueue.Value = p_Value
  If not omitted(4)!(p_Date)
    self._CookieQueue.ExpiresDate = p_date
  end
  If not omitted(5)!(p_Time)
    self._CookieQueue.ExpiresTime = p_time
  end
  If not omitted(6)!(p_Secure)
    self._CookieQueue.Secure = p_secure
  end
  If not omitted(7)!(p_Path)
    self._CookieQueue.Path = p_path
  end
 
If not omitted( 8 )!(p_Domain)
    self._CookieQueue.Domain = p_domain
  end
  put(self._CookieQueue)

regards

Patrick De Laet

12
Bruce,

I've prepared a zip file for you: www.shopplus.be/$bruce.zip

It contains:
1. the example web1.app - i didn't change anything in it - I just use it to display my static page http://localhost:88/nl/vragen2.html
2. a 'web' folder containing my static HTML page and some subfolders for the css, js, assets, ...
3. some screenshots showing the duplicate SESSIONID cookies

To test:
1. delete all your cookies from Firefox
2. display my http://localhost:88/nl/vragen2.html page
3. view your cookies in Firefox - you will have duplicate SESSIONIDS
4. if not - hit F5 to refresh
5. view your cookies in Firefox - you will have duplicate SESSIONIDS
6. if not ==> I'm crazy  :o

regards

Patrick De Laet



13
My original thread is no longer readable??
I receive an empty page?

regards

Patrick De Laet

14
Bruce,

You can download a zip file here: www.shopplus.be/$bruce.zip

It contains:
1. the example web1.app - I didn't modify anything in it - I just use it to show my static HTML page.
2. a "web" folder with the html page and some subdirs for the css, scripts,assets, ..
3. 2 screenshots showing the duplicate SESSIONID cookies in Firefox.

To test:
1. delete all your cookies from Firefox
2. display the page http://localhost:88/nl/vragen2.html
3. display your cookies from Firefox
4. if not duplicates, hit a few times F5 (refresh)
5. display your cookies from Firefox

regards

Patrick De Laet




15
Bruce,

So I'm guessing that maybe you're calling SetCookie yourself?
>> no, I'm not calling SetCookie myself.

Or - if not - can you duplicate the effect in an example?
>> I'll give it a try, but I've compiled the NetTalk example 1 just to display http://www.xprodin.be/nl/vragen2.html as a static page. And it also creates multiple Cookies.. So - just 1 static page - with example 1 - and I have the problem.

regards

Patrick De Laet

Pages: [1] 2 3