diff options
author | Max Romanov <max.romanov@nginx.com> | 2019-03-21 13:55:57 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2019-03-21 13:55:57 +0300 |
commit | 452ce0789e8e8f1ac98cc0ed7efce03656a3d616 (patch) | |
tree | 395a7f6964448568ec8521e6cd1338763a9d743f /src/java | |
parent | 39e147a858e7d135aa224a308b4d41061e00c296 (diff) | |
download | unit-452ce0789e8e8f1ac98cc0ed7efce03656a3d616.tar.gz unit-452ce0789e8e8f1ac98cc0ed7efce03656a3d616.tar.bz2 |
Adjusting request schema value according to connection tls state.
This closes #223 issue on GitHub.
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/nginx/unit/Request.java | 6 | ||||
-rw-r--r-- | src/java/nxt_jni_Request.c | 17 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/java/nginx/unit/Request.java b/src/java/nginx/unit/Request.java index dc73c656..b46d3f59 100644 --- a/src/java/nginx/unit/Request.java +++ b/src/java/nginx/unit/Request.java @@ -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_Request.c b/src/java/nxt_jni_Request.c index 6fb9cb44..a9fbe0e4 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 }, @@ -603,6 +609,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) |