HttpAddRequestHeaderAuthorizationBasic

Adds the “Authorization: Basic” header to the HTTP request.

Syntax

    #include <httpexp.h>
    #include <httpclnt.h> 
     
    int HttpAddRequestHeaderAuthorizationBasic (
       HINTERNET   hndl,
       char       *pzUsername,
       char       *pzPassword);
    

Parameters

hndl
(IN) Specifies the connection handle returned from HttpConnect.
pzUsername
(IN) Points to an ASCIIZ string containing the user's name.
pzPassword
(IN) Points to an ASCIIZ string containing the user's password.

Return Values

If successful, returns 0. Otherwise, returns a nonzero error code.

Decimal

Name

Description

1

ERR_INSUFFICIENT_SPACE

Insufficient space in the response header.

168

ERR_ACCESS_DENIED

The session is not opened.

255

ERR_BAD_PARAMETER

An invalid parameter was passed to the function.

Remarks

The HttpAddRequestHeaderAuthorizationBasic function uuencodes the name and password and adds them to the end of the tag.

WARNING:This function should be used only on secure connections because uuencoding is not a form of encryption, and the username and password are easily extracted from unencrypted packets.

See Also