Skip to content

Redirect (301) after POST re-reads file #9735

@auselen

Description

@auselen

I did this

Some python3 code to imitate the server I was working with

import sys
from http.server import HTTPServer, BaseHTTPRequestHandler
class Redirect(BaseHTTPRequestHandler):
   def do_POST(self):
       post_data = self.rfile.read(1)
       self.send_response(301)
       self.send_header('Location', 'http://no.no')
       self.end_headers()
HTTPServer(("", 9000), Redirect).serve_forever()

$ python3 server.py

$ curl -v -F content=@<(echo hello) -L localhost:9000
...
curl: (65) Cannot rewind mime/post data

I expected the following

Reading https://everything.curl.dev/http/redirects, I wouldn't expect curl to try to rewind my input file (process substitution) when redirect is just a 301 and switches to GET.

curl/libcurl version

I tried with a local build and some prebuilt binary.

curl 7.86.0-DEV, 7.68.0

operating system

.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions