diff options
author | Andrei Belov <defan@nginx.com> | 2019-05-30 17:44:29 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2019-05-30 17:44:29 +0300 |
commit | 4921df052be8437d912f3c60faa9a667890e4498 (patch) | |
tree | 3678c551f148a0d177721597de978c090237f205 /src/java/nxt_jni_Request.c | |
parent | 3b7a7ff2aa5840d4238584410ee1ebc6860fb9c5 (diff) | |
parent | 7da320a93af07765e79c929287704936c431f3cd (diff) | |
download | unit-4921df052be8437d912f3c60faa9a667890e4498.tar.gz unit-4921df052be8437d912f3c60faa9a667890e4498.tar.bz2 |
Merged with the default branch.1.9.0-1
Diffstat (limited to 'src/java/nxt_jni_Request.c')
-rw-r--r-- | src/java/nxt_jni_Request.c | 23 |
1 files changed, 22 insertions, 1 deletions
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) |