Bug Reports
2 wwprocess.prg bugs
Gravatar is a globally recognized avatar based on your email address. 2 wwprocess.prg bugs
  Kuzma Karbachinskiy
  All
  Jun 21, 2018 @ 02:20pm

Hi

I do update web connection 3.0 to web connection 6.20; Please look into wwProcess.Init() and wwprocess.InitSession(lcSessionCookieName, lnTimeout, llPersist) methods. I found it 06/19/18, checked it from different points. It was marked with 06/19/18 KK.

*********************************************************************
FUNCTION Init(loServer)
***********************
#IF .F.
*:Help Documentation
*:Topic:
wwProcess::Init

*:Description:
Construction of the wwProcess object. Main purpose is to Set up
the Response object for the appropriate messaging type
(File, COM, ASP).

*:ENDHELP
#ENDIF
*********************************************************************
LOCAL lcOutFile, lcHTMLClass
PRIVATE Response, Request, Server, Process

THIS.oServer = loServer
THIS.oRequest = loServer.oRequest

*** Do here so Process and Response have access to Request object 
*** for various helper functions like Request Id assignment
*** Note: The real assignment of these for call stack
***       visibility occurs in the Process() method
Request = this.oRequest
Server = this.oServer
Process = THIS
Response = null

DO CASE 
CASE loServer.lASPObject
	lcHTMLClass=[WWC_RESPONSEASP]
    *** ASP Response object as second parm (not a file!)
	lcOutFile = THIS.oServer.oASPScriptingContext.Response()
CASE loServer.lComObject
	lcHTMLClass=[WWC_RESPONSESTRING]
OTHERWISE
   *** File based
	lcHTMLClass=[WWC_RESPONSEFILE]

	lcOutFile=THIS.oRequest.GetOutputFile()
	IF EMPTY(lcOutFile) 
	   RETURN .F.
	ENDIF
ENDCASE

*** Create the 'worker' Response class
IF !EMPTY(this.cResponseClass)
   THIS.oResponse = CREATEOBJECT(this.cResponseClass)
ELSE
*!*	   THIS.oResponse = CREATEOBJECT(lcHtmlClass) && 06/19/18 KK
   THIS.oResponse = CREATEOBJECT(lcHtmlClass,lcOutFile)
  IF loServer.lASPObject
	 THIS.oResponse.lASPObject = .T.
  ENDIF
ENDIF   

Response = this.oResponse

*** Try to retrieve the Url Base path used for 
this.GetUrlBasePath()

ENDFUNC
* EOF wwProcess::Init
*************************************************************
*********************************************************************
FUNCTION InitSession(lcSessionCookieName, lnTimeout, llPersist)
*********************************************************************
#IF .F.
*:Help Documentation
*:Topic:
wwProcess::InitSession

*:Description:
This method creates an automatic session for a user visiting a site and
keeps the user attached to this session while browsing around your site.
Sessions are great to track people through your site for things like
shopping carts that require you to keep info about the user handy.

This method creates a session for the current process automatically. It
uses the wwSession object to create a transparent session that
automatically manages the cookie checks and assignments.

*:ENDHELP
#ENDIF
*********************************************************************
LOCAL lcSessionId

*** we can only setup the session exactly once! All
*** other accesses are simply aborted.
IF !ISNULL(THIS.oSession) 
   RETURN THIS.oSession.oData.SessionID
ENDIF
   
IF EMPTY(lcSessionCookieName)
  lcSessionCookieName =  THIS.cSessionKey
ENDIF  
this.cSessionKey = lcSessionCookieName
 
lcSessionId = THIS.oRequest.GetCookie(lcSessionCookieName)

*** Deal with SQL class here...
#IF WWC_USE_SQL_SYSTEMFILES
   IF ISNULL(THIS.oSession )
      THIS.oSession=CREATE([WWC_SQLSESSION])
   ENDIF   
   
   *** Use shared Sql Connections
   THIS.oSession.oSQL = THIS.oServer.oSQL
#ELSE   
   IF ISNULL(THIS.oSession )
      THIS.oSession=CREATE([WWC_SESSION])
   ENDIF
   IF TYPE("this.oServer.oConfig") = "O"
      this.oSession.cDataPath = ADDBS(this.oServer.oConfig.cSystemFilesDataPath)
   ENDIF
#ENDIF

*** Set timeout
IF !EMPTY(lnTimeout)
   THIS.oSession.nSessionTimeout = lnTimeout
ENDIF

*** Check for Session or create a new one
IF !THIS.oSession.IsValidSession(lcSessionId, llPersist)
   *** Also log the browser and RemoteAddress - assign oRequest property
   THIS.oSession.oRequest=THIS.oRequest    

   *** Nope create it - 
   *** optionally use existing sessionid retrieved from cookie 
   *** to allow persistant user session ids
   lcSessionId=THIS.oSession.NewSession( ,IIF(llPersist,lcSessionId,"") )  
   
   *** Web Control Page
   *** Force HTML object to add the Cookie in Header creation
*!*	   this.oResponse.AddCookie(lcSessionCookieName,lcSessionId,"/",;
*!*	                            IIF(llPersist,"NEVER",""),"",.T.)  && 06/19/18 KK
	this.oResponse.AddCookie(lcSessionCookieName,lcSessionId,"/",;
                            IIF(llPersist,"NEVER",""))
ENDIF

*** Update PRIVATE Session var if it previously exists
Session = this.oSession

RETURN lcSessionId

Thank you, Kuzma Karbachinskiy kkarbachinskiy@oneworldonestop.com

Gravatar is a globally recognized avatar based on your email address. re: 2 wwprocess.prg bugs
  Tore Bleken
  Kuzma Karbachinskiy
  Jun 21, 2018 @ 06:10pm

What do you mean i wrong in the code?

Gravatar is a globally recognized avatar based on your email address. re: 2 wwprocess.prg bugs
  Kuzma Karbachinskiy
  Tore Bleken
  Jun 21, 2018 @ 07:09pm

Sorry,

I couldn't run in all possible directions. I did VFP file mode and couldn't get Response and Session, investigated it as deep as I could and in corrected code I have Response and Session. Sorry again.

Thank you, Kuzma Karbachinskiy kkarbachinskiy@oneworldonestop.com

Gravatar is a globally recognized avatar based on your email address. re: 2 wwprocess.prg bugs
  Rick Strahl
  Kuzma Karbachinskiy
  Jun 21, 2018 @ 07:40pm

Kuzma,

Maybe take a little time before you post questions here. This whole thread is completely useless - there's no info on what actually didn't work for you and you're posting a huge chunk of code with no indication what actually went wrong or even a pointer in the code.

I'm glad you figured it out, but please if you post a bug report:

  • State clearly what doesn't work
  • Show a short code example
  • Provide a repro case
  • Explain what's happening not just it doesn't work

We're not here to do your debug work for you, but we're happy to help if you have a productive question with enough information so we can actually help you.

+++ Rick ---

© 1996-2024