Giter Club home page Giter Club logo

Comments (2)

kirangavali avatar kirangavali commented on September 7, 2024

@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

connection_close_v2 1 0

from haproxy.

capflam avatar capflam commented on September 7, 2024

No critical enough to be backported to 1.7. I close the issue keeping labels for the reference.

from haproxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.