diff options
author | steckbrief <steckbrief@chefmail.de> | 2017-01-02 15:32:12 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2017-01-02 15:32:12 +0100 |
commit | 3ac60598246cda6947a5ced173784c3ee25622c3 (patch) | |
tree | 4253037a48b907df8e89fd521c52b1ff61950c31 /src/mvncache.php | |
parent | 0549800afeb7b8db389d79a9fd48feecf875ab23 (diff) |
Fixed redirect URL, added more mvn repos
Diffstat (limited to '')
-rw-r--r-- | src/mvncache.php | 6 |
1 files changed, 5 insertions, 1 deletions
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'); } |