Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WinHttpCrackURL - lpszHostName bug?

239 views
Skip to first unread message

Shuo Shen

unread,
Sep 18, 2001, 10:19:59 AM9/18/01
to
Hello,

When I call WinHttpCrackURL(L"http://localhost/temp/test.asp", 0, 0,
&UrlComp) )

The returned
UrlComp.lpszHostName is "localhost/temp/test.asp".

The UrlComp.dwHostNameLength is correct which is 9.

I think it should be "localhost", right?

And I am surprised to see that WinHttpCreateURL can create the same URL back
using the false data.

Thanks.


Ozgur Huseyinoglu

unread,
Sep 19, 2001, 8:38:00 PM9/19/01
to

If it's working in a way similar to its WinInet
counterpart("InternetCrackUrl "), I'd say, it's not a bug. The man pages
explain this:

<< [Regarding URL_COMPONENTS structure]....If the pointer to the value of
the component is NULL and the value of its corresponding length member is
nonzero, the address of the first character of the corresponding component
in the lpszUrl string is stored in the pointer, and the length of the
component is stored in the length member.>>

So, (if you don't allocate your own memory for pointer fields of
URL_COMPONENTS structure) "UrlComp.lpszHostName" will actually point to the
middle of that constant string in your program.

Regards,

Ozgur

Shuo Shen <no_spa...@softartisans.com> wrote in message
news:#8qxZ1EQBHA.1408@tkmsftngp05...

Bob Landau

unread,
Sep 24, 2001, 8:48:14 PM9/24/01
to
Shuo,

I've not seen how you're creating the below structure however given what
you're seeing I'd hazard to take a guess that you've not allocated any
buffers, set the pointers to NULL and set the size to something non-zero.
In this case the pointers point to substring within the URL that you've
given in the first parameter. This would make the hostname appear as
you've described.

thx
bob


This posting is provided “AS IS” with no warranties, and confers no rights.
You assume all risk for your use. © 2001 Microsoft Corporation. All rights
reserved.


--------------------
From: "Shuo Shen" <no_spa...@softartisans.com>
Subject: WinHttpCrackURL - lpszHostName bug?
Date: Tue, 18 Sep 2001 10:19:59 -0400
Lines: 18
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Message-ID: <#8qxZ1EQBHA.1408@tkmsftngp05>
Newsgroups: microsoft.public.winhttp
NNTP-Posting-Host: mail.softartisans.com 63.103.15.68
Path: cppssbbsa01.microsoft.com!tkmsftngp01!tkmsftngp05
Xref: cppssbbsa01.microsoft.com microsoft.public.winhttp:331
X-Tomcat-NG: microsoft.public.winhttp

0 new messages