2
* ====================================================================
3
* Licensed to the Apache Software Foundation (ASF) under one
4
* or more contributor license agreements. See the NOTICE file
5
* distributed with this work for additional information
6
* regarding copyright ownership. The ASF licenses this file
7
* to you under the Apache License, Version 2.0 (the
8
* "License"); you may not use this file except in compliance
9
* with the License. You may obtain a copy of the License at
11
* http://www.apache.org/licenses/LICENSE-2.0
13
* Unless required by applicable law or agreed to in writing,
14
* software distributed under the License is distributed on an
15
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
* KIND, either express or implied. See the License for the
17
* specific language governing permissions and limitations
19
* ====================================================================
23
#include <http_core.h>
24
#include <http_config.h>
25
#include <http_request.h>
26
#include <http_protocol.h>
29
#include "private/svn_cache.h"
30
#include "private/svn_fs_private.h"
32
#ifndef DEFAULT_TIME_FORMAT
33
#define DEFAULT_TIME_FORMAT "%Y-%m-%d %H:%M:%S %Z"
36
/* A bit like mod_status: add a location:
38
<Location /svn-status>
42
and then point a browser at http://server/svn-status.
44
int dav_svn__status(request_rec *r)
46
svn_cache__info_t *info;
47
svn_string_t *text_stats;
48
apr_array_header_t *lines;
51
if (r->method_number != M_GET || strcmp(r->handler, "svn-status"))
54
info = svn_cache__membuffer_get_global_info(r->pool);
55
text_stats = svn_cache__format_info(info, FALSE, r->pool);
56
lines = svn_cstring_split(text_stats->data, "\n", FALSE, r->pool);
58
ap_set_content_type(r, "text/html; charset=ISO-8859-1");
63
"<title>Apache SVN Status</title>\n"
65
"<h1>Apache SVN Cache Status for ",
66
ap_escape_html(r->pool, ap_get_server_name(r)),
68
r->connection->local_ip,
69
")</h1>\n<dl>\n<dt>Server Version: ",
70
ap_get_server_description(),
71
"</dt>\n<dt>Current Time: ",
72
ap_ht_time(r->pool, apr_time_now(), DEFAULT_TIME_FORMAT, 0),
73
"</dt>\n", SVN_VA_NULL);
75
#if !defined(WIN32) && defined(HAVE_UNISTD_H) && defined(HAVE_GETPID)
76
/* On Unix the server is generally multiple processes and this
77
request only shows the status of the single process that handles
78
the request. Ideally we would iterate over all processes but that
79
would need some MPM support, so we settle for simply showing the
82
ap_rprintf(r, "<dt>Server process id: %d</dt>\n", (int)getpid());
85
for (i = 0; i < lines->nelts; ++i)
87
const char *line = APR_ARRAY_IDX(lines, i, const char *);
88
ap_rvputs(r, "<dt>", line, "</dt>\n", SVN_VA_NULL);
91
ap_rvputs(r, "</dl></body></html>\n", SVN_VA_NULL);