[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r10932: Patch from tup: translate LFs to CRLFs in NS replies and ens (in tor/trunk: . src/or)



Author: nickm
Date: 2007-07-25 18:57:02 -0400 (Wed, 25 Jul 2007)
New Revision: 10932

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/control.c
Log:
 r13907@catbus:  nickm | 2007-07-25 18:51:25 -0400
 Patch from tup: translate LFs to CRLFs in NS replies and
 ensures the data section is properly terminated with "\r\n.\r\n



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r13907] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-07-25 22:56:58 UTC (rev 10931)
+++ tor/trunk/ChangeLog	2007-07-25 22:57:02 UTC (rev 10932)
@@ -81,6 +81,7 @@
     - Provide DNS expiry times in GMT, not in local time.  For backward
       compatibility, ADDRMAP events only provide GMT expiry in an extended
       field.  "GETINFO address-mappings" always does the right thing.
+    - Use CRLF line endings properly in NS events.
 
 
 Changes in version 0.1.2.15 - 2007-07-17

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2007-07-25 22:56:58 UTC (rev 10931)
+++ tor/trunk/src/or/control.c	2007-07-25 22:57:02 UTC (rev 10932)
@@ -3159,7 +3159,7 @@
 control_event_networkstatus_changed(smartlist_t *statuses)
 {
   smartlist_t *strs;
-  char *s;
+  char *s, *esc = NULL;
   if (!EVENT_IS_INTERESTING(EVENT_NS) || !smartlist_len(statuses))
     return 0;
 
@@ -3171,17 +3171,14 @@
       if (!s) continue;
       smartlist_add(strs, s);
     });
-  smartlist_add(strs, tor_strdup("\r\n.\r\n"));
-  /* XXX020 the above strdup has an extra \r\n in it, resulting in
-   * a blank line in the NS output. Can we remove it, or is that
-   * bad since the output of networkstatus_getinfo_helper_single()
-   * only adds \n, not \r\n? */
 
   s = smartlist_join_strings(strs, "", 0, NULL);
+  write_escaped_data(s, strlen(s), 1, &esc);
   SMARTLIST_FOREACH(strs, char *, cp, tor_free(cp));
   smartlist_free(strs);
-  send_control_event_string(EVENT_NS, ALL_NAMES|ALL_FORMATS, s);
   tor_free(s);
+  send_control_event_string(EVENT_NS, ALL_NAMES|ALL_FORMATS, esc);
+  tor_free(esc);
   return 0;
 }