$customHeader
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

This hook function can be called every time a new request has been received and processed as shown in the figure Hook Functions. This function can restrict the access to some resource by analyzing the connection parameter such as remote IP address, the method, resource requested, HTTP header fields, etc. It is also possible in this hook function to redirect to another file. If the upper application require memory or any specific resource to process the request it should be allocated into this hook function.

Prototype

Arguments

p_instance

Pointer to the instance structure (read only).

p_conn

Pointer to the connection structure.

Return Values

DEF_YES,

If the client is authorized to access the requested resource

DEF_NO,

otherwise, Status code returned will be set automatically to unauthorized

Required Configuration

See Connection Hook Functions.

Notes / Warnings

  • The instance structure is for read-only. It must not be modified at any point in this hook function.
  • The following connection attributes can be accessed to analyze the connection (see section “HTTPs_CONN” on page 51 for further details on each parameters):
    • ClientAddr
    • Method
    • FileNamePtr
    • ReqHdrCtr
    • ReqHdrFirstPtr
  • In this hook function, only the under-mentioned connection parameters are allowed to be modified (see section “HTTPs_CONN” on page 51 for further details on each parameters):
    • StatusCode
    • FileNamePtr
    • FilePtr
    • FileType
    • FileLen
    • ConnDataPtr

Example Template

Listing 4-16 is shown to demonstrate the µC/HTTPs module capabilities. That code simply read all header field and print the cookie header field value.

  • No labels