Skip to content

Multiple location headers allowed #19130

@jstasiak

Description

@jstasiak

I did this

I fetched a URL where the server responded with multiple location headers.

I expected the following

I expected curl to reject a response with multiple location headers and (when used with -L) not to follow any redirects.

This is a soft bug report (I'm leaning towards considering it a bug but it's not exactly obvious and reasonable people may disagree).

13 years ago a patch was added to ignore location headers other than the first one[1].

I just bumped into this subject a few days ago and did some digging, the browsers I tried so far (Firefox, Safari, Brave) reject HTTP responses with multiple location headers.

It feels to me this unnecessarily creates an opportunity for mistakes to happen (one piece of software picks one location header, another picks a different one, there can even be some security consequences associated with that) so I thought I'd raise this topic.

[1] dbcaa00 ("HTTP: memory leak on multiple Location:")

curl/libcurl version

curl 8.16.0
also the current master branch

operating system

N/A

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions