Comments (6)
Yes, we drop the body when building a GET request with libcurl. I did some research on GET with a body this afternoon and I think it is more accurate to say that the HTTP spec does not preclude a body in a GET request, but neither does it specify the semantics for such a thing. I ran across this quote from Roy Fielding while researching the topic:
Server semantics for GET, however, are restricted such that a body,
if any, has no semantic meaning to the request. The requirements
on parsing are separate from the requirements on method semantics.So, yes, you can send a body with GET, and no, it is never useful
to do so.
Given this I am inclined to leave Patron the way it is. I am, however, open to implementing more methods (such as the methods described in the WebDAV spec) if that would be useful.
~p
from patron.
Curl supports GET with body:
curl -X GET localhost:4567/echo -d name=mislav
That means it's supported with libcurl. The only reason why Patron doesn't support it because it explicitly chooses to block it. I don't think that's such a good call because the spec never explicitly says "Thou shalt not send body with GET requests"; it simply leaves this a gray area.
For an example of GET with body in the wild: elasticsearch
$ curl -XGET http://localhost:9200/twitter/_search?pretty=true -d '{
"query" : {
"range" : {
"post_date" : {
"from" : "2009-11-15T13:00:00",
"to" : "2009-11-15T14:30:00"
}
}
}
}'
This is actually a pretty good use case. It queries the search index but uses the body since the query might be too large to fit in a URL. The request is still idempotent and still can be HTTP-cached.
from patron.
I never disputed that libcurl supports GET with a body. I said "we drop the body when building a GET request with libcurl"; in other words Patron ignores the body when creating the request with libcurl. I am clearly aware of the technical issues.
While the spec doesn't explicitly forbid GET requests with a body, as Fielding makes clear the spec does not define server semantics for such a request. Therefore a server that implements some semantics for GET with a body is by definition implementing non-standard behavior. The above example is abusing GET for no clear benefit. If you really need to send a body for something like that use POST. That is what it is there for.
The bottom line is that I have limited time to devote to Patron and I am not going to spend it implementing corner-case features.
from patron.
Well, it's used by Elastic Search and ArchLinux's AUR API. Would you at least accept a patch?
from patron.
I already have: 4eaaf3e
from patron.
Thanks!
from patron.
Related Issues (20)
- Release 0.8 HOT 1
- Automate the Patron release process HOT 5
- Idea: Connection pooling using curl_multi HOT 4
- Add streaming upload/download support HOT 1
- Release new version HOT 2
- The Hive copyright comment HOT 1
- Respond to signals when outside the GIL HOT 3
- Headers aren't parsed correctly for first request when connection is proxied HOT 1
- Redirect handling inconsistency HOT 3
- VCR issues after upgrading patron 0.10.0 -> 0.11.1 HOT 6
- RFC: Streaming response bodies HOT 8
- PATCH method doesn't send body HOT 4
- Gem not installed to ruby 2.1.2 HOT 1
- how to set ssl client_key / client_cert ? HOT 6
- Request: Render full server response as a string HOT 1
- Figure out the actual set of supported HTTP verbs
- --http1.1 option please HOT 1
- "checking for ruby/thread.h... *** extconf.rb failed ***" when installing on google/cloud-sdk:alpine docker image HOT 1
- one rspec test fails on Arch Linux
- Basic Auth HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from patron.