aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_edge.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-04-01 02:41:41 +0000
committerRoger Dingledine <arma@torproject.org>2004-04-01 02:41:41 +0000
commit36ff23209bcbb438234d8c4739f6fe769d9f4ba7 (patch)
tree692e62ad89b7c3813db061c83cc8a836a681cc9e /src/or/connection_edge.c
parentd13857a3f0e7c9970cd93166459a035969751642 (diff)
downloadtor-36ff23209bcbb438234d8c4739f6fe769d9f4ba7.tar
tor-36ff23209bcbb438234d8c4739f6fe769d9f4ba7.tar.gz
let alice recognize a y.onion address and, uhm, do something
svn:r1422
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r--src/or/connection_edge.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 7985edb03..08c009bd9 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -696,6 +696,7 @@ static void connection_edge_consider_sending_sendme(connection_t *conn) {
}
}
+/* return -1 if an unexpected error with conn, else 0. */
static int connection_ap_handshake_process_socks(connection_t *conn) {
socks_request_t *socks;
int sockshere;
@@ -724,9 +725,27 @@ static int connection_ap_handshake_process_socks(connection_t *conn) {
return sockshere;
} /* else socks handshake is done, continue processing */
- conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
- /* attaching to a dirty circuit is fine */
- return connection_ap_handshake_attach_circuit(conn,0);
+ /* this call _modifies_ socks->address iff it's a hidden-service request */
+ if (rend_parse_rendezvous_address(socks->address) < 0) {
+ /* normal request */
+ conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
+ /* attaching to a dirty circuit is fine */
+ return connection_ap_handshake_attach_circuit(conn,0);
+ } else {
+ /* it's a hidden-service request */
+ const char *descp;
+ int desc_len;
+
+ /* see if we already have it cached */
+ if (rend_cache_lookup(socks->address, &descp, &desc_len) == 1) {
+ /* then pick and launch a rendezvous circuit */
+ /* go into some other state */
+ } else {
+ /* initiate a dir hidserv desc lookup */
+ /* go into a state where you'll be notified of the answer */
+ }
+ }
+ return 0;
}
static int connection_ap_handshake_attach_circuit(connection_t *conn,