| 
					
				 | 
			
			
				@@ -316,7 +316,7 @@ connection_dir_download_networkstatus_failed(connection_t *conn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * failed, and possibly retry them later.*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     smartlist_t *failed = smartlist_create(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     dir_split_resource_into_fingerprints(conn->requested_resource+3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                         failed, NULL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                         failed, NULL, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (smartlist_len(failed)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       dir_networkstatus_download_failed(failed); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       SMARTLIST_FOREACH(failed, char *, cp, tor_free(cp)); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -956,7 +956,7 @@ connection_dir_client_reached_eof(connection_t *conn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         !strcmpstart(conn->requested_resource,"fp/")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       which = smartlist_create(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       dir_split_resource_into_fingerprints(conn->requested_resource+3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                           which, NULL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           which, NULL, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     cp = body; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     while (*cp) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -993,7 +993,7 @@ connection_dir_client_reached_eof(connection_t *conn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         !strcmpstart(conn->requested_resource,"fp/")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       which = smartlist_create(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       dir_split_resource_into_fingerprints(conn->requested_resource+3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                           which, NULL); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                           which, NULL, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       n_asked_for = smartlist_len(which); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (status_code != 200) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1653,11 +1653,14 @@ dir_routerdesc_download_failed(smartlist_t *failed) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* Given a directory <b>resource</b> request generated by us, containing zero 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * or more strings separated by plus signs, followed optionally by ".z", store 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * the strings, in order, into <b>fp_out</b>.  If <b>compressed_out</b> is 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- * non-NULL, set it to 1 if the resource ends in ".z", else set it to 0. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * non-NULL, set it to 1 if the resource ends in ".z", else set it to 0.  If 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * decode_hex is true, then delete all elements that aren't hex digests, and 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * decode the rest. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 int 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 dir_split_resource_into_fingerprints(const char *resource, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                     smartlist_t *fp_out, int *compressed_out) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                     smartlist_t *fp_out, int *compressed_out, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                     int decode_hex) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   smartlist_split_string(fp_out, resource, "+", 0, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (compressed_out) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -1671,6 +1674,25 @@ dir_split_resource_into_fingerprints(const char *resource, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         *compressed_out = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (decode_hex) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    int i; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    char *cp, *d; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    for (i = 0; i < smartlist_len(fp_out); ++i) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      cp = smartlist_get(fp_out, i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (strlen(cp) != HEX_DIGEST_LEN) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        smartlist_del(fp_out, i--); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      d = tor_malloc_zero(DIGEST_LEN); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (base16_decode(d, DIGEST_LEN, cp, HEX_DIGEST_LEN)<0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        tor_free(d); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        smartlist_del(fp_out, i--); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      tor_free(cp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      smartlist_set(fp_out, i, d); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |