Ignore:
Timestamp:
Jun 13, 2011, 8:00:17 AM (13 years ago)
Author:
george
Message:
  • Modified: Unit UCommon in CoolWeb package used form package Common as dependency.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Network/CoolWeb/WebServer/UHTTPSessionFile.pas

    r237 r250  
    66
    77uses
    8   Classes, SysUtils, UHTTPServer, syncobjs, synacode, UCommon;
     8  Classes, SysUtils, UHTTPServer, syncobjs, synacode, UCommon, FileUtil;
    99
    1010type
     
    3737implementation
    3838
     39resourcestring
     40  SCantCreateSessionStorageDirectory = 'Can''t create session storage directory.';
     41
    3942procedure Register;
    4043begin
     
    4851begin
    4952  Result := BinToHexString(SHA1(FloatToStr(Now)));
    50   while FileExists(Directory + '/' + Result) do
     53  while FileExistsUTF8(Directory + DirectorySeparator + Result) do
    5154    Result := BinToHexString(SHA1(FloatToStr(Now)));
    5255end;
     
    7174  try
    7275    Lock.Acquire;
    73     SessionFile := Directory + '/' + HandlerData.SessionId;
    74     if FileExists(SessionFile) then
     76    SessionFile := Directory + DirectorySeparator + HandlerData.SessionId;
     77    if FileExistsUTF8(SessionFile) then
    7578      HandlerData.Session.LoadFromFile(SessionFile)
    7679      else HandlerData.SessionId := GetNewSessionId;
     
    8790  try
    8891    Lock.Acquire;
    89     SessionFile := Directory + '/' + HandlerData.SessionId;
     92    SessionFile := Directory + DirectorySeparator + HandlerData.SessionId;
    9093    ForceDirectories(Directory);
    91     if DirectoryExists(Directory) then begin
     94    if DirectoryExistsUTF8(Directory) then begin
    9295      DeleteFile(SessionFile);
    9396      HandlerData.Session.SaveToFile(SessionFile)
    94     end else raise Exception.Create('Can''t create session storage directory.');
     97    end else raise Exception.Create(SCantCreateSessionStorageDirectory);
    9598
    9699    HandlerData.Response.Cookies.Values[SessionIdCookieName] := HandlerData.SessionId;
Note: See TracChangeset for help on using the changeset viewer.