hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Moore (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1601) Tutorial claims that PUT is not idempotent
Date Sat, 24 Jan 2015 16:39:34 GMT

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

Jon Moore commented on HTTPCLIENT-1601:
---------------------------------------

I don't think this is a bug in the sense of incorrect behavior, although I think you've possibly
identified an opportunity for improvement.

HTTP methods by default are non-idempotent unless explicitly declared otherwise. Idempotent
methods can be automatically retried by intermediaries, user agents, etc., but the worst that
happens on the client side is that something that could have been retried is not retried.
This is not a protocol (interoperability) problem; treating PUT as non-idempotent on the *client*
side is not a violation of the spec. Note that section 4.2.2 of RFC 7231 uses the word "can"
and not "MUST".

There are practical implementation reasons why requests with bodies might not be automatically
retried, particularly for ones with non-restartable input streams. I haven't looked to see
what the current implementation does. Retrying PUTs with restartable input streams would seem
reasonably straightforward; supporting retries for PUTs without restartable input streams
is a feature that's probably worth debating (would require buffering on the client side in
case a retry is needed; that feature would almost certainly need to be an opt-in one due to
the memory implications).

In any event, I agree with you that the documentation (at least) could be cleaned up to match
the actual implementation (if not already accurate), and also to say something like "Although
PUT is defined as an idempotent method by the HTTP spec, the HttpClient implementation does
not take advantage of this and does not retry any method which encloses a request entity."
Or similar. 



> Tutorial claims that PUT is not idempotent
> ------------------------------------------
>
>                 Key: HTTPCLIENT-1601
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1601
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 4.3.6
>            Reporter: Michael Osipov
>
> Open up [chapter 1.4.2|http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d5e280],
it says that {{PUT}} is not idempotent. This clearly violates [RFC 7231, section 4.2.2|http://tools.ietf.org/html/rfc7231#section-4.2.2].
It should be checked whether this is just a documentation flaw or even maybe an implemenation
flaw.



--
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