nn::http::Connection::GetHeaderField Member Function

Syntax

nn::Result GetHeaderField(
     const char * pLabel,
     char * pFieldBuf,
     size_t bufSize,
     size_t * pFieldLengthCourier = NULL
) const;

nn::Result GetHeaderField(
     const char * pLabel,
     char * pFieldBuf,
     size_t bufSize,
     const nn::fnd::TimeSpan & timeout,
     size_t * pFieldLengthCourier = NULL
) const;

List of Overloaded Member Functions

GetHeaderField(const char *, char *, size_t, size_t *) Gets the field value that matches the specified label. This field value is obtained from the message header of the HTTP response that was received.
GetHeaderField(const char *, char *, size_t, const nn::fnd::TimeSpan &, size_t *) This version of GetHeaderField has a timeout.

Description of GetHeaderField(const char *, char *, size_t, size_t *)

This function blocks until the header is completely received. The receive operation completes if the following conditions are met.
・ All header data has been received.
・ The operation was cancelled.
・ A communication error occurred (for example, DNS name resolution failed).
If the header was already completely received by another function, this function will return the response immediately.


Note: If the pFieldBuf size is smaller than the field value size, as much data is stored in pFieldBuf as will fit, and the field value size is stored in pFieldLengthCourier.

Note: If pFieldBuf==NULL or bufSize==0, and if pFieldLengthCourier!=NULL, the field length is stored in pFieldLengthCourier.

Note: Unlike the version of GetHeaderField that includes a timeout, this function does not time out. In other words, control will not return from this function until processing has ended. In environments where communications are slow you can expect a long time to pass before processing ends and control returns from this function.

Description of GetHeaderField(const char *, char *, size_t, const nn::fnd::TimeSpan &, size_t *)

Other than allowing the user to specify a timeout, this version functions identically to GetHeaderField. For feature details, see the function reference for the version without a timeout. Returns ResultTimeout if no HTTP response header has been fully received within the timeout period. If ResultTimeout is returned, the connection is automatically canceled. (In other words, the function internally implements Cancel.)


CONFIDENTIAL