Comments (4)
Since I don't see any way to attach a file, I'll paste the patch here:
--- ngx_http_ajp_handler.c.orig 2011-02-12 00:44:33.000000000 -0500
+++ ngx_http_ajp_handler.c 2011-04-01 16:29:49.366773997 -0400
@@ -746,6 +746,8 @@
if (rc != NGX_OK) {
return NGX_ERROR;
}
+ // account for the extra byte at the end of the chunk
+ a->length++;
buf->pos += offset;
a->state = ngx_http_ajp_st_response_body_data_sending;
@@ -777,12 +779,13 @@
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, p->log, 0,
"input filter packet, length:%z, buffer_size:%z",
- a->length, ngx_buf_size(buf));
+ a->length - 1, ngx_buf_size(buf));
/* Get a zero length packet */
- if (a->length == 0) {
+ if (a->length == 1) {
if (buf->pos < buf->last) {
buf->pos++;
+ a->length--;
}
continue;
@@ -828,8 +831,8 @@
/* STUB */ b->num = buf->num;
- if (buf->pos + a->length < buf->last) {
- buf->pos += a->length;
+ if (buf->pos + a->length <= buf->last) {
+ buf->pos += (a->length - 1);
b->last = buf->pos;
/* The last byte of this message always seems to be
from nginx_ajp_module.
Thanks for this excellent bug report, Chris, you are such a good hacker.
I have added a patch for this module. But it's a little different from yours. I think the length is the meaning of ajp data packet. It should not add a one-extra byte in the length which may confuse its true meaning. So I add a new member of extra_zero_byte in the struct of ngx_http_ajp_ctx_t.
The commit is here: 1445606
I have not tested fully with this patch. Can you check out this experiment branch and test it. Thank you very much. The branch is here:
https://github.com/yaoweibin/nginx_ajp_module/commits/experiment
from nginx_ajp_module.
Hi yaoweibin,
I've looked at your commit, and I see one potential problem. The new member extra_zero_byte isn't initialized to zero anywhere. I think a line like:
a->extra_zero_byte = 0;
needs to be added in the function ngx_http_ajp_reinit_request().
Also, in this "if" statement:
/* Get a zero length packet */ if (a->length == 0 && a->extra_zero_byte && (buf->pos < buf->last)) { if (buf->pos < buf->last) { buf->pos++; a->extra_zero_byte = 0; } continue; }
the inner "if" is redundant.
from nginx_ajp_module.
Thanks for your opinion, Chris. I think you are right. I have fixed this problem in the experiment branch.
from nginx_ajp_module.
Related Issues (20)
- ajp模块崩溃 HOT 2
- ajp模块设计问题
- Build failure against nginx 1.5.11 HOT 2
- Using ajp_cache fails to return responses HOT 3
- How to send additional HTTP headers to Tomcat over AJP? HOT 1
- RPM required \ RHEL HOT 5
- Build failure with nginx 1.7.9 HOT 5
- Built failure on nginx-1.7.10 and pcre-8.36 HOT 4
- About connect() failed (110: Connection timed out) message..
- ajp_cache_path causes segmentation fault on Nginx 1.8.0 HOT 13
- compile error: comparison between pointer and integer HOT 1
- Strange header hash collisions making tomcat keel over HOT 1
- ngx_http_upstream_send_request_body: bad state(3) HOT 1
- Dynamic loadable support
- Setting ajp_max_data_packet_size causes SIGSEGV HOT 1
- AJP Patch fails HOT 1
- ajp_module path
- Unable to upload files more than 4 GB with Nginx AJP module HOT 1
- AJP connection with a secret?
- Does not compile with Nginx 1.21.1 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nginx_ajp_module.