Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Add Response Header Field

...

11040761104076 This hook function is called by µC/HTTPs before starting to transmit the response message as shown on Figure 4-1. It allows the upper application to add header field to the response by calling a specific API function with header field type and value. Anchor11040931104093

Prototype

Anchor11164361116436 

...

rowspan5

...

...

Arguments

...

11040951104095p_instance Anchor11163851116385

Pointer to the instance structure (read only).

...

1104096p_conn Anchor11163871116387

Pointer to the connection structure (read only).

...

Return ValueS

...

DEF_YES Anchor11163891116389

If all header fields are added without error.

Anchor11050391105039DEF_NO Anchor11163911116391

otherwise.

...

Required Configuration

Anchor11041041104104 See section 4-4-6 “Instance Header Field Configuration” on page 29 Anchor11041051104105

Notes / Warnings

...

...

Example Template

Anchor10979291097929Listing 4-18 is shown to demonstrate the µC/HTTPs module capabilities. That code simply add two header fields to a response message for an HTML document. Anchor11162741116274

...

...

Listing 4-21 Add Header field hook function example code

...

L4-21(1) Ensure that we don’t add header field to a response with an error

...

L4-21(2) Make sure to add header field only on HTML document.

...

L4-21(3) Acquire and add a first header field block of type ‘Cookie’ and with a string value type to the connection

...

L4-21(4) Set the value string value (cookie content) and the string length.

...

L4-21(5) Acquire and add a second header field block of type ‘Server’ and with a string value type to the connection

...

L4-21(6) Set the value string value (server name) and the string length.