Re: How to determine server's decoding capability before sending entity?

Amos Jeffries <squid3@treenet.co.nz> Fri, 15 February 2013 08:43 UTC

Return-Path: <ietf-http-wg-request@listhub.w3.org>
X-Original-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Delivered-To: ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E04AE21F867B for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 15 Feb 2013 00:43:18 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -10.31
X-Spam-Level:
X-Spam-Status: No, score=-10.31 tagged_above=-999 required=5 tests=[AWL=0.289, BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XsSbzDP3GxEf for <ietfarch-httpbisa-archive-bis2Juki@ietfa.amsl.com>; Fri, 15 Feb 2013 00:43:18 -0800 (PST)
Received: from frink.w3.org (frink.w3.org [128.30.52.56]) by ietfa.amsl.com (Postfix) with ESMTP id F3B5A21F866F for <httpbisa-archive-bis2Juki@lists.ietf.org>; Fri, 15 Feb 2013 00:43:17 -0800 (PST)
Received: from lists by frink.w3.org with local (Exim 4.72) (envelope-from <ietf-http-wg-request@listhub.w3.org>) id 1U6Gs1-0001g5-9k for ietf-http-wg-dist@listhub.w3.org; Fri, 15 Feb 2013 08:42:13 +0000
Resent-Date: Fri, 15 Feb 2013 08:42:13 +0000
Resent-Message-Id: <E1U6Gs1-0001g5-9k@frink.w3.org>
Received: from lisa.w3.org ([128.30.52.41]) by frink.w3.org with esmtp (Exim 4.72) (envelope-from <squid3@treenet.co.nz>) id 1U6Grr-0001fG-BN for ietf-http-wg@listhub.w3.org; Fri, 15 Feb 2013 08:42:03 +0000
Received: from ip-58-28-153-233.static-xdsl.xnet.co.nz ([58.28.153.233] helo=treenet.co.nz) by lisa.w3.org with esmtp (Exim 4.72) (envelope-from <squid3@treenet.co.nz>) id 1U6Grn-0002Dt-FB for ietf-http-wg@w3.org; Fri, 15 Feb 2013 08:42:03 +0000
Received: from [192.168.1.103] (unknown [14.1.64.4]) by treenet.co.nz (Postfix) with ESMTP id B83C6E6EE3 for <ietf-http-wg@w3.org>; Fri, 15 Feb 2013 21:41:34 +1300 (NZDT)
Message-ID: <511DF4BA.3060503@treenet.co.nz>
Date: Fri, 15 Feb 2013 21:41:30 +1300
From: Amos Jeffries <squid3@treenet.co.nz>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2
MIME-Version: 1.0
To: ietf-http-wg@w3.org
References: <CAFT+Tg-oyYrS53mObRVVFKL2z0WxAXmzjdcdLJazs277noYVEQ@mail.gmail.com>
In-Reply-To: <CAFT+Tg-oyYrS53mObRVVFKL2z0WxAXmzjdcdLJazs277noYVEQ@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=58.28.153.233; envelope-from=squid3@treenet.co.nz; helo=treenet.co.nz
X-W3C-Hub-Spam-Status: No, score=-3.5
X-W3C-Hub-Spam-Report: AWL=-3.449, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001
X-W3C-Scan-Sig: lisa.w3.org 1U6Grn-0002Dt-FB 7a6ee01e70c0c0a8bbf3ab15ef681abc
X-Original-To: ietf-http-wg@w3.org
Subject: Re: How to determine server's decoding capability before sending entity?
Archived-At: <http://www.w3.org/mid/511DF4BA.3060503@treenet.co.nz>
Resent-From: ietf-http-wg@w3.org
X-Mailing-List: <ietf-http-wg@w3.org> archive/latest/16612
X-Loop: ietf-http-wg@w3.org
Resent-Sender: ietf-http-wg-request@w3.org
Precedence: list
List-Id: <ietf-http-wg.w3.org>
List-Help: <http://www.w3.org/Mail/>
List-Post: <mailto:ietf-http-wg@w3.org>
List-Unsubscribe: <mailto:ietf-http-wg-request@w3.org?subject=unsubscribe>

On 15/02/2013 8:10 p.m., Yi, EungJun wrote:
> Hi, all.
>
> Before sending a POST request to HTTP/1.1 server, whose body is 
> encoded in the coding defined by Content-Encoding header, how do I 
> know the server's capability to decode the request's body?
>
> HEAD method seems to be only for GET method, and response for OPTIONS 
> request may not return any information about that.
>
> It is the only way that receive 415 Unsupported media type after 
> sending the request with the body?
>
> Thanks in advance.

There is one way allowed by HTTP/1.1 using a POST with 
Transfer-Encoding:chunked, and also Expect:100-continue.

The server will see the intended encoding type and reject it with 415 or 
accept it with a 100 (timeout is also needed).
After a 415 you can abort with an empty chunk and re-try with another 
encoding. After a 100 or a timeout you go ahead and deliver it.
** the timeout is needed due to HTTP/1.0 software erasing the 100 status 
code. In which case the best thing to do is deliver the expected body 
and handle any 415 which may still arrive.

Amos