ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tclplugin-core
tclplugin-core
RE: [Tclplugin-core] Delay on http posts
by Jeff Hobbs other posts by this author
Apr 27 2005 12:08AM messages near this date
[Tclplugin-core] RE: wiki.tcl.tk question | [Tclplugin-core] [ tclplugin-Bugs-1190367 ] Delayed socket communication while http posts
Please see my notes at:

http://sf.net/tracker/?func=detail&aid=1190367&group_id=13188&atid=113188

I have moved it to Pending Invalid, because based on the example
given, the behavior that I get (using Firefox on XP SP2) is 100%
correct - that is an error.  If you change 'launch' to:

proc launch {} { ::browser::getURL http://www.tcl.tk/ }

I receive no error.

  Jeff Hobbs, The Tcl Guy
  http://www.ActiveState.com/, a division of Sophos

>  -----Original Message-----
>  From: jemarch@[...].org [mailto:jemarch@[...].org] 
>  Sent: April 21, 2005 8:01 AM
>  To: Jeff Hobbs
>  Cc: tclplugin-core@[...].net
>  Subject: RE: [Tclplugin-core] Delay on http posts
>  
>  
>  
>  Hi Jeff.
>  
>      José E. Marchesi wrote:
>      > I am trying to use the url feature with the latest CVS 
>      > tclplugin. Any time i perform a post (using ::browser::getURL or
>      > ::browser::javascript) there is an error from the plugin 
>      > after a delay. 
>      
>      Can you provide a tclet which I can test locally?
>  
>  Of course:
>  
>  
>    policy javascript
>  
>    button .b -text "launch" -command launch
>  
>    proc launch {} {
>  
>        ::browser::getURL {javascript:alert('hola');}
>  
>    }
>  
>    pack .b
>  
>  
>      > But the post launched by the tclet is still on the www 
>      > navigator. When i destroy the navigator window or perform 
>      > another post, the post launched by the tclet is remembered 
>      > and flushed.
>      > 
>      > It that a known bug on the CVS tclplugin? I would be happy 
>      > fixing this bug. I would highly appreciate any hint or 
>      > direction about what could the problem be in order to find 
>      > the convenient place on the sources.
>      
>      I have honestly not made much (any) use of the ::browser::
>      APIs.  It may well be a bug.  It may be new or old.  I can
>      assist you in hunting bugs down, but I'm not 100% sure how
>      that all operates myself.
>  
>  
>  As long as i know:
>  
>  
>  The `browser::getURL' procedure (browser.tcl) checks for 
>  another post to the same URL. If there is one, the procedure 
>  emits an error and exits. If this post is a new one, it calls 
>  the `pnExecute' procedure as in:
>  
>    pnExecute GetURL $slave [list $url]
>  
>  
>  The `pnExecute' procedure (remoted.tcl) then perform a remote 
>  procedure call using the rpi interface:
>  
>    ::rpi::invoke $::plugin::CLIENT [concat [list ::pn$cmd $key] $aList]
>  
>  
>  in this case:
>  
>    ::rpi::invoke ::rpi::I1cli ::pnGetURL tclet1 
>  {javascript:alert('hola');}
>  
>  
>  The rpi invocation function then performs:
>  
>    1) Some initialization.
>  
>    2) Send the data via the `SendMsg' procedure.
>  
>    3) Wait for a specific time, returning with error if the time is
>       exceeded. This use the ::wait::hold procedure.
>  
>  
>  The `SendMsg' procedure writes the passed data into the socket:
>  
>    
>    puts $socket $what
>  
>  
>  in our case, it writes:
>  
>    puts sock15 {E 4 {::pnGetURL tclet1 {javascript:alert('hola');}}}
>  
>  
>  
>  So the remote `pnGetURL' procedure is supposed to be executed 
>  on the remote interpreter.
>  
>  The `pn$api' procedures are generated on `plugmain.tcl' from 
>  a template stored on the `pnAPIbody' variable. The procedures 
>  actually generated that way are `pnGetURL', `pnStatus', 
>  `pnOpenStream', `pnWriteToStream', `pnCloseStream', 
>  `pnPostURL', `pnUserAgent' and `pnApiVersion'. That is: this 
>  procedures implement the API to the NPN procedures. 
>  
>  The template on `pnAPIbody' simply calls the appropiate 
>  `pniAPI' procedure, that is the first one on the call chain 
>  that is coded on the C part of the plugin. 
>  
>  In our case, `pniGetURL' is called. `pniGetURL' is a Tcl-C 
>  interface procedure, defined on the `PnInit' C function 
>  (npCmds.c). It interfaces to the `PnGetURLCmd' function, that 
>  is also defined on `npCmds.c'. 
>  
>  The `PnGetURLCmd' function then calls the actual navigator 
>  NPN function for getting an url, stored on the 
>  `NPNFuncs.geturl' variable (well, it really calls the 
>  `NPN_GetURL', that in turn call `CallNPN_GetURLProc' with 
>  `NPNFuncs.geturl'). 
>  
>  
>  So... ¿where is the delay?. The delay happens on the remote 
>  procedure call. The caller executes `::rpi::invoke', which 
>  correctly writes the message and then enters on the wait. 
>  There is a timeout and an error is signalled. Meanwhile, the 
>  browser has not received the javascript.
>  
>  Then i close the navigator window, or i perform a post with the
>  browser: ¡surprise!, the remote interpreter gets the rpi and 
>  executes it, generating a browser window with "hola!".
>  
>  I think the bug could be on the communication via the socket. 
>  But i am somewhat confused about the specific role of the 
>  "remote" interpreter. Could you please explain why are two 
>  tcl processes running on the plugin, and why one of them is 
>  "remote"? I need the "big picture" :)
>  
>  Sorry about my ignorance, but this is the first time i get 
>  involved on plugin isssues.
>  
>  
>      
>      > The bug arises with the following software configuration (any 
>      > combination of):
>      > 
>      >      Mozilla suite 1.7           Tcl/Tk 8.4.9     
>  Latest CVS tclplugin
>      >      Mozilla firefox 1.x         Tcl/Tk 8.4
>      >      IE 6.x
>      >    
>      >      Both x86 and PowerPC architectures (for that matter).     
>      
>      So I assume this is Linux and Windows?
>  
>  
>  Yes. It happens on GNU/Linux with Mozilla, on MS Windows with 
>  IE 6x, and on MS Windows with Mozilla.
>  
>  
>  
>  Thanks.
>  
>  --
>  José E. Marchesi    <jemarch@[...].org>
>  



-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id5hix
_______________________________________________
Tclplugin-core mailing list
Tclplugin-core@[...].net
https://lists.sourceforge.net/lists/listinfo/tclplugin-core

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved