Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with full body intercepting in response body filter #219

Closed
dennus opened this issue Aug 1, 2019 · 1 comment
Closed

Problem with full body intercepting in response body filter #219

dennus opened this issue Aug 1, 2019 · 1 comment

Comments

@dennus
Copy link

dennus commented Aug 1, 2019

When we want to intercept full response body before sending response to client and upstream response body size more then totally specified in proxy_buffers, nginx-clojure deadlocked proccesing response, e.g.:

public class NginxSampleBodyFilter implents NginxJavaResponseBodyFilter {

public doFilter (..) {
if (!isLast) {
// save data in store

 return new Object[] {null, null, null}

}
else {
return new Object[] {200, headers, body};
}

}

}

This problem solved by setting chain->buf->pos = chain->buf->last in ngx_http_clojure_body_filter, but this may cause problem which is solved in:

1129712#diff-7fc78c16eb92158b28e5f28bd4ce872b

@itboy2009
Copy link

help me:
env:
mac + jdk8 + nginx-clojure-0.4.5

 nginx.conf:
        proxy_pass $scheme://$host$request_uri;
    body_filter_type java;
        body_filter_name my.MyNginxJavaBodyFilter;

but get exception:

            2019-08-03 22:05:01[error][3610][main]server unhandled exception!
java.nio.BufferOverflowException
	at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:206)
	at my.MyStringFacedJavaBodyFilter.decodeToString(MyStringFacedJavaBodyFilter.java:61)
	at my.MyStringFacedJavaBodyFilter.doFilter(MyStringFacedJavaBodyFilter.java:32)
	at nginx.clojure.java.NginxJavaHandler.process(NginxJavaHandler.java:114)
	at nginx.clojure.NginxSimpleHandler.handleRequest(NginxSimpleHandler.java:187)
	at nginx.clojure.NginxSimpleHandler.execute(NginxSimpleHandler.java:105)
	at nginx.clojure.NginxClojureRT.eval(NginxClojureRT.java:1133)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants