summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-02-15 02:26:50 +0000
committerJeffrey Stedfast <fejj@src.gnome.org>2003-02-15 02:26:50 +0000
commitd6632dd21618f852fdc08727ff838555c5cf9483 (patch)
treed410aae300dc64833c6530b3c484c6e5cb417162
parente25854da53b55dfbcb3b382f599de0446a580c64 (diff)
downloadgmime-d6632dd21618f852fdc08727ff838555c5cf9483.tar.gz
If the file:// url is preceded with some sort of brace, when scanning for
2003-02-14 Jeffrey Stedfast <fejj@ximian.com> * gmime/url-scanner.c (g_url_file_end): If the file:// url is preceded with some sort of brace, when scanning for the end of the url - take this into consideration. (g_url_web_end): Same. 2003-02-13 Jeffrey Stedfast <fejj@ximian.com> * gmime/gmime-gpg-context.c: #include <sys/time.h>
-rw-r--r--ChangeLog11
-rw-r--r--gmime/gmime-gpg-context.c1
-rw-r--r--gmime/url-scanner.c37
3 files changed, 47 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 17cb0d47..230a3589 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2003-02-14 Jeffrey Stedfast <fejj@ximian.com>
+
+ * gmime/url-scanner.c (g_url_file_end): If the file:// url is
+ preceded with some sort of brace, when scanning for the end of the
+ url - take this into consideration.
+ (g_url_web_end): Same.
+
+2003-02-13 Jeffrey Stedfast <fejj@ximian.com>
+
+ * gmime/gmime-gpg-context.c: #include <sys/time.h>
+
2003-02-12 Jeffrey Stedfast <fejj@ximian.com>
* gmime/url-scanner.c: Fixed the table to treat >=127 as a CTRL
diff --git a/gmime/gmime-gpg-context.c b/gmime/gmime-gpg-context.c
index 99b9f18e..f77ec156 100644
--- a/gmime/gmime-gpg-context.c
+++ b/gmime/gmime-gpg-context.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/time.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
diff --git a/gmime/url-scanner.c b/gmime/url-scanner.c
index bb8fb10d..3c68c2c8 100644
--- a/gmime/url-scanner.c
+++ b/gmime/url-scanner.c
@@ -227,6 +227,33 @@ g_url_addrspec_end (const char *in, const char *pos, const char *inend, urlmatch
return TRUE;
}
+
+static struct {
+ char open;
+ char close;
+} url_braces[] = {
+ { '(', ')' },
+ { '{', '}' },
+ { '[', ']' },
+ { '<', '>' },
+};
+
+static char
+url_stop_at_brace (const char *in, size_t so)
+{
+ int i;
+
+ if (so > 0) {
+ for (i = 0; i < 4; i++) {
+ if (in[so - 1] == url_braces[i].open)
+ return url_braces[i].close;
+ }
+ }
+
+ return '\0';
+}
+
+
gboolean
g_url_file_start (const char *in, const char *pos, const char *inend, urlmatch_t *match)
{
@@ -239,13 +266,16 @@ gboolean
g_url_file_end (const char *in, const char *pos, const char *inend, urlmatch_t *match)
{
register const char *inptr = pos;
+ char close_brace;
inptr += strlen (match->pattern);
if (*inptr == '/')
inptr++;
- while (inptr < inend && is_urlsafe (*inptr))
+ close_brace = url_stop_at_brace (in, match->um_so);
+
+ while (inptr < inend && is_urlsafe (*inptr) && *inptr != close_brace)
inptr++;
if (inptr == pos)
@@ -269,9 +299,12 @@ g_url_web_end (const char *in, const char *pos, const char *inend, urlmatch_t *m
{
register const char *inptr = pos;
int parts = 0, digits, port;
+ char close_brace;
inptr += strlen (match->pattern);
+ close_brace = url_stop_at_brace (in, match->um_so);
+
/* find the end of the domain */
if (is_digit (*inptr)) {
/* domain-literal */
@@ -326,7 +359,7 @@ g_url_web_end (const char *in, const char *pos, const char *inend, urlmatch_t *m
case '/': /* we've detected a path component to our url */
inptr++;
- while (inptr < inend && is_urlsafe (*inptr))
+ while (inptr < inend && is_urlsafe (*inptr) && *inptr != close_brace)
inptr++;
break;