Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
496 views
in Technique[技术] by (71.8m points)

httpwebrequest - Sending POST data with GET request valid?

Using Curl for example, I can "post" data in a GET request. Is this a valid thing to do? With that I mean:

  • Is it not forbidden by any RFC specification?
  • Does someone out there use it with good reason?

Thanks for any help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

See RFC2616 - Hypertext Transfer Protocol -- HTTP/1.1, section 4.3 "Message Body":

A message-body MUST NOT be included in a request if the specification of the request method (section 5.1.1) does not allow sending an entity-body in requests.

In section 9.3 "GET" including an entity-body is not forbidden.

So, yes, you are allowed to send an entity-body with a HTTP GET request.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...