Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it legal to have multiple HTTP GET parameters with the name?

Is it "legal", according to the HTTP protocol, to make an HTTP GET request that contains multiple parameters with the same name?

For example /controller?name=John&name=Patrick&name=Jack

I'm sure different clients and servers react differently, however I am asking best practices, for example if you were to write a new server from scratch, or a new browser, client or whatever code that writes or parses HTTP requests: how should you handle such requests?

Is it allowed? In which case what is the interpretation?

Or is it non-standard?

Same question for POST applies.

like image 554
Nathan H Avatar asked Dec 21 '25 04:12

Nathan H


2 Answers

From HTTP's point of view, it doesn't matter - it doesn't put /any/ restrictions on what is in the query part of a an HTTP URI.

like image 114
Julian Reschke Avatar answered Dec 23 '25 19:12

Julian Reschke


Yes, this is perfectly legal, and there are many systems that take advantage of this. Interpretation is up to the server and server-side code.

like image 23
Brad Avatar answered Dec 23 '25 19:12

Brad