Skip to content

Commit

Permalink
Merge pull request #275 from jajik/protocol-msgs
Browse files Browse the repository at this point in the history
Fix mod_manager.c DUMP command output
  • Loading branch information
rhusar authored Sep 5, 2024
2 parents 2fe38f5 + a1f7743 commit f023e4a
Showing 1 changed file with 67 additions and 58 deletions.
125 changes: 67 additions & 58 deletions native/mod_manager/mod_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -1646,17 +1646,18 @@ static char *process_dump(request_rec *r, int *errtype)

switch (type) {
case TEXT_XML:
ap_rprintf(r, "<Balancer id=\"%d\" name=\"%.*s\">\
<StickySession>\
<Enabled>%d</Enabled>\
<Cookie>%.*s</Cookie>\
<Path>%.*s</Path>\
<Remove>%d</Remove>\
<Force>%d</Force>\
</StickySession>\
<Timeout>%d</Timeout>\
<MaxAttempts>%d</MaxAttempts>\
</Balancer>",
ap_rprintf(r,
"<Balancer id=\"%d\" name=\"%.*s\">"
"<StickySession>"
"<Enabled>%d</Enabled>"
"<Cookie>%.*s</Cookie>"
"<Path>%.*s</Path>"
"<Remove>%d</Remove>"
"<Force>%d</Force>"
"</StickySession>"
"<Timeout>%d</Timeout>"
"<MaxAttempts>%d</MaxAttempts>"
"</Balancer>",
id[i], (int)sizeof(ou->balancer), ou->balancer, ou->StickySession,
(int)sizeof(ou->StickySessionCookie), ou->StickySessionCookie,
(int)sizeof(ou->StickySessionPath), ou->StickySessionPath, ou->StickySessionRemove,
Expand Down Expand Up @@ -1692,20 +1693,21 @@ static char *process_dump(request_rec *r, int *errtype)

switch (type) {
case TEXT_XML:
ap_rprintf(r, "<Node id=\"%d\">\
<Balancer>%.*s</Balancer>\
<JVMRoute>%.*s</JVMRoute>\
<LBGroup>%.*s</LBGroup>\
<Host>%.*s</Host>\
<Port>%.*s</Port>\
<Type>%.*s</Type>\
<FlushPackets>%d</FlushPackets>\
<FlushWait>%d</FlushWait>\
<Ping>%d</Ping>\
<Smax>%d</Smax>\
<Ttl>%d</Ttl>\
<Timeout>%d</Timeout>\
</Node>",
ap_rprintf(r,
"<Node id=\"%d\">"
"<Balancer>%.*s</Balancer>"
"<JVMRoute>%.*s</JVMRoute>"
"<LBGroup>%.*s</LBGroup>"
"<Host>%.*s</Host>"
"<Port>%.*s</Port>"
"<Type>%.*s</Type>"
"<FlushPackets>%d</FlushPackets>"
"<FlushWait>%d</FlushWait>"
"<Ping>%d</Ping>"
"<Smax>%d</Smax>"
"<Ttl>%d</Ttl>"
"<Timeout>%d</Timeout>"
"</Node>",
ou->mess.id, (int)sizeof(ou->mess.balancer), ou->mess.balancer, (int)sizeof(ou->mess.JVMRoute),
ou->mess.JVMRoute, (int)sizeof(ou->mess.Domain), ou->mess.Domain, (int)sizeof(ou->mess.Host),
ou->mess.Host, (int)sizeof(ou->mess.Port), ou->mess.Port, (int)sizeof(ou->mess.Type),
Expand All @@ -1715,8 +1717,9 @@ static char *process_dump(request_rec *r, int *errtype)
break;
case TEXT_PLAIN:
default:
ap_rprintf(r, "node: [%d:%d],Balancer: %.*s,JVMRoute: %.*s,LBGroup: [%.*s],Host: %.*s,Port: %.*s,\
Type: %.*s,flushpackets: %d,flushwait: %d,ping: %d,smax: %d,ttl: %d,timeout: %d\n",
ap_rprintf(r,
"node: [%d:%d],Balancer: %.*s,JVMRoute: %.*s,LBGroup: [%.*s],Host: %.*s,Port: %.*s,"
"Type: %.*s,flushpackets: %d,flushwait: %d,ping: %d,smax: %d,ttl: %d,timeout: %d\n",
id[i], ou->mess.id, (int)sizeof(ou->mess.balancer), ou->mess.balancer,
(int)sizeof(ou->mess.JVMRoute), ou->mess.JVMRoute, (int)sizeof(ou->mess.Domain), ou->mess.Domain,
(int)sizeof(ou->mess.Host), ou->mess.Host, (int)sizeof(ou->mess.Port), ou->mess.Port,
Expand Down Expand Up @@ -1770,11 +1773,12 @@ static char *process_dump(request_rec *r, int *errtype)

switch (type) {
case TEXT_XML:
ap_rprintf(r, "<Context id=\"%d\" path=\"%.*s\">\
<Vhost>%d</Vhost>\
<Node>%d</Node>\
<Status id=\"%d\">%s</Status>\
</Context>",
ap_rprintf(r,
"<Context id=\"%d\" path=\"%.*s\">"
"<Vhost>%d</Vhost>"
"<Node>%d</Node>"
"<Status id=\"%d\">%s</Status>"
"</Context>",
id[i], (int)sizeof(ou->context), ou->context, ou->vhost, ou->node, ou->status,
context_status_to_string(ou->status));
break;
Expand Down Expand Up @@ -1847,12 +1851,13 @@ static char *process_info(request_rec *r, int *errtype)

switch (type) {
case TEXT_XML:
ap_rprintf(r, "<Node id=\"%d\" name=\"%.*s\">\
<Balancer>%.*s</Balancer>\
<LBGroup>%.*s</LBGroup>\
<Host>%.*s</Host>\
<Port>%.*s</Port>\
<Type>%.*s</Type>",
ap_rprintf(r,
"<Node id=\"%d\" name=\"%.*s\">"
"<Balancer>%.*s</Balancer>"
"<LBGroup>%.*s</LBGroup>"
"<Host>%.*s</Host>"
"<Port>%.*s</Port>"
"<Type>%.*s</Type>",
id[i], (int)sizeof(ou->mess.JVMRoute), ou->mess.JVMRoute, (int)sizeof(ou->mess.balancer),
ou->mess.balancer, (int)sizeof(ou->mess.Domain), ou->mess.Domain, (int)sizeof(ou->mess.Host),
ou->mess.Host, (int)sizeof(ou->mess.Port), ou->mess.Port, (int)sizeof(ou->mess.Type),
Expand All @@ -1872,11 +1877,12 @@ static char *process_info(request_rec *r, int *errtype)

switch (type) {
case TEXT_XML:
ap_rprintf(r, "<Flushpackets>%s</Flushpackets>\
<Flushwait>%d</Flushwait>\
<Ping>%d</Ping>\
<Smax>%d</Smax>\
<Ttl>%d</Ttl>",
ap_rprintf(r,
"<Flushpackets>%s</Flushpackets>"
"<Flushwait>%d</Flushwait>"
"<Ping>%d</Ping>"
"<Smax>%d</Smax>"
"<Ttl>%d</Ttl>",
flushpackets, ou->mess.flushwait / 1000, (int)apr_time_sec(ou->mess.ping), ou->mess.smax,
(int)apr_time_sec(ou->mess.ttl));
break;
Expand All @@ -1896,12 +1902,13 @@ static char *process_info(request_rec *r, int *errtype)

switch (type) {
case TEXT_XML:
ap_rprintf(r, "<Elected>%d</Elected>\
<Read>%d</Read>\
<Transfered>%d</Transfered>\
<Connected>%d</Connected>\
<Load>%d</Load>\
</Node>",
ap_rprintf(r,
"<Elected>%d</Elected>"
"<Read>%d</Read>"
"<Transfered>%d</Transfered>"
"<Connected>%d</Connected>"
"<Load>%d</Load>"
"</Node>",
(int)proxystat->elected, (int)proxystat->read, (int)proxystat->transferred, (int)proxystat->busy,
proxystat->lbfactor);
break;
Expand Down Expand Up @@ -1932,9 +1939,10 @@ static char *process_info(request_rec *r, int *errtype)

switch (type) {
case TEXT_XML:
ap_rprintf(r, "<Vhost id=\"%d\" alias=\"%.*s\">\
<Node id=\"%d\"/>\
</Vhost>",
ap_rprintf(r,
"<Vhost id=\"%d\" alias=\"%.*s\">"
"<Node id=\"%d\"/>"
"</Vhost>",
ou->vhost, (int)sizeof(ou->host), ou->host, ou->node);
break;
case TEXT_PLAIN:
Expand Down Expand Up @@ -1966,12 +1974,13 @@ static char *process_info(request_rec *r, int *errtype)

switch (type) {
case TEXT_XML:
ap_rprintf(r, "<Context id=\"%d\">\
<Status id=\"%d\">%s</Status>\
<Context>%.*s</Context>\
<Node id=\"%d\"/>\
<Vhost id=\"%d\"/>\
</Context>",
ap_rprintf(r,
"<Context id=\"%d\">"
"<Status id=\"%d\">%s</Status>"
"<Context>%.*s</Context>"
"<Node id=\"%d\"/>"
"<Vhost id=\"%d\"/>"
"</Context>",
id[i], ou->status, context_status_to_string(ou->status), (int)sizeof(ou->context), ou->context,
ou->node, ou->vhost);
break;
Expand Down

0 comments on commit f023e4a

Please sign in to comment.