Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3673222
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:42:22+00:00 2026-05-19T02:42:22+00:00

I currently have a bash application that, among other things, uses cURL to upload

  • 0

I currently have a bash application that, among other things, uses cURL to upload a file to a web application with the PUT method. I am attempting to duplicate the web application as the client (bash) portion is GPL but the web portion is not. I also cannot alter the client application as it auto-updates itself from the developers’ website.
I have found multitudes of information on how to handle the HTTP POST method with WSGI, CherryPy, Twisted, and practically every way of having Python scripts working on the WWW. However, I can’t find a single thing about the PUT method. Does anyone know how to process a PUT request with WSGI, or is there some other framework with PUT functionality that I am missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:42:23+00:00Added an answer on May 19, 2026 at 2:42 am

    As I understand it, you will just want to read the stream environ['wsgi.input'], because a PUT request will send the entire contents of the PUT as the body of the request.

    I am not aware of any encoding issues you will have to deal with (other than the fact that it is binary).

    Some time ago, I wrote a simple set of PHP scripts to take and give huge files from another server on a LAN. We started with POST, but quickly ran out of memory on the larger files. So we switched to PUT, where the PHP script could take it’s good time looping through php://input 4096 bytes at a time (or whatever)… It works great.

    Here is the PHP code:

    $f1 = fopen('php://input', 'rb');
    $f2 = fopen($FilePath, 'wb');
    
    while($data = fread($f1, 4096))
    {
        fwrite($f2, $data);
    }
    
    fclose($f1);
    fclose($f2);
    

    From my experience in handling multipart/form-data in WSGI with POST, I have little doubt that you can handle a PUT by just reading the input stream.

    The python code should be like this:

      output = open('/tmp/input', 'wb')
      while True:
        buf = environ['wsgi.input'].read(4096)
        if len(buf) == 0:
          break
        output.write(buf)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bash script that creates a Subversion patch file for the current
I currently have an MS Access application that connects to a PostgreSQL database via
I currently have a functioning in-house Windows Forms application which extensively uses the DataGridView
I currently have heavily multi-threaded server application, and I'm shopping around for a good
I have a small lightweight application that is used as part of a larger
I currently have speakers set up both in my office and in my living
I currently have an existing database and I am using the LINQtoSQL generator tool
We currently have a company email server with Exchange, and a bulk email processing
I currently have a fairly robust server-side validation system in place, but I'm looking
We currently have code like this: Dim xDoc = XDocument.Load(myXMLFilePath) The only way we

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.