The bug in URL.cc (htcommon folder)

"Denis Sidorenko" <[email protected]> Tue, 20 Feb 2007 21:49:46 +0300
Newsgroups gmane.comp.web.htdig.devel
Message-ID <[email protected]>
--===============1831525261==
Content-Type: multipart/alternative; 
	boundary="----=_Part_52880_16503966.1171997386032"

------=_Part_52880_16503966.1171997386032
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I have found the bug in URL.cc file.

Method: URL::URL(const String &url, const URL &parent)
if parent ULR is like: "http://telur.ru/catalog.php?cat_id=2204"
and url like: "?cat_id=2204&page=4" then
IE and Firefox resolve URL to: "
http://telur.ru/catalog.php?cat_id=2204&page=4", but htdig resolves it to: "
http://telur.ru/?cat_id=2204&page=4"

It is fixed very simple:
instead of:

...
if (_path.last() == '/')
{
        //
        // Parent was a directory.  Easy enough: just append
        // the current ref to it
        //
        _path << ref;
}
...

should be:

...
if (_path.last() == '/' || *rel=='?')
{
        //
        // Parent was a directory.  Easy enough: just append
        // the current ref to it
        //
        _path << ref;
}
...

Hope it helps. I've tested this version. All works fine for me.
Please, let me know if I'm wrong.

Best regards,
Denis Sidorenko,
Russia(Moscow)

------=_Part_52880_16503966.1171997386032
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I have found the bug in URL.cc file.<br><br>Method: URL::URL(const String &amp;url, const URL &amp;parent) <br>if parent ULR is like: &quot;<a href="http://telur.ru/catalog.php?cat_id=2204">http://telur.ru/catalog.php?cat_id=2204
</a>&quot;<br>and url like: &quot;?cat_id=2204&amp;page=4&quot; then <br>IE and Firefox resolve URL to: &quot;<a href="http://telur.ru/catalog.php?cat_id=2204&amp;page=4">http://telur.ru/catalog.php?cat_id=2204&amp;page=4
</a>&quot;, but htdig resolves it to: &quot;<a href="http://telur.ru/?cat_id=2204&amp;page=4">http://telur.ru/?cat_id=2204&amp;page=4</a>&quot;<br><br>It is fixed very simple:<br>instead of:<br><br>...<br>if (_path.last() == &#39;/&#39;)
<br>{<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Parent was a directory.&nbsp; Easy enough: just append<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // the current ref to it<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _path &lt;&lt; ref;<br>} <br>...<br><br>should be:<br><br>...<br>
if (_path.last() == &#39;/&#39; || *rel==&#39;?&#39;)<br>
{<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Parent was a directory.&nbsp; Easy enough: just append<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // the current ref to it<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _path &lt;&lt; ref;<br>
} <br>
...<br><br>Hope it helps. I&#39;ve tested this version. All works fine for me.<br>Please, let me know if I&#39;m wrong.<br><br>Best regards,<br>Denis Sidorenko,<br>Russia(Moscow)<br><br>

------=_Part_52880_16503966.1171997386032--


--===============1831525261==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
--===============1831525261==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ht://Dig Developer mailing list:
[email protected]
List information (subscribe/unsubscribe, etc.)
https://lists.sourceforge.net/lists/listinfo/htdig-dev
--===============1831525261==--