The cookie name now depends on the application name, so that you can run different applications on the same server.
[GB.WEB.GUI] * BUG: The cookie name now depends on the application name, so that you can run different applications on the same server.
This commit is contained in:
parent
a82b8b65b9
commit
7f16b68f0e
2 changed files with 40 additions and 21 deletions
|
@ -9,14 +9,14 @@ Property Timeout As Float
|
|||
Property Prefix As String
|
||||
Property Unique As Boolean
|
||||
Property Modified As Boolean
|
||||
Property CookiePath As String
|
||||
Property CookiePath As String Use $sCookiePath
|
||||
Property CookieName As String Use $sCookieName
|
||||
Property Read Keys As String[]
|
||||
Property Read Size As Long
|
||||
Property Read Path As String
|
||||
|
||||
Property User As String
|
||||
|
||||
Private $sCookiePath As String
|
||||
Private $sCookie As String
|
||||
Private $fTimeout As Float = 300
|
||||
Private $sUser As String
|
||||
|
@ -63,9 +63,16 @@ Private Sub GetCookiePath() As String
|
|||
|
||||
End
|
||||
|
||||
Private Sub GetCookieName() As String
|
||||
|
||||
If $sCookieName Then Return $sCookieName
|
||||
Return "GBSESSIONID"
|
||||
|
||||
End
|
||||
|
||||
Public Sub _SendCookie()
|
||||
|
||||
Response.SetCookie("GBSESSIONID", $sCookie, "", GetCookiePath(),, True)
|
||||
Response.SetCookie(GetCookieName(), $sCookie, "", GetCookiePath(),, True)
|
||||
|
||||
End
|
||||
|
||||
|
@ -83,7 +90,7 @@ End
|
|||
|
||||
Public Sub Abandon()
|
||||
|
||||
Response.RemoveCookie("GBSESSIONID", $sCookie, "", GetCookiePath())
|
||||
Response.RemoveCookie(GetCookieName(), $sCookie, "", GetCookiePath())
|
||||
$sCookie = ""
|
||||
$cData.Clear
|
||||
|
||||
|
@ -172,19 +179,6 @@ Private Sub Modified_Write((Value) As Boolean)
|
|||
|
||||
End
|
||||
|
||||
Private Function CookiePath_Read() As String
|
||||
|
||||
Return $sCookiePath
|
||||
|
||||
End
|
||||
|
||||
Private Sub CookiePath_Write(Value As String)
|
||||
|
||||
$sCookiePath = Value
|
||||
|
||||
End
|
||||
|
||||
|
||||
Private Function Keys_Read() As String[]
|
||||
|
||||
'Return $hManager.GetKeys()
|
||||
|
@ -225,3 +219,9 @@ Private Sub User_Write(Value As String)
|
|||
$sUser = Value
|
||||
|
||||
End
|
||||
|
||||
Private Sub CookieName_Read() As String
|
||||
|
||||
Return GetCookieName()
|
||||
|
||||
End
|
||||
|
|
|
@ -169,7 +169,7 @@ Static Private Sub Upload(sKey As String) As Boolean
|
|||
|
||||
sTarget = Upload.Path &/ sKey
|
||||
|
||||
If Not Request.Cookies["GBSESSIONID"] Or If Not Exist(sTarget) Then
|
||||
If Not Request.Cookies[Session.CookieName] Or If Not Exist(sTarget) Then
|
||||
PrintLog("UPLOAD DOES NOT EXIST")
|
||||
Response.Status = "404 Not Found"
|
||||
Response.Begin
|
||||
|
@ -201,6 +201,23 @@ Catch
|
|||
|
||||
End
|
||||
|
||||
Static Private Sub GetCookieName() As String
|
||||
|
||||
Dim sApp As String
|
||||
Dim I As Integer
|
||||
Dim sCookie As String
|
||||
|
||||
sApp = Application.Name
|
||||
|
||||
For I = 1 To Len(sApp)
|
||||
sCookie &= Hex$(Asc(sApp, I))
|
||||
Next
|
||||
|
||||
Return "GBSESSIONID-" & UCase(sCookie)
|
||||
|
||||
End
|
||||
|
||||
|
||||
Static Public Sub Main()
|
||||
|
||||
Dim hProcess As Process
|
||||
|
@ -216,6 +233,7 @@ Static Public Sub Main()
|
|||
Dim iPid As Integer
|
||||
Dim sExec As String
|
||||
|
||||
Session.CookieName = GetCookieName()
|
||||
sTemp = Session.Path
|
||||
|
||||
' Beware that a CGI script receives the Request query in its first argument as soon as there is no "=" character in it!
|
||||
|
@ -243,9 +261,9 @@ Static Public Sub Main()
|
|||
$hTimeout.Delay = Session.Timeout * 1000
|
||||
$hTimeout.Start
|
||||
|
||||
PrintLog("Create session file")
|
||||
Try Kill sTemp &/ Session.Id
|
||||
Link "/proc" &/ CStr(Application.Id) To sTemp &/ Session.Id
|
||||
PrintLog("Create session file: " & sTemp &/ Session.Id)
|
||||
|
||||
PrintLog("Waiting for SIGUSR1")
|
||||
Return
|
||||
|
@ -323,7 +341,7 @@ Static Public Sub Main()
|
|||
|
||||
PrintLog("================ NEW REQUEST: " & Application.Request)
|
||||
|
||||
sCookie = Request.Cookies["GBSESSIONID"]
|
||||
sCookie = Request.Cookies[Session.CookieName]
|
||||
PrintLog("COOKIE = " & If(sCookie, sCookie, "<none>"))
|
||||
|
||||
If sCookie Then
|
||||
|
@ -364,7 +382,7 @@ Static Public Sub Main()
|
|||
sExec = Application.Path &/ File.Name(Args[0])
|
||||
|
||||
If Not Exist(sExec) Then
|
||||
If Class.IsLoaded("Debug") Then
|
||||
If Class.IsLoaded("Debug") And If Debug.Fifo Then
|
||||
PrintLog("---------------- EXEC gbx3 -g -f " & Debug.Fifo & " " & Application.Path & " -- " & Application.Handle & " " & sCookie)
|
||||
hProcess = Exec ["gbx3", "-g", "-f", Debug.Fifo, Application.Path, "--", Application.Handle, sCookie] Wait
|
||||
Else
|
||||
|
@ -376,6 +394,7 @@ Static Public Sub Main()
|
|||
hProcess = Exec [sExec, Application.Handle, sCookie] Wait
|
||||
Endif
|
||||
|
||||
PrintLog("Waiting for: " & sTemp &/ sCookie & "...")
|
||||
While Not Exist(sTemp &/ sCookie, True)
|
||||
Sleep 0.05
|
||||
Wend
|
||||
|
|
Loading…
Reference in a new issue