URL_COMPONENTS structure (winhttp.h)

The URL_COMPONENTS structure contains the constituent parts of a URL. This structure is used with the WinHttpCrackUrl and WinHttpCreateUrl functions.

Syntax

typedef struct _WINHTTP_URL_COMPONENTS {
  DWORD           dwStructSize;
  LPWSTR          lpszScheme;
  DWORD           dwSchemeLength;
  INTERNET_SCHEME nScheme;
  LPWSTR          lpszHostName;
  DWORD           dwHostNameLength;
  INTERNET_PORT   nPort;
  LPWSTR          lpszUserName;
  DWORD           dwUserNameLength;
  LPWSTR          lpszPassword;
  DWORD           dwPasswordLength;
  LPWSTR          lpszUrlPath;
  DWORD           dwUrlPathLength;
  LPWSTR          lpszExtraInfo;
  DWORD           dwExtraInfoLength;
} URL_COMPONENTS, *LPURL_COMPONENTS;

Members

dwStructSize

Size of this structure, in bytes. Used for version checking. The size of this structure must be set to initialize this structure properly.

lpszScheme

Pointer to a string value that contains the scheme name.

dwSchemeLength

Length of the scheme name, in characters.

nScheme

Internet protocol scheme. This member can be one of the following values.

Value Meaning
INTERNET_SCHEME_HTTP
1
The Internet scheme is the HTTP protocol. See RFC 2616 for more information.
INTERNET_SCHEME_HTTPS
2
The Internet scheme, HTTPS, is an HTTP protocol that uses secure transaction semantics.

lpszHostName

Pointer to a string value that contains the host name.

dwHostNameLength

Length of the host name, in characters.

nPort

Port number.

lpszUserName

Pointer to a string that contains the user name.

dwUserNameLength

Length of the user name, in characters.

lpszPassword

Pointer to a string that contains the password.

dwPasswordLength

Length of the password, in characters.

lpszUrlPath

Pointer to a string that contains the URL path.

dwUrlPathLength

Length of the URL path, in characters.

lpszExtraInfo

Pointer to a string value that contains the extra information, for example, ?something or #something.

dwExtraInfoLength

Unsigned long integer value that contains the length of the extra information, in characters.

Remarks

For the WinHttpCrackUrl function, if a pointer member and its corresponding length member are both zero, that component of the URL is not returned. If the pointer member is NULL but the length member is not zero, both the pointer and length members are returned. If both pointer and corresponding length members are nonzero, the pointer member points to a buffer where the component is copied. All escape sequences can be removed from a component, depending on the dwFlags parameter of WinHttpCrackUrl.

For the WinHttpCreateUrl function, the pointer members should be NULL if the component of the URL is not required. If the corresponding length member is zero, the pointer member is the pointer to a zero-terminated string. If the length member is not zero, it is the string length of the corresponding pointer member.

Note  For Windows XP and Windows 2000, see the Run-Time Requirements section of the WinHttp start page.
 

Requirements

Requirement Value
Minimum supported client Windows XP, Windows 2000 Professional with SP3 [desktop apps only]
Minimum supported server Windows Server 2003, Windows 2000 Server with SP3 [desktop apps only]
Header winhttp.h
Redistributable WinHTTP 5.0 and Internet Explorer 5.01 or later on Windows XP and Windows 2000.

See also

WinHTTP Versions