Changeset 250 for Network/CoolWeb/WebServer/UHTTPSessionFile.pas
- Timestamp:
- Jun 13, 2011, 8:00:17 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Network/CoolWeb/WebServer/UHTTPSessionFile.pas
r237 r250 6 6 7 7 uses 8 Classes, SysUtils, UHTTPServer, syncobjs, synacode, UCommon ;8 Classes, SysUtils, UHTTPServer, syncobjs, synacode, UCommon, FileUtil; 9 9 10 10 type … … 37 37 implementation 38 38 39 resourcestring 40 SCantCreateSessionStorageDirectory = 'Can''t create session storage directory.'; 41 39 42 procedure Register; 40 43 begin … … 48 51 begin 49 52 Result := BinToHexString(SHA1(FloatToStr(Now))); 50 while FileExists (Directory + '/'+ Result) do53 while FileExistsUTF8(Directory + DirectorySeparator + Result) do 51 54 Result := BinToHexString(SHA1(FloatToStr(Now))); 52 55 end; … … 71 74 try 72 75 Lock.Acquire; 73 SessionFile := Directory + '/'+ HandlerData.SessionId;74 if FileExists (SessionFile) then76 SessionFile := Directory + DirectorySeparator + HandlerData.SessionId; 77 if FileExistsUTF8(SessionFile) then 75 78 HandlerData.Session.LoadFromFile(SessionFile) 76 79 else HandlerData.SessionId := GetNewSessionId; … … 87 90 try 88 91 Lock.Acquire; 89 SessionFile := Directory + '/'+ HandlerData.SessionId;92 SessionFile := Directory + DirectorySeparator + HandlerData.SessionId; 90 93 ForceDirectories(Directory); 91 if DirectoryExists (Directory) then begin94 if DirectoryExistsUTF8(Directory) then begin 92 95 DeleteFile(SessionFile); 93 96 HandlerData.Session.SaveToFile(SessionFile) 94 end else raise Exception.Create( 'Can''t create session storage directory.');97 end else raise Exception.Create(SCantCreateSessionStorageDirectory); 95 98 96 99 HandlerData.Response.Cookies.Values[SessionIdCookieName] := HandlerData.SessionId;
Note:
See TracChangeset
for help on using the changeset viewer.