| 427 | } |
| 428 | |
| 429 | static void create_hcheck_req(wctx_t *wctx, proxy_worker *hc, |
| 430 | apr_pool_t *p) |
| 431 | { |
| 432 | char *req = NULL; |
| 433 | const char *method = NULL; |
| 434 | const char *protocol = NULL; |
| 435 | |
| 436 | /* TODO: Fold into switch/case below? This seems more obvious */ |
| 437 | if ( (hc->s->method == OPTIONS11) || (hc->s->method == HEAD11) || (hc->s->method == GET11) ) { |
| 438 | protocol = "HTTP/1.1"; |
| 439 | } else { |
| 440 | protocol = "HTTP/1.0"; |
| 441 | } |
| 442 | switch (hc->s->method) { |
| 443 | case OPTIONS: |
| 444 | case OPTIONS11: |
| 445 | method = "OPTIONS"; |
| 446 | req = apr_psprintf(p, |
| 447 | "OPTIONS * %s\r\n" |
| 448 | "Host: %s:%d\r\n" |
| 449 | "\r\n", protocol, |
| 450 | hc->s->hostname_ex, (int)hc->s->port); |
| 451 | break; |
| 452 | |
| 453 | case HEAD: |
| 454 | case HEAD11: |
| 455 | method = "HEAD"; |
| 456 | /* fallthru */ |
| 457 | case GET: |
| 458 | case GET11: |
| 459 | if (!method) { /* did we fall thru? If not, we are GET */ |
| 460 | method = "GET"; |
| 461 | } |
| 462 | req = apr_psprintf(p, |
| 463 | "%s %s%s%s %s\r\n" |
| 464 | "Host: %s:%d\r\n" |
| 465 | "\r\n", |
| 466 | method, |
| 467 | (wctx->path ? wctx->path : ""), |
| 468 | (wctx->path && *hc->s->hcuri ? "/" : "" ), |
| 469 | (*hc->s->hcuri ? hc->s->hcuri : ""), |
| 470 | protocol, |
| 471 | hc->s->hostname_ex, (int)hc->s->port); |
| 472 | break; |
| 473 | |
| 474 | default: |
| 475 | break; |
| 476 | } |
| 477 | wctx->req = req; |
| 478 | wctx->method = method; |
| 479 | wctx->protocol = protocol; |
| 480 | } |
| 481 | |
| 482 | static proxy_worker *hc_get_hcworker(sctx_t *ctx, proxy_worker *worker, |
| 483 | apr_pool_t *p) |