Skip to content

bpo-8077 Fix CGI Handling of POST on Windows.#25652

Closed
orsenthil wants to merge 2 commits intopython:mainfrom
orsenthil:issue8077
Closed

bpo-8077 Fix CGI Handling of POST on Windows.#25652
orsenthil wants to merge 2 commits intopython:mainfrom
orsenthil:issue8077

Conversation

@orsenthil
Copy link
Copy Markdown
Member

@orsenthil orsenthil commented Apr 27, 2021

bpo-8077: https://bugs.python.org/issue8077 - Fix CGI Handling of POST on Windows

The first version of patch was submitted by Pierre Quentel.

https://bugs.python.org/issue8077

@orsenthil orsenthil changed the title Fix CGI Handling of POST on Windows. bpo-8077 Fix CGI Handling of POST on Windows. Apr 27, 2021
Comment thread Lib/http/server.py
data = self.rfile.read(nbytes)
if len(data) < nbytes:
import tempfile
rfile = tempfile.TemporaryFile("wb+")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than an actual file, could we use BytesIO or (at worst), mmap here instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. All we care about is reading from socket and temporarily storing to a different file like object (which can support large files). I will try with BytesIO.

Comment thread Lib/http/server.py
data = None
rfile = None

if self.command.lower() == "post" and nbytes > 0:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have windows, so I didn't test even the existing code in Windows. I believe that even the existing code is not going to work on windows due the condition nbytes > 0

nbytes is from Content-Length and I see that https://bugs.python.org/issue24764 Content-Length for multi-part form data was removed.

When I tried to add test, I could not exercise this.

  • Before any change is done, a test case and testing under Windows is required for this Bugfix and Patch.

@orsenthil orsenthil self-assigned this Apr 27, 2021
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2021

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Jun 3, 2021
@kumaraditya303
Copy link
Copy Markdown
Contributor

Closing as cgi is deprecated as per pep 594 https://peps.python.org/pep-0594/#cgi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review DO-NOT-MERGE stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants