WI-29096 "No input file specified" error with internal server

This commit is contained in:
Vladimir Krivosheev
2015-10-05 13:17:26 +02:00
parent e8e692121b
commit 98aca177ce
3 changed files with 8 additions and 7 deletions
@@ -22,7 +22,7 @@ class PathInfo(val ioFile: File?, val file: VirtualFile?, val root: VirtualFile,
}
if (file == null) {
builder.append(FileUtilRt.getRelativePath(FileUtilRt.toSystemIndependentName(ioFile!!.path), root.path, '/'))
builder.append(FileUtilRt.getRelativePath(root.path, FileUtilRt.toSystemIndependentName(ioFile!!.path), '/'))
}
else {
builder.append(VfsUtilCore.getRelativePath(file, root, '/'))
@@ -16,6 +16,7 @@
package org.jetbrains.builtInWebServer
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.io.parentPath
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.util.PathUtilRt
import io.netty.channel.ChannelHandlerContext
@@ -76,8 +77,8 @@ private class DefaultWebServerPathHandler : WebServerPathHandler() {
}
else {
// FallbackResource feature in action, /login requested, /index.php retrieved, we must not redirect /login to /login/
if (path.endsWith(PathUtilRt.getFileName(PathUtilRt.getParentPath(pathInfo.path)))) {
WebServerPathHandler.redirectToDirectory(request, channel, if (isCustomHost) path else (projectName + '/' + path))
if (path.endsWith(PathUtilRt.getFileName(pathInfo.path.parentPath!!))) {
WebServerPathHandler.redirectToDirectory(request, channel, if (isCustomHost) path else ("$projectName/$path"))
return true
}
}
@@ -30,14 +30,14 @@ class FastCgiRequest(val requestId: Int, allocator: ByteBufAllocator) {
buffer!!.writeZero(5)
}
public fun writeFileHeaders(pathInfo: PathInfo, canonicalRequestPath: CharSequence) {
fun writeFileHeaders(pathInfo: PathInfo, canonicalRequestPath: CharSequence) {
val root = pathInfo.root
addHeader("DOCUMENT_ROOT", root.path)
addHeader("SCRIPT_FILENAME", pathInfo.path)
addHeader("DOCUMENT_ROOT", root.path.separatorsToSystem())
addHeader("SCRIPT_FILENAME", if (pathInfo.ioFile == null) pathInfo.file!!.path.separatorsToSystem() else pathInfo.ioFile!!.path)
addHeader("SCRIPT_NAME", canonicalRequestPath)
}
public fun addHeader(key: String, value: CharSequence?) {
fun addHeader(key: String, value: CharSequence?) {
if (value == null) {
return
}