diff options
author | Andrei Belov <defan@nginx.com> | 2020-03-12 18:40:48 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2020-03-12 18:40:48 +0300 |
commit | 4b7ca39903178e20ec7381205694cb01f0dec6bc (patch) | |
tree | 51afb9c7003b5927183e7ddecd766eb19e421233 /src/java | |
parent | 8414897527ed1616ea39a0cae4d1b8ee170d5cb8 (diff) | |
parent | b3c8a7b33a29208e75dfe4f670cf81dac7b99ccc (diff) | |
download | unit-4b7ca39903178e20ec7381205694cb01f0dec6bc.tar.gz unit-4b7ca39903178e20ec7381205694cb01f0dec6bc.tar.bz2 |
Merged with the default branch.1.16.0-1
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/nginx/unit/Context.java | 2 | ||||
-rw-r--r-- | src/java/nxt_jni_InputStream.c | 28 |
2 files changed, 5 insertions, 25 deletions
diff --git a/src/java/nginx/unit/Context.java b/src/java/nginx/unit/Context.java index 6fcd6018..5f7ec22f 100644 --- a/src/java/nginx/unit/Context.java +++ b/src/java/nginx/unit/Context.java @@ -1517,7 +1517,7 @@ public class Context implements ServletContext, InitParams || ci.isAnnotation() || ci.isAbstract()) { - return; + continue; } trace("loadInitializer: handles class: " + ci.getName()); diff --git a/src/java/nxt_jni_InputStream.c b/src/java/nxt_jni_InputStream.c index b96ff742..3b74b0c1 100644 --- a/src/java/nxt_jni_InputStream.c +++ b/src/java/nxt_jni_InputStream.c @@ -90,40 +90,20 @@ static jint JNICALL nxt_java_InputStream_readLine(JNIEnv *env, jclass cls, jlong req_info_ptr, jarray out, jint off, jint len) { - char *p; - jint size, b_size; uint8_t *data; ssize_t res; - nxt_unit_buf_t *b; nxt_unit_request_info_t *req; req = nxt_jlong2ptr(req_info_ptr); - size = 0; - - for (b = req->content_buf; b; b = nxt_unit_buf_next(b)) { - b_size = b->end - b->free; - p = memchr(b->free, '\n', b_size); - - if (p != NULL) { - p++; - size += p - b->free; - break; - } + data = (*env)->GetPrimitiveArrayCritical(env, out, NULL); - size += b_size; + res = nxt_unit_request_readline_size(req, len); - if (size >= len) { - break; - } + if (res > 0) { + res = nxt_unit_request_read(req, data + off, res); } - len = len < size ? len : size; - - data = (*env)->GetPrimitiveArrayCritical(env, out, NULL); - - res = nxt_unit_request_read(req, data + off, len); - nxt_unit_req_debug(req, "readLine '%.*s'", res, (char *) data + off); (*env)->ReleasePrimitiveArrayCritical(env, out, data, 0); |