Skip to content

CGIHTTPRequestHandler does not work on windows #47383

Closed

Description

@amauryfa
BPO 3133
Nosy @amauryfa
Files
  • httpserver.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2008-06-18.22:20:24.657>
    created_at = <Date 2008-06-18.09:28:31.013>
    labels = ['library', 'OS-windows']
    title = 'CGIHTTPRequestHandler does not work on windows'
    updated_at = <Date 2008-06-18.22:20:24.656>
    user = 'https://github.com/amauryfa'

    bugs.python.org fields:

    activity = <Date 2008-06-18.22:20:24.656>
    actor = 'amaury.forgeotdarc'
    assignee = 'none'
    closed = True
    closed_date = <Date 2008-06-18.22:20:24.657>
    closer = 'amaury.forgeotdarc'
    components = ['Library (Lib)', 'Windows']
    creation = <Date 2008-06-18.09:28:31.013>
    creator = 'amaury.forgeotdarc'
    dependencies = []
    files = ['10651']
    hgrepos = []
    issue_num = 3133
    keywords = ['patch']
    message_count = 3.0
    messages = ['68361', '68362', '68379']
    nosy_count = 1.0
    nosy_names = ['amaury.forgeotdarc']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue3133'
    versions = ['Python 3.0']

    Activity

    1. amauryfa commented on Jun 18, 2008

      @amauryfa
      ContributorAuthor

      On windows, test_httpservers fails with the error:

      File "C:\python\py3k\Lib\http\server.py", line 1104, in run_cgi
      exec(open(scriptfile).read(), {"__name__": "__main__"})
      File "<string>", line 3, in <module>
      File "C:\python\py3k\Lib\socket.py", line 222, in write
      return self._sock.send(b)
      TypeError: send() argument 1 must be bytes or read-only buffer, not str

      There are two problems there:

      • Lib/http/server.py still looks for os.popen2 or os.popen3 to start a
        subprocess; these functions have been removed, this code should be
        rewritten using the subprocess module.
      • the fallback method, which exec() the cgi script in the python
        interpreter, fails because sys.stdout should be set to a TextIOWrapper,
        not a binary socket file.

      Certainly the fallback method could be removed: every platform
      implements subprocess nowadays.

    2. amauryfa commented on Jun 18, 2008

      @amauryfa
      ContributorAuthor

      The attached patch uses subprocess when fork is not available.
      test_httpservers now passes on windows

    3. amauryfa commented on Jun 18, 2008

      @amauryfa
      ContributorAuthor

      Committed change r64389.

    4. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      OS-windowsstdlibStandard Library Python modules in the Lib/ directory

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions