Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mike Perry
Tor
Commits
abf9fadc
Commit
abf9fadc
authored
Dec 22, 2007
by
Roger Dingledine
Browse files
start working on serving bridge status from the dirport, for
bridge communities. svn:r12927
parent
a02d18f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/or/config.c
View file @
abf9fadc
...
...
@@ -151,6 +151,7 @@ static config_var_t _option_vars[] = {
V
(
BandwidthRate
,
MEMUNIT
,
"5 MB"
),
V
(
BridgeAuthoritativeDir
,
BOOL
,
"0"
),
VAR
(
"Bridge"
,
LINELIST
,
Bridges
,
NULL
),
V
(
BridgePassword
,
STRING
,
NULL
),
V
(
BridgeRecordUsageByCountry
,
BOOL
,
"1"
),
V
(
BridgeRelay
,
BOOL
,
"0"
),
V
(
CircuitBuildTimeout
,
INTERVAL
,
"1 minute"
),
...
...
src/or/directory.c
View file @
abf9fadc
...
...
@@ -2290,7 +2290,7 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
if
(
!
strcmpstart
(
url
,
"/tor/status-vote/current/"
)
||
!
strcmpstart
(
url
,
"/tor/status-vote/next/"
))
{
/* XXXX If-modified-since is only
the
implemented for the current
/* XXXX If-modified-since is only implemented for the current
* consensus: that's probably fine, since it's the only vote document
* people fetch much.*/
int
current
=
1
;
...
...
@@ -2592,6 +2592,35 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
goto
done
;
}
if
(
options
->
BridgeAuthoritativeDir
&&
options
->
BridgePassword
&&
!
strcmp
(
url
,
"/tor/networkstatus-bridges"
))
{
char
*
status
;
size_t
len
;
header
=
http_get_header
(
headers
,
"Authenticator: "
);
if
(
!
header
)
{
write_http_status_line
(
conn
,
404
,
"Not found"
);
goto
done
;
}
/* now make sure the password is right */
if
(
1
)
{
// check password_is_wrong(header)
write_http_status_line
(
conn
,
404
,
"Not found"
);
tor_free
(
header
);
goto
done
;
}
/* all happy now. send an answer. */
status
=
networkstatus_getinfo_by_purpose
(
"bridge"
,
time
(
NULL
));
len
=
strlen
(
status
);
write_http_response_header
(
conn
,
len
,
0
,
0
);
connection_write_to_buf
(
status
,
len
,
TO_CONN
(
conn
));
tor_free
(
status
);
goto
done
;
}
if
(
!
strcmpstart
(
url
,
"/tor/bytes.txt"
))
{
char
*
bytes
=
directory_dump_request_log
();
size_t
len
=
strlen
(
bytes
);
...
...
src/or/or.h
View file @
abf9fadc
...
...
@@ -2089,6 +2089,12 @@ typedef struct {
int
BridgeAuthoritativeDir
;
/**< Boolean: is this an authoritative directory
* that aggregates bridge descriptors? */
/** If set on a bridge authority, it will answer requests on its dirport
* for bridge statuses -- but only if the requests use this password.
* If set on a bridge user, request bridge statuses, and use this password
* when doing so. */
char
*
BridgePassword
;
int
UseBridges
;
/**< Boolean: should we start all circuits with a bridge? */
config_line_t
*
Bridges
;
/**< List of bootstrap bridge addresses. */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment