hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCORE-380) Support for HTTP Delete with entity body
Date Fri, 25 Nov 2016 13:02:58 GMT

    [ https://issues.apache.org/jira/browse/HTTPCORE-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15695821#comment-15695821
] 

Oleg Kalnichevski commented on HTTPCORE-380:
--------------------------------------------

We seem to be in agreement as far as practicality of entity enclosing GET and DELETE requests
is concerned. What I am not sure I quite understand is why making them even easier to abuse
instead of expressly discouraging from their use?

Idempotency of GET requests has a clear story: send back representation of the resource without
mutating it. Idempotency of PUT requests is also quite clear: send the complete, self-contained
new representation of the resource. 

I personally cannot even imagine a clear story for DELETE requests with an enclosed body.
How would one even formulate it? 

DELETE requests with an enclosed body are just plain silly. People should be using POSTs in
their stead.

Oleg

> Support for HTTP Delete with entity body
> ----------------------------------------
>
>                 Key: HTTPCORE-380
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-380
>             Project: HttpComponents HttpCore
>          Issue Type: New Feature
>          Components: HttpCore, HttpCore NIO
>    Affects Versions: 4.4-alpha1
>            Reporter: Jeewantha Dharmaparakrama
>             Fix For: 5.0-alpha1
>
>         Attachments: httpcore-nio.diff, httpcore.diff
>
>
> Hi All,
> I have created a fix to support HTTP DELETEs with entity bodies. In HTTP Core, the HttpRequest
object (BasicHttpRequest or BasicHttpEntityEnclosingRequest) is made by looking at the HTTP
method. But sometimes an API could accept HTTP Deletes with payloads for example [1]. To support
this I have introduced a new type of HTTP requests "HttpEntityPossibleEnclosingRequest". By
calling the "getFinalHttpRequest" method in this class, the proper HTTP request object can
be made, i.e. HttpRequest or HttpEntityEnclosingRequest. The logic is if the HttpEntityPossibleEnclosingRequest
has the CONTENT_LENGTH header, an HttpEntityEnclosingRequest is made and an HttpRequest is
made otherwise.
> Note. the spec does not prohibit an HTTP Delete having a payload [2] [3].
> [1] http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs-delete-by-query.html
> [2] http://stackoverflow.com/a/299696/1411653
> [3] http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7
> Thanks,
> Jeewantha



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message