From 3ac60598246cda6947a5ced173784c3ee25622c3 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Mon, 2 Jan 2017 15:32:12 +0100 Subject: Fixed redirect URL, added more mvn repos --- src/mvncache.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/mvncache.php') diff --git a/src/mvncache.php b/src/mvncache.php index ef75a16..7abb765 100644 --- a/src/mvncache.php +++ b/src/mvncache.php @@ -12,6 +12,10 @@ $requestedArtifact = str_replace('/mvn', '', $requestedArtifact); $baseLocalFolder = __DIR__.'/..'; $localFolder = $baseLocalFolder.substr($requestedArtifact, 0, strripos($requestedArtifact, '/')); +if ('' == $requestedArtifact) { // no artifact is requested - return + sendHttpReturnCodeAndMessage(403, 'Not allowed'); +} + $tempFile = tmpfile(); foreach ($config['mavenBaseUrls'] as $mvnBaseUrl) { $srcUrl = $mvnBaseUrl.$requestedArtifact; @@ -46,7 +50,7 @@ if (!$found) { stream_copy_to_stream($tempFile, $dst); if (is_file($dstPath)) { chmod($dstPath, 0660); - header('Location: http://'.$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]); + header('Location: '.getServerProtocol().'://'.getRequestHostname().$_SERVER["REQUEST_URI"]); } else { header('HTTP/1.0 404 Not Found'); } -- cgit v1.2.3