Skip to content

Commit 2c3e759

Browse files
authored
Merge pull request #263 from jajik/return-500
Use defined macro instead of magic contants
2 parents d0714c2 + eef34f7 commit 2c3e759

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

native/include/mod_proxy_cluster.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct balancer_method
4343
* @param r request_rec structure
4444
* @param id ident of the worker
4545
* @param load load factor to set if test is ok
46-
* @return 0: All OK 500 : Error
46+
* @return 0 in case of success, HTTP_INTERNAL_SERVER_ERROR otherwise
4747
*/
4848
int (*proxy_node_isup)(request_rec *r, int id, int load);
4949
/**
@@ -52,7 +52,7 @@ struct balancer_method
5252
* @param scheme something like ajp, http or https
5353
* @param host the hostname
5454
* @param port the port on which the node connector is running
55-
* @return 0: All OK 500 : Error
55+
* @return 0 in case of success, HTTP_INTERNAL_SERVER_ERROR otherwise
5656
*/
5757
int (*proxy_host_isup)(request_rec *r, const char *scheme, const char *host, const char *port);
5858
/**

native/mod_manager/mod_manager.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3411,7 +3411,7 @@ static int manager_handler(request_rec *r)
34113411

34123412
if (status != APR_SUCCESS) {
34133413
process_error(r, apr_psprintf(r->pool, SREADER, r->method), TYPESYNTAX);
3414-
return 500;
3414+
return HTTP_INTERNAL_SERVER_ERROR;
34153415
}
34163416
buff[bufsiz] = '\0';
34173417

@@ -3422,7 +3422,7 @@ static int manager_handler(request_rec *r)
34223422
ptr = process_buff(r, buff);
34233423
if (ptr == NULL) {
34243424
process_error(r, SMESPAR, TYPESYNTAX);
3425-
return 500;
3425+
return HTTP_INTERNAL_SERVER_ERROR;
34263426
}
34273427
if (strstr(r->filename, NODE_COMMAND)) {
34283428
global = 1;
@@ -3450,7 +3450,7 @@ static int manager_handler(request_rec *r)
34503450
/* Check error string and build the error message */
34513451
if (errstring) {
34523452
process_error(r, errstring, errtype);
3453-
return 500;
3453+
return HTTP_INTERNAL_SERVER_ERROR;
34543454
}
34553455

34563456
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "manager_handler: %s OK", r->method);

native/mod_proxy_cluster/mod_proxy_cluster.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,10 +1844,10 @@ static int proxy_node_isup(request_rec *r, int id, int load)
18441844
char *ptr;
18451845

18461846
if (node_storage->read_node(id, &node) != APR_SUCCESS) {
1847-
return 500;
1847+
return HTTP_INTERNAL_SERVER_ERROR;
18481848
}
18491849
if (node->mess.remove) {
1850-
return 500;
1850+
return HTTP_INTERNAL_SERVER_ERROR;
18511851
}
18521852

18531853
/* Calculate the address of our shared memory that corresponds to the stat info of the worker */
@@ -1875,7 +1875,7 @@ static int proxy_node_isup(request_rec *r, int id, int load)
18751875
if (worker == NULL) {
18761876
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
18771877
"proxy_cluster_isup: Can't find worker for %d. Check balancer names.", id);
1878-
return 500;
1878+
return HTTP_INTERNAL_SERVER_ERROR;
18791879
}
18801880

18811881
/* Try a ping/pong to check the node */
@@ -1887,7 +1887,7 @@ static int proxy_node_isup(request_rec *r, int id, int load)
18871887
if (worker->s->status & PROXY_WORKER_NOT_USABLE_BITMAP) {
18881888
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
18891889
"proxy_cluster_isup: health check says PROXY_WORKER_IN_ERROR");
1890-
return 500;
1890+
return HTTP_INTERNAL_SERVER_ERROR;
18911891
}
18921892

18931893
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy_cluster_isup: health check says OK");
@@ -1904,7 +1904,7 @@ static int proxy_node_isup(request_rec *r, int id, int load)
19041904
if (proxy_cluster_try_pingpong(r, worker, url, conf, node->mess.ping, node->mess.timeout) != APR_SUCCESS) {
19051905
worker->s->status |= PROXY_WORKER_IN_ERROR;
19061906
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy_cluster_isup: pingpong %s failed", url);
1907-
return 500;
1907+
return HTTP_INTERNAL_SERVER_ERROR;
19081908
}
19091909
}
19101910
}
@@ -1936,27 +1936,27 @@ static int proxy_host_isup(request_rec *r, const char *scheme, const char *host,
19361936
rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, 0, r->pool);
19371937
if (rv != APR_SUCCESS) {
19381938
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server, "proxy_host_isup: pingpong (apr_socket_create) failed");
1939-
return 500;
1939+
return HTTP_INTERNAL_SERVER_ERROR;
19401940
}
19411941
rv = apr_sockaddr_info_get(&to, host, APR_INET, nport, 0, r->pool);
19421942
if (rv != APR_SUCCESS) {
19431943
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server,
19441944
"proxy_host_isup: pingpong (apr_sockaddr_info_get(%s, %d)) failed", host, nport);
1945-
return 500;
1945+
return HTTP_INTERNAL_SERVER_ERROR;
19461946
}
19471947

19481948
rv = apr_socket_connect(sock, to);
19491949
if (rv != APR_SUCCESS) {
19501950
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy_host_isup: pingpong (apr_socket_connect) failed");
1951-
return 500;
1951+
return HTTP_INTERNAL_SERVER_ERROR;
19521952
}
19531953

19541954
/* XXX: For the moment we support only AJP */
19551955
if (strcasecmp(scheme, "AJP") == 0) {
19561956
rv = ajp_handle_cping_cpong(sock, r, apr_time_from_sec(10));
19571957
if (rv != APR_SUCCESS) {
19581958
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "proxy_host_isup: cping_cpong failed");
1959-
return 500;
1959+
return HTTP_INTERNAL_SERVER_ERROR;
19601960
}
19611961
} else {
19621962
ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, r->server, "proxy_host_isup: %s no yet supported", scheme);

0 commit comments

Comments
 (0)