Merge "Parsoid API: emit strong eTags"
This commit is contained in:
commit
3a66ddbf57
3 changed files with 7 additions and 3 deletions
|
|
@ -127,8 +127,10 @@ abstract class ParsoidHandler extends Handler {
|
|||
parent::checkPreconditions();
|
||||
|
||||
// Disable precondition checks by ignoring the return value above.
|
||||
// Parsoid/JS doesn't implement these checks.
|
||||
// See https://phabricator.wikimedia.org/T238849#5683035 for a discussion.
|
||||
// This works around the problem that Visual Editor sends weak ETags with
|
||||
// If-Match headers in some requests, which always fails. The weak ETags seem
|
||||
// to originate from Varnish. See T238849 for the issue that prompted this
|
||||
// workaround, and T310710 for removing it.
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -697,7 +699,7 @@ abstract class ParsoidHandler extends Handler {
|
|||
}
|
||||
if ( $request->getMethod() === 'GET' ) {
|
||||
$tid = UIDGenerator::newUUIDv1();
|
||||
$response->addHeader( 'Etag', "W/\"{$oldid}/{$tid}\"" );
|
||||
$response->addHeader( 'Etag', "\"{$oldid}/{$tid}\"" );
|
||||
}
|
||||
|
||||
// FIXME: For pagebundle requests, this can be somewhat inflated
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ describe( 'Page Source', () => {
|
|||
assert.strictEqual( isNaN( postEditDate.getTime() ), false );
|
||||
assert.notEqual( preEditDate, postEditDate );
|
||||
assert.notEqual( preEditEtag, postEditEtag );
|
||||
assert.match( postEditHeaders.etag, /^".*"$/, 'ETag must be present and not marked weak' );
|
||||
} );
|
||||
} );
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ describe( 'Revision', () => {
|
|||
|
||||
assert.match( text, /<html / );
|
||||
assert.match( text, /Hello World/ );
|
||||
assert.match( headers.etag, /^".*"$/, 'ETag must be present and not marked weak' );
|
||||
} );
|
||||
|
||||
it( 'should return 404 for revision that does not exist', async () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue