Opened 4 months ago

Last modified 5 weeks ago

#26470 merge_ready defect

WARN: Saying "HTTP/1.0 405 Method Not Allowed\r\n\r\n" WARN: connection_mark_unattached_ap_(): Bug: stream (marked at src/or/connection_edge.c:2551) sending two socks replies? (on Tor 0.3.3.5-rc 81d71f0d41adf0d8)

Reported by: Tai683 Owned by: nickm
Priority: Medium Milestone: Tor: 0.3.4.x-final
Component: Core Tor/Tor Version: Tor: 0.3.3.5-rc
Severity: Minor Keywords: 032-backport 033-backport 034-backport fast-fix
Cc: Actual Points:
Parent ID: Points:
Reviewer: dgoulet Sponsor:

Description

WARN: Saying "HTTP/1.0 405 Method Not Allowed\r\n\r\n"
WARN: connection_mark_unattached_ap_(): Bug: stream (marked at src/or/connection_edge.c:2551) sending two socks replies? (on Tor 0.3.3.5-rc 81d71f0d41adf0d8)

Child Tickets

TicketStatusOwnerSummaryComponent
#27109closedrl1987Tor 0.3.5.0-alpha-dev: [warn] connection_mark_unattached_ap_(): Bug: stream (marked at ../src/core/or/connection_edge.c:2605) sending two socks replies?Core Tor/Tor

Change History (9)

comment:1 Changed 4 months ago by Dbryrtfbcbhgf

Can you post the complete bug log?

comment:2 Changed 4 months ago by Dbryrtfbcbhgf

Component: - Select a componentCore Tor/Tor

comment:3 Changed 4 months ago by teor

Keywords: regression? 033-backport-maybe 034-proposed added
Milestone: Tor: unspecified
Status: newneeds_information
Version: Tor: 0.3.3.5-rc

I don't know if we should fix this bug as part of 034.
Can someone triage?

comment:4 Changed 8 weeks ago by traumschule

$ git log --pretty=oneline -S "sending two socks replies?"
7a79acd9f6d377533940ee12fcb3afaaa982b04d clean up socks reply stuff more. add a few more reasons so we can be more informative.
$ git checkout 7a79acd9f6d377533940ee12fcb3afaaa982b04d
$ rgrep "sending two socks replies?"
src/or/connection_edge.c:      log_fn(LOG_WARN,"Bug: stream (marked at %s:%d) sending two socks replies?",                                                                                                                                                                          
test.log:Aug 12 19:53:09.000 [warn] connection_mark_unattached_ap_(): Bug: stream (marked at ../src/core/or/connection_edge.c:2605) sending two socks replies? (on Tor 0.3.5.0-alpha-dev )                                                                                                                                                                       

7a79acd9f6d377533940ee12fcb3afaaa982b04d is from 2005, looking at the first warning:

$ git log --pretty=oneline -S "HTTP/1.0 405 Method Not Allowed"
4b30ae158175a3a1cbbed4bb418e8ad9be1ba35e Add support for HTTP Connect tunnels
$ gitk

Author: Nick Mathewson <nickm@…> 2017-08-20 17:59:58
Follows: tor-0.3.1.3-alpha
Precedes: tor-0.3.2.1-alpha

+  socks->command = SOCKS_COMMAND_CONNECT;
+  socks->listener_type = CONN_TYPE_AP_HTTP_CONNECT_LISTENER;
+  strlcpy(socks->address, addr, sizeof(socks->address));
+  socks->port = port;
+
+  control_event_stream_status(conn, STREAM_EVENT_NEW, 0);
+
+  rv = connection_ap_rewrite_and_attach_if_allowed(conn, NULL, NULL);
+
+  // XXXX send a "100 Continue" message?
+
+  goto done;
+
+ err:
+  if (BUG(errmsg == NULL))
+    errmsg = "HTTP/1.0 400 Bad Request\r\n\r\n";
+  log_warn(LD_EDGE, "Saying %s", escaped(errmsg));
+  connection_write_to_buf(errmsg, strlen(errmsg), ENTRY_TO_CONN(conn));
+  connection_mark_unattached_ap(conn,
+                                END_STREAM_REASON_HTTPPROTOCOL|
+                                END_STREAM_REASON_FLAG_ALREADY_SOCKS_REPLIED);

comment:5 Changed 8 weeks ago by nickm

Milestone: Tor: unspecifiedTor: 0.3.4.x-final

comment:6 Changed 8 weeks ago by nickm

Keywords: 032-backport 033-backport 034-backport fast-fix added; regression? 033-backport-maybe 034-proposed removed
Milestone: Tor: 0.3.4.x-finalTor: 0.3.5.x-final
Owner: set to nickm
Status: needs_informationaccepted

comment:7 Changed 8 weeks ago by nickm

Severity: NormalMinor
Status: acceptedneeds_review

Bugfix in bug26470_032; PR at https://github.com/torproject/tor/pull/285

comment:8 Changed 5 weeks ago by dgoulet

Reviewer: dgoulet
Status: needs_reviewmerge_ready

lgtm;

comment:9 Changed 5 weeks ago by nickm

Milestone: Tor: 0.3.5.x-finalTor: 0.3.4.x-final

Merging to master; marking for backport.

Note: See TracTickets for help on using tickets.