Comments (2)
@wtarreau
I have reproduced and analyzed the above bug on HAProxy v2.1.0 (using Wireshark).
As per my findings, the "Connection: close" string is appended after the data block instead of being appended after the header. [Refer the attached Wireshark screenshot at the end]
On further analyzing the corresponding HAProxy code, I identified the buffer in which the "option httpchk" directive is parsed as shown below:
args[4] : 0x714bca "HTTP/1.1\r\nHost: 10.10.26.236\r\nContent-Type: application/json\r\nContent-Length: 25\r\n\r\n{"command":"getNodeInfo"}"
args[3] : "/"
args[2] : "POST"
args[1] : "httpchk"
args[0] : "option"
Based on the finding I was able to confirm that HAProxy treats the complete request as a packet and does not differentiate between the request header and the body.
As stated by @wtarreau in [ #https://www.mail-archive.com/[email protected]/msg28200.html], it would be best to add another option "body" to http-check directive so as to correctly differentiate body from header, as shown below:-
option httpchk POST / HTTP/1.1\r\n
http-check header Host: 10.10.26.236\r\nContent-Type: application/json\r\nContent-Length: 38\r\n
http-check body {"command":"getNodeInfo"}
http-check expect rstatus (2|3)[0-9][0-9]
To incorporate the change, we need to do changes in below code:-
File: cfgparse-listen.c
Function: int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
Code Snippet: curproxy->check_len = snprintf(curproxy->check_req, reqlen, "%s %s %s\r\n", args[2], args[3], *args[4]?args[4]:"HTTP/1.0");
Please let me know if my understanding of the above issue is correct, so that I can proceed further accordingly. Looking forward for your guidance.
Regards
Kiran Gavali
from haproxy.
No critical enough to be backported to 1.7. I close the issue keeping labels for the reference.
from haproxy.
Related Issues (20)
- src/cfgparse.c: TOCTOU violation suspected by coverity HOT 4
- src/mux_h1.c: integer overflow suspected by coverity HOT 2
- src/mux_h1.c: integer overflow suspected by coverity HOT 2
- src/haproxy.c: unused value suspected by coverity HOT 2
- src/quic_tx.c: integer overflow suspected by coverity HOT 6
- src/cfgparse.c: null pointer dereference suspected by coverity HOT 1
- Double "transfer-encoding: chunked" header return 502 error (terminal code PH)... HOT 9
- Assertion crash: bug condition "qcs->tx.fc.off_soft != qcs->tx.fc.off_real" matched at src/mux_quic.c:1707 HOT 2
- observe on-error is inconsistent with redispatch HOT 2
- src/pattern.c: double free is suspected by coverity HOT 6
- numerous coverity "overflow" errors HOT 9
- src/http_conv.c: dead code suspected by coverity
- HTTP connection upgrade to TCP seems broken since 2.4 HOT 5
- HAProxy / Logs missing for rejected HTTP responses from the backend when HTTP2 is used on frontend+backend
- How to Set Host Header Dynamically After Backend Server Selection in HAProxy HOT 1
- Request to Support for HTTP 429 Response Code in retry-on Directive HOT 11
- QUIC libressl Interop sometimes fails HOT 14
- cross compile failed HOT 2
- "FATAL: bug condition" hit on running QUIC Interop test (AWS-LC, ngtcp2, transfer test) HOT 3
- reg-tests/stickiness/lb-services.vtc sometimes fails
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 haproxy.