dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use RepoGroup service in MovePage
[lhc/web/wiklou.git]
/
img_auth.php
diff --git
a/img_auth.php
b/img_auth.php
index
1434125
..
914014d
100644
(file)
--- a/
img_auth.php
+++ b/
img_auth.php
@@
-138,12
+138,13
@@
function wfImageAuthMain() {
$headers = []; // extra HTTP headers to send
$headers = []; // extra HTTP headers to send
+ $title = Title::makeTitleSafe( NS_FILE, $name );
+
if ( !$publicWiki ) {
// For private wikis, run extra auth checks and set cache control headers
if ( !$publicWiki ) {
// For private wikis, run extra auth checks and set cache control headers
- $headers[
] = 'Cache-Control:
private';
- $headers[
] = 'Vary:
Cookie';
+ $headers[
'Cache-Control'] = '
private';
+ $headers[
'Vary'] = '
Cookie';
- $title = Title::makeTitleSafe( NS_FILE, $name );
if ( !$title instanceof Title ) { // files have valid titles
wfForbidden( 'img-auth-accessdenied', 'img-auth-badtitle', $name );
return;
if ( !$title instanceof Title ) { // files have valid titles
wfForbidden( 'img-auth-accessdenied', 'img-auth-badtitle', $name );
return;
@@
-167,19
+168,22
@@
function wfImageAuthMain() {
}
}
}
}
- $options = []; // HTTP header options
if ( isset( $_SERVER['HTTP_RANGE'] ) ) {
if ( isset( $_SERVER['HTTP_RANGE'] ) ) {
- $
options['r
ange'] = $_SERVER['HTTP_RANGE'];
+ $
headers['R
ange'] = $_SERVER['HTTP_RANGE'];
}
if ( isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) {
}
if ( isset( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) {
- $
options['if-modified-s
ince'] = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
+ $
headers['If-Modified-S
ince'] = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
}
if ( $request->getCheck( 'download' ) ) {
}
if ( $request->getCheck( 'download' ) ) {
- $headers[
] = 'Content-Disposition:
attachment';
+ $headers[
'Content-Disposition'] = '
attachment';
}
}
+ // Allow modification of headers before streaming a file
+ Hooks::run( 'ImgAuthModifyHeaders', [ $title->getTitleValue(), &$headers ] );
+
// Stream the requested file
// Stream the requested file
+ list( $headers, $options ) = HTTPFileStreamer::preprocessHeaders( $headers );
wfDebugLog( 'img_auth', "Streaming `" . $filename . "`." );
$repo->streamFileWithStatus( $filename, $headers, $options );
}
wfDebugLog( 'img_auth', "Streaming `" . $filename . "`." );
$repo->streamFileWithStatus( $filename, $headers, $options );
}