summaryrefslogtreecommitdiffhomepage
path: root/src/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java')
-rw-r--r--src/java/nginx/unit/Context.java6
-rw-r--r--src/java/nginx/unit/Request.java8
-rw-r--r--src/java/nxt_jni_Context.c2
-rw-r--r--src/java/nxt_jni_Request.c23
4 files changed, 31 insertions, 8 deletions
diff --git a/src/java/nginx/unit/Context.java b/src/java/nginx/unit/Context.java
index 643a336b..f6d5e339 100644
--- a/src/java/nginx/unit/Context.java
+++ b/src/java/nginx/unit/Context.java
@@ -306,7 +306,7 @@ public class Context implements ServletContext, InitParams
PrintWriter writer = response.getWriter();
for (String n : ls) {
- writer.println("<a href=\"" + n + "\">" + n + "</a><br>");
+ writer.println("<a href=\"" + n + "\">" + n + "</a><br>");
}
writer.close();
@@ -547,7 +547,7 @@ public class Context implements ServletContext, InitParams
j = j.getParent();
}
}
- system_loader = j;
+ system_loader = j;
}
private boolean isSystemPath(String path)
@@ -1733,7 +1733,7 @@ public class Context implements ServletContext, InitParams
@Override
public FileVisitResult visitFile(
- Path file, BasicFileAttributes attrs)
+ Path file, BasicFileAttributes attrs)
throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
diff --git a/src/java/nginx/unit/Request.java b/src/java/nginx/unit/Request.java
index dc73c656..3ba46f6c 100644
--- a/src/java/nginx/unit/Request.java
+++ b/src/java/nginx/unit/Request.java
@@ -920,7 +920,7 @@ public class Request implements HttpServletRequest, DynamicPathRequest
@Override
public String getScheme()
{
- log("getScheme");
+ trace("getScheme");
return getScheme(req_ptr);
}
@@ -980,11 +980,13 @@ public class Request implements HttpServletRequest, DynamicPathRequest
@Override
public boolean isSecure()
{
- log("isSecure");
+ trace("isSecure");
- return false;
+ return isSecure(req_ptr);
}
+ private static native boolean isSecure(long req_ptr);
+
@Override
public void removeAttribute(String name)
{
diff --git a/src/java/nxt_jni_Context.c b/src/java/nxt_jni_Context.c
index 8f7adddf..589e1c5b 100644
--- a/src/java/nxt_jni_Context.c
+++ b/src/java/nxt_jni_Context.c
@@ -55,7 +55,7 @@ nxt_java_initContext(JNIEnv *env, jobject cl)
}
nxt_java_Context_stop = (*env)->GetMethodID(env, cls, "stop", "()V");
- if (nxt_java_Context_service == NULL) {
+ if (nxt_java_Context_stop == NULL) {
nxt_unit_warn(NULL, "nginx.unit.Context.stop() not found");
goto failed;
}
diff --git a/src/java/nxt_jni_Request.c b/src/java/nxt_jni_Request.c
index 6fb9cb44..733290dd 100644
--- a/src/java/nxt_jni_Request.c
+++ b/src/java/nxt_jni_Request.c
@@ -56,6 +56,8 @@ static jstring JNICALL nxt_java_Request_getServerName(JNIEnv *env, jclass cls,
jlong req_ptr);
static jint JNICALL nxt_java_Request_getServerPort(JNIEnv *env, jclass cls,
jlong req_ptr);
+static jboolean JNICALL nxt_java_Request_isSecure(JNIEnv *env, jclass cls,
+ jlong req_ptr);
static void JNICALL nxt_java_Request_log(JNIEnv *env, jclass cls,
jlong req_info_ptr, jstring msg, jint msg_len);
static void JNICALL nxt_java_Request_trace(JNIEnv *env, jclass cls,
@@ -166,6 +168,10 @@ nxt_java_initRequest(JNIEnv *env, jobject cl)
(char *) "(J)I",
nxt_java_Request_getServerPort },
+ { (char *) "isSecure",
+ (char *) "(J)Z",
+ nxt_java_Request_isSecure },
+
{ (char *) "log",
(char *) "(JLjava/lang/String;I)V",
nxt_java_Request_log },
@@ -536,7 +542,11 @@ nxt_java_Request_getRemotePort(JNIEnv *env, jclass cls, jlong req_ptr)
static jstring JNICALL
nxt_java_Request_getScheme(JNIEnv *env, jclass cls, jlong req_ptr)
{
- return (*env)->NewStringUTF(env, "http");
+ nxt_unit_request_t *r;
+
+ r = nxt_jlong2ptr(req_ptr);
+
+ return (*env)->NewStringUTF(env, r->tls ? "https" : "http");
}
@@ -603,6 +613,17 @@ nxt_java_Request_getServerPort(JNIEnv *env, jclass cls, jlong req_ptr)
}
+static jboolean JNICALL
+nxt_java_Request_isSecure(JNIEnv *env, jclass cls, jlong req_ptr)
+{
+ nxt_unit_request_t *r;
+
+ r = nxt_jlong2ptr(req_ptr);
+
+ return r->tls != 0;
+}
+
+
static void JNICALL
nxt_java_Request_log(JNIEnv *env, jclass cls, jlong req_info_ptr, jstring msg,
jint msg_len)