Re: REST: ETag handling

Ralf Schlatterbeck <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
On Sat, Mar 23, 2019 at 02:29:47PM -0400, John P. Rouillard wrote:
> 
> I would strip quotes everywhere they occur so we should never have
> quotes in any variable/tuple etc. that hold an etag value.
.....
> I would strip quotes everywhere internally. I am surprised that
> header.get() doesn't strip the quotes but...
> 
> >  So I'd change the etag computation function to include the quotes and
> >  not apply the quotes in several cases and not in others. Point to the
> >  spec in the documentation of the ETag computation.
> 
> I would apply the quotes at the use point of the etag. Keep the etag
> as the MD5 string. The quotes are not part of the etag.

As it turns out: None of the other header-content have quotes. So the
quotes *are* part of the special ETag header content. So I've put them
in the ETag-generating code now.

> >I can provide a patch if you like.
> 
> That would be great. I think I finally chased down the last of the
> crashes with rest in python 3, but I am still testing manually.

I've now changed the etag handling to
- Generate ETag with quote in both, header and JSON code
- Use If-Match header on incoming request
- Fixed the tests, this included specially crafting JSON with quoted
  doublequotes in one of the tests
- Factored the ETag check-code that raises the exception after I found
  myself changing the text for the third time in a all the messages :-)
- Fixed doc to include If-Match and fix the example there, too

Ralf
-- 
Dr. Ralf Schlatterbeck                  Tel:   +43/2243/26465-16
Open Source Consulting                  www:   http://www.runtux.com
Reichergasse 131, A-3411 Weidling       email: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.