Revision 733:c7a731db96e5 extra/soundsoftware

View differences:

extra/soundsoftware/SoundSoftware.pm
245 245
	# fall through
246 246
    }
247 247

  
248
    my $cfg = Apache2::Module::get_config
249
        (__PACKAGE__, $r->server, $r->per_dir_config);
248 250
    if ($cfg->{SoundSoftwareSslRequired} eq "on") {
249 251
	if ($r->dir_config('HTTPS') eq "on") {
250 252
	    return OK;
251 253
	} else {
252 254
	    my $redir_to = "https://" . $r->hostname() . $r->unparsed_uri();
253 255
	    print STDERR "SoundSoftware.pm:$$: Need to switch to HTTPS, redirecting to $redir_to\n";
254
	    $r->header_out(Location => $redir_to);
256
	    $r->headers_out->add('Location' => $redir_to);
255 257
	    return REDIRECT;
256 258
	}
257
    } else if ($cfg->{SoundSoftwareSslRequired} eq "off") {
259
    } elsif ($cfg->{SoundSoftwareSslRequired} eq "off") {
258 260
	return OK;
259 261
    } else {
260 262
	print STDERR "WARNING: SoundSoftware.pm:$$: SoundSoftwareSslRequired should be either 'on' or 'off'\n";
......
508 510
    # to project identifier if any are found
509 511
    if ($name =~ m/[^\w\d\s\._-]/) {
510 512
	$name = $project_id;
513
    } elsif ($name =~ m/^\s*$/) {
514
	# empty or whitespace
515
	$name = $project_id;
516
    }
517
    
518
    if ($name =~ m/^\s*$/) {
519
        # nothing even in $project_id -- probably a nonexistent project.
520
        # use repo name instead (don't want to admit to user that project
521
        # doesn't exist)
522
        my $location = $r->location;
523
        my ($repo) = $r->uri =~ m{$location/*([^/]+)};
524
        $name = $repo;
511 525
    }
512 526

  
513 527
    my $realm = '"Mercurial repository for ' . "'$name'" . '"';

Also available in: Unified diff