diff options
Diffstat (limited to 'src/java')
| -rw-r--r-- | src/java/nxt_jni_Request.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/java/nxt_jni_Request.c b/src/java/nxt_jni_Request.c index 980a26b6..bc0d56dc 100644 --- a/src/java/nxt_jni_Request.c +++ b/src/java/nxt_jni_Request.c @@ -624,36 +624,14 @@ 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) { - jint res; - char *host, *colon, tmp; - nxt_unit_field_t *f; + char *p; nxt_unit_request_t *r; r = nxt_jlong2ptr(req_ptr); - f = nxt_java_findHeader(r->fields, r->fields + r->fields_count, - "Host", 4); - if (f != NULL) { - host = nxt_unit_sptr_get(&f->value); - - colon = memchr(host, ':', f->value_length); - - if (colon == NULL) { - return 80; - } - - tmp = host[f->value_length]; - - host[f->value_length] = '\0'; - - res = strtol(colon + 1, NULL, 10); - - host[f->value_length] = tmp; - - return res; - } + p = nxt_unit_sptr_get(&r->local_port); - return nxt_java_Request_getLocalPort(env, cls, req_ptr); + return strtol(p, NULL, 10); } |
