I started working on the changes. To discuss the changes I forked unofficial HAProxy repository. I know it's not synchronized to the git repo but I think it's easier discussing some changes via links I can post directly in this mail. Everyone just can click on the URLs and knows what I mean.

The URL is: https://github.com/hamburml/haproxy/commits/master
As you can see I made the same changes as the git patch showed. As Willy suggested http_err_msgs is now splitted in http_err_msgs_body and http_err_msgs_hdr. I also changed the type of http_err_chunks to err_hdr_body which I added in proto_http.h and is a struct which consists of two chunks, one for msg hdr, one for msg body. This should allow easy changes to the body when a user wants to use custom errorfiles.

Now I have some questions concerning other changes which I can't answer easily because I don't know the sources well and you guys are more familiar with the code.

errorfile in HAProxys config:
https://github.com/hamburml/haproxy/blob/master/src/cfgparse.c#L6734

As you can see chunk_destroy and chunk_initlen is used to free memory and allocate enough memory for the new error message. This must be adjusted so that only the chunk of body is replaced. The header is still the same, correct? Same as in https://github.com/hamburml/haproxy/blob/master/src/cfgparse.c#L6675, right?

session.c:
https://github.com/hamburml/haproxy/blob/master/src/session.c#L295
When a critical error occurs, 500 response should be emitted. Wouldn't it be better when http_error_message() (https://github.com/hamburml/haproxy/blob/master/src/proto_http.c#L1113) is used on this position? The errmsg needs to be build so it's not working anymore to just set it like here.

Concat error messages:
https://github.com/hamburml/haproxy/blob/master/src/proto_http.c#L1112
The http_error_message method should concat hdr + "\r\n" + "body" and return the str/chunk. As you can see only inside else http_err_chunks is used, the if and else-if part uses other errmsg like s->be->errmsg[msgnum]. Does that all point to the same http_err_chunks/to internal copies or are there other error-messages?

Well... I feel like I forgot something important but I can't remember. What do you say?

Cheers!

Reply via email to