diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-01-10 19:24:40 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-01-10 19:24:40 +0000 |
commit | 2fda7140e832f47c97b601a159f8b6f7e0f48a51 (patch) | |
tree | d09dff6e52c9575ce467c80af05255a428d1270e | |
parent | ba1968d028448c456f10ba157297d82a8bd0e971 (diff) | |
download | tor-2fda7140e832f47c97b601a159f8b6f7e0f48a51.tar.gz tor-2fda7140e832f47c97b601a159f8b6f7e0f48a51.zip |
Fix bug 221 and bug 201: For 221, check return value from connection_add() when adding a rendezvous post connection. For 201, do not include a content-length 0 with a GET request.
svn:r5765
-rw-r--r-- | src/or/directory.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index d4ff04e8df..8ece4ad633 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -451,8 +451,12 @@ directory_initiate_command(const char *address, uint32_t addr, return; } + if (connection_add(conn) < 0) { + warn(LD_NET,"Unable to add AP bridge to dirserver."); + connection_mark_for_close(conn); + return; + } conn->state = DIR_CONN_STATE_CLIENT_SENDING; - connection_add(conn); /* queue the command on the outbuf */ directory_send_command(conn, platform, purpose, resource, payload, payload_len); @@ -580,11 +584,18 @@ directory_send_command(connection_t *conn, const char *platform, connection_write_to_buf(url, strlen(url), conn); tor_free(url); - tor_snprintf(request, sizeof(request), - " HTTP/1.0\r\nContent-Length: %lu\r\nHost: %s%s\r\n\r\n", - payload ? (unsigned long)payload_len : 0, - hoststring, - proxyauthstring); + if (!strcmp(httpcommand, "GET") && !payload) { + tor_snprintf(request, sizeof(request), + " HTTP/1.0\r\nHost: %s%s\r\n\r\n", + hoststring, + proxyauthstring); + } else { + tor_snprintf(request, sizeof(request), + " HTTP/1.0\r\nContent-Length: %lu\r\nHost: %s%s\r\n\r\n", + payload ? (unsigned long)payload_len : 0, + hoststring, + proxyauthstring); + } connection_write_to_buf(request, strlen(request), conn); if (payload) { |