You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Michael Wallner <mi...@iworks.at> on 2008/04/24 13:59:05 UTC

Invalid ETag format

Hi,

according to HTTP/1.1 RFC, ETags must be enclosed in double quotes.
Currently CouchDB sends ETags like

Etag: 1347661991

instead of

Etag: "1347661991"


Cheers,
Mike

Re: Invalid ETag format

Posted by David Zülke <dz...@bitxtender.com>.
Am 24.04.2008 um 15:47 schrieb Michael Wallner:

> ps: What's the idea behind making id/ref once appear with and then  
> again
> without underscores at the beginning of the word?

In a document, those have underscores because they are internal  
identifiers (keys starting with an underscore are reserved to  
couchdb). The 201 created response returns a status object with a  
fixed structure, hence no need for underscores there.

But then, that's all just wild guesses :)

David


Re: Invalid ETag format

Posted by Christopher Lenz <cm...@gmx.de>.
On 24.04.2008, at 15:47, Michael Wallner wrote:
> David Zülke wrote:
>> There was a report, yup, filed it myself :)
>> It has been fixed in trunk as part of the mochiweb merge, apparently:
>> https://issues.apache.org/jira/browse/COUCHDB-13
>
> Reads like it should be fixed, but seems like CouchDB doesn't send any
> ETags anymore:
[...]
> GET /phpunit_test1/3a801ba5a1b9df16a0cb4143c7839461?rev=2903083097  
> HTTP/1.1
> User-Agent: PECL::HTTP/1.6.1-dev (PHP/5.3.0-dev)
> Host: localhost:5984
> Accept: */*
> HTTP/1.1 200 OK
> Server: MochiWeb/1.0 (Any of you quaids got a smint?)
> Date: Thu, 24 Apr 2008 13:42:31 GMT
> Content-Type: text/plain;charset=utf-8
> X-Original-Transfer-Encoding: chunked
> Content-Length: 62
>
> {"_id":"3a801ba5a1b9df16a0cb4143c7839461","_rev":"2903083097"}

CouchDB now only sends Etags on document requests if the request URL  
doesn't specify any query string parameters. The rationale behind that  
is that some parameters, such as `revs_info`, can result in a  
different JSON value even for the same URI and document revision.

For example, you request a specific rev of a document with `? 
rev=123456&revs_info=true`; the next time you request the same  
resource, a new revision might have been added, which means the  
revision info in the JSON response will have a new entry, and thus the  
previously retrieved resource is no longer up to date. But if we added  
the revision as Etag to the response, caches will not know that the  
cached version is out of date. So for now CouchDB simply omits the  
Etag for any query string params.

In the future, it should be more intelligent, and only omit the Etag  
for "problematic" options. I.e. for a request with just a `? 
rev=123456` param, we should ideally still be including an Etag.

Cheers,
--
Christopher Lenz
   cmlenz at gmx.de
   http://www.cmlenz.net/


Re: Invalid ETag format

Posted by Michael Wallner <mi...@iworks.at>.
David Zülke wrote:
> There was a report, yup, filed it myself :)
> It has been fixed in trunk as part of the mochiweb merge, apparently:
> https://issues.apache.org/jira/browse/COUCHDB-13

Reads like it should be fixed, but seems like CouchDB doesn't send any
ETags anymore:

POST /phpunit_test1 HTTP/1.1
User-Agent: PECL::HTTP/1.6.1-dev (PHP/5.3.0-dev)
Host: localhost:5984
Accept: */*
Content-Type: text/json
Content-Length: 2

{}
HTTP/1.1 201 Created
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Thu, 24 Apr 2008 13:42:31 GMT
Content-Type: text/plain;charset=utf-8
X-Original-Transfer-Encoding: chunked
Content-Length: 70

{"ok":true,"id":"3a801ba5a1b9df16a0cb4143c7839461","rev":"2903083097"}

GET /phpunit_test1/3a801ba5a1b9df16a0cb4143c7839461?rev=2903083097 HTTP/1.1
User-Agent: PECL::HTTP/1.6.1-dev (PHP/5.3.0-dev)
Host: localhost:5984
Accept: */*
HTTP/1.1 200 OK
Server: MochiWeb/1.0 (Any of you quaids got a smint?)
Date: Thu, 24 Apr 2008 13:42:31 GMT
Content-Type: text/plain;charset=utf-8
X-Original-Transfer-Encoding: chunked
Content-Length: 62

{"_id":"3a801ba5a1b9df16a0cb4143c7839461","_rev":"2903083097"}


-- Mike

ps: What's the idea behind making id/ref once appear with and then again
without underscores at the beginning of the word?


Re: Invalid ETag format

Posted by David Zülke <dz...@bitxtender.com>.
There was a report, yup, filed it myself :)
It has been fixed in trunk as part of the mochiweb merge, apparently: https://issues.apache.org/jira/browse/COUCHDB-13


David






Am 24.04.2008 um 14:23 schrieb Jan Lehnardt:

> Hey Mike,
> I could have sworn we had a bugreport for that.
> Mike, would you mind opening one?
>
> Cheers
> Jan
> --
>
>
> On Apr 24, 2008, at 13:59, Michael Wallner wrote:
>> Hi,
>>
>> according to HTTP/1.1 RFC, ETags must be enclosed in double quotes.
>> Currently CouchDB sends ETags like
>>
>> Etag: 1347661991
>>
>> instead of
>>
>> Etag: "1347661991"
>>
>>
>> Cheers,
>> Mike
>>
>
>


Re: Invalid ETag format

Posted by Jan Lehnardt <ja...@apache.org>.
Hey Mike,
I could have sworn we had a bugreport for that.
Mike, would you mind opening one?

Cheers
Jan
--


On Apr 24, 2008, at 13:59, Michael Wallner wrote:
> Hi,
>
> according to HTTP/1.1 RFC, ETags must be enclosed in double quotes.
> Currently CouchDB sends ETags like
>
> Etag: 1347661991
>
> instead of
>
> Etag: "1347661991"
>
>
> Cheers,
> Mike
>