HTTPNeedsAuth Function

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
HTTPNeedsAuth Function
C
BYTE HTTPNeedsAuth(
    BYTE* cFile
);
Description

This function is implemented by the application developer in CustomHTTPApp.c. Its function is to determine if a file being requested requires authentication to view. The user name and password, if supplied, will arrive later with the request headers, and will be processed at that time. 

Return values 0x80 - 0xff indicate that authentication is not required, while values from 0x00 to 0x79 indicate that a user name and password are required before proceeding. While most applications will only use a single value to grant access and another to require authorization, the range allows multiple "realms" or sets of pages to be protected, with different credential requirements for each. 

The return value of this function is saved as curHTTP.isAuthorized, and will be available to future callbacks, including HTTPCheckAuth and any of the HTTPExecuteGet, HTTPExecutePost, or HTTPPrint_varname callbacks.

Preconditions

None

Parameters
Parameters 
Description 
cFile 
the name of the file being requested 
Return Values
Return Values 
Description 
<= 0x79 
valid authentication is required 
>= 0x80 
access is granted for this connection 
Remarks

This function may NOT write to the TCP buffer. 

 

Microchip TCP/IP Stack 5.42.08 - June 15, 2013
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.