File tree Expand file tree Collapse file tree 2 files changed +42
-13
lines changed Expand file tree Collapse file tree 2 files changed +42
-13
lines changed Original file line number Diff line number Diff line change 11Version Changes for Hypermail
22~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+ ============================
5+ HYPERMAIL VERSION 2.4.1:
6+ ============================
7+
8+ 2020-06-12 Jose Kahan
9+ * src/parse.c
10+ URLs were not detected and converted when they were preceeded by a :
11+ that was not attached to a valid URL like foo: https://example.com or :
12+ https://example.com.
13+
314============================
415HYPERMAIL VERSION 2.4.0:
516============================
Original file line number Diff line number Diff line change @@ -1802,22 +1802,40 @@ char *parseurl(char *input, char *charset)
18021802 if (!input || !* input )
18031803 return NULL ;
18041804
1805- c = strstr (input , ":" );
1805+ /*
1806+ * All our protocol prefixes have this ":" substring in them. Most
1807+ * of the lines we process don't have any URL. Let's not spend any
1808+ * time looking for URLs in lines that we can prove cheaply don't
1809+ * have any; it will be a big win for average input if we follow
1810+ * this trivial heuristic.
1811+ */
18061812
1807- if (!c /* not found */
1808- || c == input /* first char in line */
1809- || * (c + 1 ) == '\0' /* last char in line */
1810- || !isalpha (* (c - 1 )) /* not between alpha/graph */
1811- || !isgraph (* (c + 1 ))) {
1812- /*
1813- * All our protocol prefixes have this ":" substring in them. Most
1814- * of the lines we process don't have any URL. Let's not spend any
1815- * time looking for URLs in lines that we can prove cheaply don't
1816- * have any; it will be a big win for average input if we follow
1817- * this trivial heuristic.
1818- */
1813+ first = FALSE;
1814+
1815+ c = strstr (input , ":" );
1816+ if (c == input ) { /* first char in line */
1817+ c ++ ;
1818+ c = strstr (c , ":" );
1819+ }
1820+
1821+ /* !c === not found */
1822+ while (c ) {
1823+ if (* (c + 1 ) == '\0' ) /* last char in line */
1824+ break ;
1825+ else if ( !isalpha (* (c - 1 )) /* not between alpha/graph */
1826+ || !isgraph (* (c + 1 ))) {
1827+ c ++ ;
1828+ c = strstr (c , ":" );
1829+ } else {
1830+ first = TRUE;
1831+ break ;
1832+ }
1833+ }
1834+
1835+ if (!first ) {
18191836 return convchars (input , charset );
18201837 }
1838+
18211839 INIT_PUSH (buff );
18221840
18231841 /*
You can’t perform that action at this time.
0 commit comments