BUG: CGI.Session on Windows

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default BUG: CGI.Session on Windows

    If a newbie tries to get CGI Sessions working, he will run in the
    following bug. No code example that i have seen so far starts with supplying
    the temporary diectory as an option.

    s = CGI::Session.new(cgi,{"tmpdir" => "z:/temp/", "session_path" => "/"})

    And if a user does not do this it will result in an error because the
    default in "session.rb:105" is

    "dir = option['tmpdir'] || ENV['TMP'] || '/tmp'"

    '/tmp' is not valid under windows and normally (standart
    configuration) CGI's don't get the environment variables from the
    system. So could we change this into

    "dir = option['tmpdir'] || ENV['TMP'] || Dir::temp_directory

    and add a "temp_directory" method to the Dir class that returns '/tmp'
    or on windows the value of the "GetTempPath" function.

    I would highly recommand this change. It makes the newbies life much
    easier.

    BTW is there any public bug tracking system where i can add such
    requests.



    Lothar Scholz Guest

  2. Similar Questions and Discussions

    1. #25551 [Opn->Bgs]: Session data loss when accessing session from multiple windows.
      ID: 25551 Updated by: sniper@php.net Reported By: brett at realestate-school dot com -Status: Open +Status: ...
    2. #25551 [Bgs->Opn]: Session data loss when accessing session from multiple windows.
      ID: 25551 User updated by: brett at realestate-school dot com Reported By: brett at realestate-school dot com -Status: ...
    3. #25551 [NEW]: Session data loss when accessing session from multiple windows.
      From: brett at realestate-school dot com Operating system: Linux - Red Hat PHP version: 4.3.1 PHP Bug Type: Session related...
    4. Windows 2000 IIS Session restricted?!
      Session("UID") = 10 Session("Name") = "John Doe" I have an ASP application loaded on a Win2k SP3 server in Anonymous Authentication Mode. When I...
    5. session across satelite windows
      Hi again. I am having a problem with session variables spanning over different windows. What I am doing is to supply links in an admin...
  3. #2

    Default Re: BUG: CGI.Session on Windows


    > In message "BUG: CGI.Session on Windows"
    > on 03/07/20, Lothar Scholz <mailinglists@scriptolutions.com> writes:
    >
    > |'/tmp' is not valid under windows and normally (standart
    > |configuration) CGI's don't get the environment variables from the
    > |system. So could we change this into
    > |
    > |"dir = option['tmpdir'] || ENV['TMP'] || Dir::temp_directory
    > |
    > |and add a "temp_directory" method to the Dir class that returns '/tmp'
    > |or on windows the value of the "GetTempPath" function.
    > |
    > |I would highly recommand this change. It makes the newbies life much
    > |easier.
    >
    > Interesting idea. We have same problem for tempfile library. Maybe
    > it can be defined by Ruby library. I think GetTempPath can be
    > accessed via Win32API, right?
    >
    > matz.
    >


    require "Win32API"
    MAX_PATH = 260

    def temp_path
    t_path = ' '*(MAX_PATH+1)
    t_path[0, Win32API.new('kernel32', 'GetTempPath', 'LP', 'L').call(t_path.size, t_path)]
    end

    puts temp_path

    # -> C:\TEMP\


    ## Remarks (from Win32 help)

    ## The GetTempPath function gets the temporary file path as follows:

    ## 1. The path specified by the TMP environment variable.
    ## 2. The path specified by the TEMP environment variable, if TMP is not defined.
    ## 3. The current directory, if both TMP and TEMP are not defined.


    daz



    daz Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139