| 69 | #endif |
| 70 | |
| 71 | static int proxy_balancer_canon(request_rec *r, char *url) |
| 72 | { |
| 73 | char *host; |
| 74 | apr_port_t port = 0; |
| 75 | const char *err; |
| 76 | |
| 77 | /* TODO: offset of BALANCER_PREFIX ?? */ |
| 78 | if (ap_cstr_casecmpn(url, "balancer:", 9) == 0) { |
| 79 | ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "canonicalising URL %s", url); |
| 80 | url += 9; |
| 81 | } |
| 82 | else { |
| 83 | return DECLINED; |
| 84 | } |
| 85 | |
| 86 | /* do syntatic check. |
| 87 | * We break the URL into host, port, path |
| 88 | */ |
| 89 | err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port); |
| 90 | if (err) { |
| 91 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01157) |
| 92 | "error parsing URL %s: %s", |
| 93 | url, err); |
| 94 | return HTTP_BAD_REQUEST; |
| 95 | } |
| 96 | |
| 97 | /* The canon_handler hooks are run per the BalancerMember in |
| 98 | * balancer_fixup(), keep the original/raw path for now. |
| 99 | */ |
| 100 | r->filename = apr_pstrcat(r->pool, "proxy:" BALANCER_PREFIX, |
| 101 | host, "/", url, NULL); |
| 102 | |
| 103 | return OK; |
| 104 | } |
| 105 | |
| 106 | static void init_balancer_members(apr_pool_t *p, server_rec *s, |
| 107 | proxy_balancer *balancer) |
nothing calls this directly
no test coverage detected