View | Details | Raw Unified | Return to bug 38182
Collapse All | Expand All

(-)httpd-2.2.9-orig/modules/dav/main/util.c (-2 / +21 lines)
Lines 254-259 Link Here
254
        comp.hostname = apr_pstrcat(r->pool, comp.hostname, domain, NULL);
254
        comp.hostname = apr_pstrcat(r->pool, comp.hostname, domain, NULL);
255
    }
255
    }
256
256
257
    const char *host = apr_table_get(r->headers_in, "Host");
258
    if (NULL != host) {
259
    	char *port_str = strstr(host, ":");
260
    	int port;
261
262
    	if (port_str) {
263
    		*port_str = 0;
264
    		port_str++;
265
    		port = atoi(port_str);
266
    	} else {
267
    		port = ap_default_port(r);
268
    	}
269
270
    	if (port != comp.port || strcmp(host, comp.hostname) != 0) {
271
    		result.err.status = HTTP_BAD_GATEWAY;
272
    		return result;
273
    	}
274
    }
275
257
    /* now, if a hostname was provided, then verify that it represents the
276
    /* now, if a hostname was provided, then verify that it represents the
258
       same server as the current connection. note that we just use our
277
       same server as the current connection. note that we just use our
259
       port, since we've verified the URI matches ours */
278
       port, since we've verified the URI matches ours */
Lines 1419-1429 Link Here
1419
1438
1420
    retVal = ap_meets_conditions(r);
1439
    retVal = ap_meets_conditions(r);
1421
1440
1422
    /* If-None-Match '*' fix. If-None-Match '*' request should succeed 
1441
    /* If-None-Match '*' fix. If-None-Match '*' request should succeed
1423
     * if the resource does not exist. */
1442
     * if the resource does not exist. */
1424
    if (retVal == HTTP_PRECONDITION_FAILED) {
1443
    if (retVal == HTTP_PRECONDITION_FAILED) {
1425
        /* Note. If if_none_match != NULL, if_none_match is the culprit.
1444
        /* Note. If if_none_match != NULL, if_none_match is the culprit.
1426
         * Since, in presence of If-None-Match, 
1445
         * Since, in presence of If-None-Match,
1427
         * other If-* headers are undefined. */
1446
         * other If-* headers are undefined. */
1428
        if ((if_none_match =
1447
        if ((if_none_match =
1429
            apr_table_get(r->headers_in, "If-None-Match")) != NULL) {
1448
            apr_table_get(r->headers_in, "If-None-Match")) != NULL) {
(-)httpd-2.2.9-orig/modules/proxy/mod_proxy.c (+51 lines)
Lines 494-499 Link Here
494
    }
494
    }
495
    return ret;
495
    return ret;
496
}
496
}
497
498
static void proxy_trans_destination(request_rec *r)
499
{
500
	char *dest = apr_table_get(r->headers_in, "Destination");
501
	if (!dest)
502
		return;
503
504
505
    apr_uri_t dest_uri;
506
507
    if (apr_uri_parse(r->pool, dest, &dest_uri) != APR_SUCCESS) {
508
        return;
509
    }
510
511
    void *sconf = r->server->module_config;
512
    proxy_server_conf *conf =
513
    (proxy_server_conf *) ap_get_module_config(sconf, &proxy_module);
514
    int i, len;
515
    proxy_dir_conf *dconf = ap_get_module_config(r->per_dir_config,
516
                                                 &proxy_module);
517
518
    const char *fake;
519
    const char *real;
520
    struct proxy_alias *ent = (struct proxy_alias *) conf->aliases->elts;
521
522
    for (i = 0; i < conf->aliases->nelts; i++) {
523
        const char *use_uri = dest_uri.path;
524
        if ((dconf->interpolate_env == 1)
525
            && (ent[i].flags & PROXYPASS_INTERPOLATE)) {
526
            fake = proxy_interpolate(r, ent[i].fake);
527
            real = proxy_interpolate(r, ent[i].real);
528
        }
529
        else {
530
            fake = ent[i].fake;
531
            real = ent[i].real;
532
        }
533
534
        if (!ent[i].regex) {
535
        	len = alias_match(use_uri, fake);
536
			if (0 == len)
537
				continue;
538
539
        	use_uri = apr_pstrcat(r->pool, real, use_uri + len, NULL);
540
        	apr_table_set(r->headers_in, "Destination", use_uri);
541
        	return;
542
        }
543
    }
544
}
545
497
static int proxy_trans(request_rec *r)
546
static int proxy_trans(request_rec *r)
498
{
547
{
499
    void *sconf = r->server->module_config;
548
    void *sconf = r->server->module_config;
Lines 510-515 Link Here
510
    char *found = NULL;
559
    char *found = NULL;
511
    int mismatch = 0;
560
    int mismatch = 0;
512
561
562
    proxy_trans_destination(r);
563
513
    if (r->proxyreq) {
564
    if (r->proxyreq) {
514
        /* someone has already set up the proxy, it was possibly ourselves
565
        /* someone has already set up the proxy, it was possibly ourselves
515
         * in proxy_detect
566
         * in proxy_detect

Return to bug 38182