From b72b6cf387150e9c57ef2e5f7b9bc921d2e80a61 Mon Sep 17 00:00:00 2001
From: hniksic <devnull@localhost>
Date: Wed, 8 Nov 2000 01:15:40 -0800
Subject: [PATCH] [svn] Correctly handle URLs where / does not follow the host
 name. Published in <sxsn1fag6zu.fsf@florida.arsdigita.de>.

---
 src/ChangeLog | 5 +++++
 src/url.c     | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index ab60506e..526bc196 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2000-11-08  Hrvoje Niksic  <hniksic@arsdigita.com>
+
+	* url.c (construct): Handle the case where host name is not
+	followed by a slash.
+
 2000-11-06  Hrvoje Niksic  <hniksic@arsdigita.com>
 
 	* init.c: commands[] need to be sorted!  ("base" wasn't.)
diff --git a/src/url.c b/src/url.c
index 5095c444..8be11f21 100644
--- a/src/url.c
+++ b/src/url.c
@@ -1369,6 +1369,13 @@ construct (const char *url, const char *sub, int subsize, int no_proto)
 	      start_insert = end + 1;
 	      need_explicit_slash = 1;
 	    }
+	  else if (last_slash && last_slash != url && last_slash[-1] == '/')
+	    {
+	      /* example: http://host"  */
+	      /*                      ^ */
+	      start_insert = end + 1;
+	      need_explicit_slash = 1;
+	    }
 	  else
 	    {
 	      /* example: "whatever/foo/bar" */