Pooka SDK API Reference
HttpURLConnection Class Reference

#include <HttpURLConnection.h>

+ Inheritance diagram for HttpURLConnection:
+ Collaboration diagram for HttpURLConnection:

Detailed Description

A sub-class of URLConnection with support for HTTP-specific features, mainly used to make a http request and process the response.

This base class provides some functions including socket connection, issuing of requests and managing responses. This base class also provides numbers of helper functions help set or get http request and response header fields. However, only most commonly used http request and response header fields are covered. Developers who want to set or get all http header fields can do it themselves through functions like setRequestField(), addRequestField() and getResponseField(wchar_t *) / getResponseField(int).

For technical specification of http header fields, visit web site HTTP header fields.

Remarks  Making a http request by HttpURLConnection
Making a http request is the main function of class URLConnection. The following steps are the typical steps of making a http request by HttpURLConnection, notice that some steps and settings are required while others are optional.

  • Create an asynchronous task hosts the http request code
    Since the operation of issuing a http request may block the current thread for a while (in the worst case, the blocking period can be very long). In modern applications It is mandatory to avoid blocking UI thread so that the application is interactive all the time. Because of this requirement, the whole operation of making a http request should be put in an asynchronous task, see class AsyncTask for more details.
    //Create a asynchronous task and send the Http request inside its event function run()
    this->_pAsyncRequestTask = new AsyncTask(this, new Integer(requestMethod));
    this->_pAsyncRequestTask->start(); //Start the asynchronous task
  • Create a connection instance
    Creating a connection can be done either by URL class or a helper function HttpURLConnection::openConnection() or HttpsURLConnection::openConnection().
    By URL class:
    URL * url = new URL(L"http://username:password@host:8080/directory/file?query#ref"); //Create a URL (dummy URL in sample code)
    this->_httpConnection = (HttpURLConnection *)url->openConnection(myParameter);
    if(this->_httpConnection == NULL)//Failed
    {
    this->_showMessageBox(L"Error: failed to open connection because of invalid URL.");
    return NULL;
    }
    By helper function HttpURLConnection::openConnection():
    URL * url = new URL(L"http://username:password@host:8080/directory/file?query#ref"); //Create a URL (dummy URL in sample code)
    this->_httpConnection = HttpURLConnection::openConnection(url, myParameter);
    if(this->_httpConnection == NULL)//Failed
    {
    this->_showMessageBox(L"Error: failed to open connection because of invalid URL.");
    return NULL;
    }
  • Chang some settings of the created HttpURLConnection (optional)
    The default settings of a HttpURLConnection is suitable for most common scenarios when issuing a http request. If needed, developers can change some settings, like the following code:
    // Set connection timeout to 5 seconds
    this->_httpConnection->setConnectTimeout(5000);
    // Set HTTP request method ("GET" or "POST")
    int requestMethod = ...; //Somehow get the request methos (might be user input through UI)
    this->_httpConnection->setRequestMethod(strMethod);
  • Issue the http request
    This is the step that actually issue the http request and process the http response. Notice there is no "dedicated" function like "sendRequest()" to issue the request. Issuing the http request and processing the response are done by a single function readFullResponse(). If the request is sent by POST method, the the post data need to be sent separately by function writeRequestBody().
    // Set content type in request header (required)
    this->_httpConnection->setRequestContentType((wchar_t *)URLConnection::CONTENT_TYPE_FORM_URLENCODED);
    // Send post data, if there is data when sending the request by POST
    String strPostData(...); //Somehow get the data need to be post to server
    int dataLen = strPostData.length();
    char * pPostData = (dataLen > 0 ? StringUtil::WcharsToChars(strPostData) : NULL); // Note: Need to convert wide char C string into byte-char string
    if (pPostData != NULL)//Prepare the request body for POST
    {
    this->_httpConnection->setRequestContentLength(dataLen); // Set Content-Length header first
    this->_httpConnection->writeRequestBody(pPostData, dataLen);// Send the data out
    }
    // Set response timeout (optional)
    this->_httpConnection->setResponseTimeout(TypeUtil::parseInt(this->getSprite(L"edtResponseTimeout")->getText()));
    // Issue the http request and start reading the response
    // The actual response handling is done inside the event listener functions
    HttpURLConnection::ExceptionListener * exceptionListener = ...; //The exception listener
    HttpURLConnection::EventListener * eventListener = ...; //The event listener
    this->_httpConnection->readFullResponse(exceptionListener, eventListener, 1024);
    // Close and delete http connection
    this->_httpConnection->disconnect();
    delete this->_httpConnection;
    this->_httpConnection = NULL;
    // Delete post data, if there is any
    if (pPostData != NULL)
    delete[] pPostData;

Remarks  Making an http request by WebUtil::sendHttpRequestAsync
WebUtil class provide a helper function WebUtil::sendHttpRequestAsync() that make it more convenient to issue a http request.

This helper function encapsulates the typical steps shown in Making a http request by HttpURLConnection, it also ease off the job by put the whole operation into a AsyncTask so that the current thread will not be blocked when issuing the request and waiting the response.

Although function WebUtil::sendHttpRequestAsync() has less control options than using HttpURLConnection class, its can cover most common scenarios when sending http request and the source code can be very compact.

String strPostData(...); //Somehow get the data need to be post to server
int dataLen = strPostData.length();
char * pPostData = (dataLen > 0 ? StringUtil::WcharsToChars(strPostData) : NULL); // Note: Need to convert wide char C string into byte-char string
this->_pAsyncRequestTask = WebUtil::sendHttpRequestAsync
(
L"http://username:password@host:8080/directory/file?query#ref", //url (dummy)
requestMethod, //HttpURLConnection::REQUEST_METHOD_GET or HttpURLConnection::REQUEST_METHOD_POST
pPostData, dataLen, // Post data and length (if there any)
exceptionListener = ..., //The exception listener
eventListener = ..., //The event listener
5000, //Connection timeout (5 seconds)
(void *)L"Sending by WebUtil", // User defined parameter, can carry any infomration
1024, //Read buffer size in bytes
0, //Response timeout, 0 indicates infinite timeout.
);
if(pPostData != NULL) // Delete post data, if there is any
delete [] pPostData;

Classes

class  EventListener
 
class  ExceptionListener
 

Public Types

enum  REQUEST_METHOD {
  REQUEST_METHOD_GET, REQUEST_METHOD_POST, REQUEST_METHOD_HEAD, REQUEST_METHOD_PUT,
  REQUEST_METHOD_DELETE, REQUEST_METHOD_OPTIONS, REQUEST_METHOD_TRACE, REQUEST_METHOD_CONNECT
}
 
enum  ENCODE_TYPE { ENCODE_TYPE_NONE = -1, ENCODE_TYPE_URLENCODED, ENCODE_TYPE_MULTIPART, ENCODE_TYPE_PLAINTEXT }
 
enum  HTTP_STATUS_CODE {
  HTTP_CONTINUE = 100, HTTP_OK = 200, HTTP_CREATED = 201, HTTP_ACCEPTED = 202,
  HTTP_NOT_AUTHORITATIVE = 203, HTTP_NO_CONTENT = 204, HTTP_RESET = 205, HTTP_PARTIAL = 206,
  HTTP_MULT_CHOICE = 300, HTTP_MOVED_PERM = 301, HTTP_MOVED_TEMP = 302, HTTP_SEE_OTHER = 303,
  HTTP_NOT_MODIFIED = 304, HTTP_USE_PROXY = 305, HTTP_BAD_REQUEST = 400, HTTP_UNAUTHORIZED = 401,
  HTTP_PAYMENT_REQUIRED = 402, HTTP_FORBIDDEN = 403, HTTP_NOT_FOUND = 404, HTTP_BAD_METHOD = 405,
  HTTP_NOT_ACCEPTABLE = 406, HTTP_PROXY_AUTH = 407, HTTP_CLIENT_TIMEOUT = 408, HTTP_CONFLICT = 409,
  HTTP_GONE = 410, HTTP_LENGTH_REQUIRED = 411, HTTP_PRECON_FAILED = 412, HTTP_ENTITY_TOO_LARGE = 413,
  HTTP_REQ_TOO_LONG = 414, HTTP_UNSUPPORTED_TYPE = 415, HTTP_INTERNAL_ERROR = 500, HTTP_NOT_IMPLEMENTED = 501,
  HTTP_BAD_GATEWAY = 502, HTTP_UNAVAILABLE = 503, HTTP_GATEWAY_TIMEOUT = 504, HTTP_VERSION = 505
}
 
enum  HTTP_EXCEPTION_TYPE {
  EXCEPTION_HTTP_CANNOT_RECEIVE_DATA = 1 << 20, EXCEPTION_HTTP_UNEXPECTED_DISCONNECTION = 1 << 21, EXCEPTION_HTTP_RECEIVED_DATA_NOT_USEDUP = 1 << 22, EXCEPTION_HTTP_UNKNOWN_PROTOCOL = 1 << 23,
  EXCEPTION_HTTP_BAD_STATUS_LINE = 1 << 24, EXCEPTION_HTTP_RESPONSE_TIMEOUT = 1 << 25
}
 
- Public Types inherited from URLConnection
enum  EXCEPTION_TYPE {
  EXCEPTION_INVALID_URL = 1 << 0, EXCEPTION_UNCONNECTED_SOCKET = 1 << 10, EXCEPTION_CANNOT_CREATE_SOCKET = 1 << 11, EXCEPTION_CANNOT_CONNECT = 1 << 12,
  EXCEPTION_CANNOT_SEND_DATA = 1 << 13
}
 

Public Member Functions

virtual ~HttpURLConnection ()
 
void setRequestMethod (wchar_t *method)
 
wchar_t * getRequestMethod ()
 
void writeRequestBody (char *requestBody, int bodySize)
 
void readFullResponse (HttpURLConnection::ExceptionListener *exceptionListener=0, HttpURLConnection::EventListener *eventListener=0, int readBufferSize=URLConnection::DEFAULT_READ_BUFFER_SIZE)
 
int getResponseCode ()
 
wchar_t * getResponseMessage ()
 
void addRequestField (wchar_t *field, wchar_t *value)
 
void setRequestField (wchar_t *field, wchar_t *value)
 
wchar_t * getRequestField (wchar_t *field)
 
Core::MiniSTL::DataStructure::PropertiesgetRequestFields ()
 
void setRequestContentType (wchar_t *value)
 
void setRequestContentLength (int value)
 
void setRequestUserAgent (wchar_t *value)
 
void setRequestAccept (wchar_t *value)
 
wchar_t * getResponseField (int index)
 
wchar_t * getResponseField (wchar_t *field)
 
wchar_t * getResponseFieldName (int index)
 
Core::MiniSTL::DataStructure::PropertiesgetResponseFields ()
 
wchar_t * getResponseContentType ()
 
int getResponseContentLength ()
 
wchar_t * getResponseContentEncoding ()
 
long long getResponseDate ()
 
long long getResponseExpiration ()
 
long long getResponseLastModified ()
 
Core::MiniSTL::DataStructure::ArrayListgetResponseCookies ()
 
- Public Member Functions inherited from URLConnection
virtual ~URLConnection ()
 
URLgetURL ()
 
bool connect ()
 
void disconnect ()
 
bool isConnected ()
 
void setConnectTimeout (int timeout)
 
int getConnectTimeout ()
 
void setResponseTimeout (int timeout)
 
int getResponseTimeout ()
 

Static Public Member Functions

static HttpURLConnectionopenConnection (URL *url, void *userDefined=0)
 
- Static Public Member Functions inherited from URLConnection
static wchar_t * getExceptionMessage (int exceptionType)
 

Static Public Attributes

static const wchar_t * METHOD_GET
 
static const wchar_t * METHOD_POST
 
static const wchar_t * CONTENT_TYPE_FORM_URLENCODED
 
static const wchar_t * CONTENT_TYPE_FORM_MULTIPART
 
static const wchar_t * CONTENT_TYPE_TEXT_PLAIN
 
static const wchar_t * HEADER_CONTENT_ACCEPT
 
static const wchar_t * HEADER_USER_AGENT
 
static const wchar_t * HEADER_CONTENT_TYPE
 
static const wchar_t * HEADER_CONTENT_LENGTH
 
static const wchar_t * HEADER_SET_COOKIE
 
- Static Public Attributes inherited from URLConnection
static const int DEFAULT_READ_BUFFER_SIZE = 2048
 

Additional Inherited Members

- Public Attributes inherited from URLConnection
void * userDefined
 
- Protected Member Functions inherited from URLConnection
 URLConnection (URL *url, void *userDefined)
 

Member Enumeration Documentation

§ REQUEST_METHOD

Values that represent http request methods.

Enumerator
REQUEST_METHOD_GET 

The GET method.

REQUEST_METHOD_POST 

The POST method.

REQUEST_METHOD_HEAD 

The HEAD method.

REQUEST_METHOD_PUT 

The PUT method.

REQUEST_METHOD_DELETE 

The DELETE method.

REQUEST_METHOD_OPTIONS 

The OPTIONS method.

REQUEST_METHOD_TRACE 

The TRACE method.

REQUEST_METHOD_CONNECT 

The CONNECT method.

§ ENCODE_TYPE

Values that represent encoding types.

Enumerator
ENCODE_TYPE_NONE 

Indicates no encoding.

ENCODE_TYPE_URLENCODED 

The URL encoding

ENCODE_TYPE_MULTIPART 

The multi-part content-type, works with POST method, mainly used to upload files to the server.

ENCODE_TYPE_PLAINTEXT 

The plain text.

§ HTTP_STATUS_CODE

Values that represent HTTP status codes.

Enumerator
HTTP_CONTINUE 

Continue.

HTTP_OK 

OK.

HTTP_CREATED 

Created.

HTTP_ACCEPTED 

Accepted.

HTTP_NOT_AUTHORITATIVE 

Non-Authoritative Information.

HTTP_NO_CONTENT 

No Content.

HTTP_RESET 

Reset Content.

HTTP_PARTIAL 

Partial Content.

HTTP_MULT_CHOICE 

Multiple Choices.

HTTP_MOVED_PERM 

Moved Permanently.

HTTP_MOVED_TEMP 

Found.

HTTP_SEE_OTHER 

See Other.

HTTP_NOT_MODIFIED 

Not Modified.

HTTP_USE_PROXY 

Use Proxy.

HTTP_BAD_REQUEST 

Bad Request.

HTTP_UNAUTHORIZED 

Unauthorized.

HTTP_PAYMENT_REQUIRED 

Payment Required.

HTTP_FORBIDDEN 

Forbidden.

HTTP_NOT_FOUND 

Not Found.

HTTP_BAD_METHOD 

Method Not Allowed.

HTTP_NOT_ACCEPTABLE 

Not Acceptable.

HTTP_PROXY_AUTH 

Proxy Authentication Required.

HTTP_CLIENT_TIMEOUT 

Request Timeout.

HTTP_CONFLICT 

Conflict.

HTTP_GONE 

Gone.

HTTP_LENGTH_REQUIRED 

Length Required.

HTTP_PRECON_FAILED 

Precondition Failed.

HTTP_ENTITY_TOO_LARGE 

Payload Too Large.

HTTP_REQ_TOO_LONG 

URI Too Long.

HTTP_UNSUPPORTED_TYPE 

Unsupported Media Type.

HTTP_INTERNAL_ERROR 

Internal Server Error.

HTTP_NOT_IMPLEMENTED 

Not Implemented.

HTTP_BAD_GATEWAY 

Bad Gateway.

HTTP_UNAVAILABLE 

Service Unavailable.

HTTP_GATEWAY_TIMEOUT 

Gateway Timeout.

HTTP_VERSION 

HTTP Version Not Supported.

§ HTTP_EXCEPTION_TYPE

Values that represent exceptions may be raised by HttpURLConnection class

Enumerator
EXCEPTION_HTTP_CANNOT_RECEIVE_DATA 

Unable to receive data from http server.

EXCEPTION_HTTP_UNEXPECTED_DISCONNECTION 

Unexpected disconnection to the http server.

EXCEPTION_HTTP_RECEIVED_DATA_NOT_USEDUP 

Received data not used up.

EXCEPTION_HTTP_UNKNOWN_PROTOCOL 

Unknown protocol.

EXCEPTION_HTTP_BAD_STATUS_LINE 

Received bad status line.

EXCEPTION_HTTP_RESPONSE_TIMEOUT 

Http server response times out.

Constructor & Destructor Documentation

§ ~HttpURLConnection()

virtual ~HttpURLConnection ( )
virtual

Destructor.

Member Function Documentation

§ openConnection()

static HttpURLConnection* openConnection ( URL url,
void *  userDefined = 0 
)
static

A helper function that opens a url connection and returns a HttpURLConnection instance for issuing http request and processing the http response.

Parameters
urlThe URL
userDefinedThe general-purpose parameter that carries user-defined information, usually used to distinguish the context under which the connection is created and used.
Returns
A HttpURLConnection instance for issuing http request and processing the http response, or NULL if fails.

§ setRequestMethod()

void setRequestMethod ( wchar_t *  method)

Sets the http request method.

 Note  The current version of Pooka SDK® only supports http request methods METHOD_GET and METHOD_POST.

Parameters
methodThe http request method, must be either METHOD_GET or METHOD_POST.

§ getRequestMethod()

wchar_t* getRequestMethod ( )

Gets the http request method.

 Note  The current version of Pooka SDK® only supports http request methods METHOD_GET and METHOD_POST.

Returns
The http request method, either METHOD_GET or METHOD_POST.

§ writeRequestBody()

void writeRequestBody ( char *  requestBody,
int  bodySize 
)

Writes the http request body.

Since the current version of Pooka SDK® only supports http request methods METHOD_GET and METHOD_POST, this function is mainly used to send post data to the http server.

Parameters
requestBodyThe http request body.
bodySizeSize of the http request body in bytes

§ readFullResponse()

void readFullResponse ( HttpURLConnection::ExceptionListener exceptionListener = 0,
HttpURLConnection::EventListener eventListener = 0,
int  readBufferSize = URLConnection::DEFAULT_READ_BUFFER_SIZE 
)

Issue the http request and starts receiving server response.

There is no "dedicated" function like "sendRequest()" to issue a http request in class HttpURLConnection. Issuing the http request and processing the response are done by a single call to this function. If the request is sent by POST method, the the post data need to be sent separately by function writeRequestBody(). See Making a http request by HttpURLConnection for more details.

 Note  This function blocks the current caller thread until the response reading is fully terminated. For modern application, this function should be called on a worker thread to avoid blocking the UI thread.

Parameters
exceptionListenerThe exception listener used to handle http exceptions, see ExceptionListener for details.
eventListenerThe event listener used to handle various http events, see EventListener for details.
readBufferSizeThe size of the read buffer that determines the size of the data chunk can be read at one time, see function EventListener::onHttpData() for more details.
See also
writeRequestBody
ExceptionListener
EventListener
EventListener::onHttpData

§ getResponseCode()

int getResponseCode ( )

Gets the HTTP status codes returned by the HTTP server

Returns
The http response code returned by the HTTP server, one of constants defined in HTTP_STATUS_CODE

§ getResponseMessage()

wchar_t* getResponseMessage ( )

Gets the http response message returned by the HTTP server

Returns
The http response message returned by the HTTP server

§ addRequestField()

void addRequestField ( wchar_t *  field,
wchar_t *  value 
)

Adds the given field to the http request header. Existing fields with the same name will not be overwritten by this function.

Parameters
fieldThe field name
valueThe field value

§ setRequestField()

void setRequestField ( wchar_t *  field,
wchar_t *  value 
)

Sets the value of the specified http request header field. If a field with the same name already exists, overwrite its value with the given value.

Parameters
fieldThe field name
valueThe field value

§ getRequestField()

wchar_t* getRequestField ( wchar_t *  field)

Gets the value of the specified http request header field.

Parameters
fieldThe field name
Returns
The value of the specified http request header field, or NULL if there is no such field with the specified name

§ getRequestFields()

Gets all http request fields.

 Note  All field names in the returned Properties are in uppercase.

Returns
All http request fields, returned as a Properties instance.

§ setRequestContentType()

void setRequestContentType ( wchar_t *  value)

A helper function that sets the http request header field Content-Type with given value.

Parameters
valueThe field value

§ setRequestContentLength()

void setRequestContentLength ( int  value)

A helper function that sets the http request header field Content-Length with given value.

This function is used when sending http POSt data to the server. Liek the following sample code:

char * pPostData = ...; // Somehow get the data need to be send to http server by POST method
if (pPostData != NULL)
{
this->_httpConnection->setRequestContentLength(dataLen); // Set Content-Length header first
this->_httpConnection->writeRequestBody(pPostData, dataLen);// Send the post data out
}
Parameters
valueThe field value

§ setRequestUserAgent()

void setRequestUserAgent ( wchar_t *  value)

A helper function that sets the http request header field User-Agent with given value.

 Note  By default, Pooka SDK® application sets the user agent to Pooka SDK®. If other agent name is preferred, developers can use this function to change it before submit the http request.

Parameters
valueThe field value

§ setRequestAccept()

void setRequestAccept ( wchar_t *  value)

A helper function that sets the http request header field Accept with given value.

Parameters
valueThe field value

§ getResponseField() [1/2]

wchar_t* getResponseField ( int  index)

Gets the value of http response header field at the specified position.

Parameters
indexZero-base position of the field in http response header
Returns
The value of http response header field at the specified position, or NULL if the http response header has fields fewer than the argument index specifies.

§ getResponseField() [2/2]

wchar_t* getResponseField ( wchar_t *  field)

Gets the value of http response header field specified by the field name

Parameters
fieldThe field name
Returns
The value of http response header field specified by the field name, or NULL if the http response header does not have such field.

§ getResponseFieldName()

wchar_t* getResponseFieldName ( int  index)

Gets the name of http response header field at the specified position.

Parameters
indexZero-base position of the field in http response header
Returns
The name of http response header field at the specified position, or NULL if the http response header has fields fewer than the argument index specifies.

§ getResponseFields()

Gets all http response header fields

 Note  All field names in the returned Properties are in lowercase.

Returns
All http response fields, returned as a Properties instance.

§ getResponseContentType()

wchar_t* getResponseContentType ( )

A helper function that retrieves the value of http response header field Content-Type.

This function returns the MIME-type of the content specified by the http response header field "Content-Type", or NULL is returned if type is not specified.

Returns
The value of http response header field, or NULL id fails.

§ getResponseContentLength()

int getResponseContentLength ( )

A helper function that retrieves the value of http response header field Content-Length.

Returns
The response content length in bytes, or -1 if Content-Length field is not set or cannot be represented as an int.

§ getResponseContentEncoding()

wchar_t* getResponseContentEncoding ( )

A helper function that retrieves the value of http response header field Content-Encoding.

Returns
The value of http response header field, or NULL id fails.

§ getResponseDate()

long long getResponseDate ( )

A helper function that retrieves the value of http response header field Date in milliseconds since January 1, 1970 GMT, or 0 if not specified.

Returns
The value of http response header field, or NULL id fails.

§ getResponseExpiration()

long long getResponseExpiration ( )

A helper function that retrieves the value of http response header field Expires in milliseconds since January 1, 1970 GMT, or 0 if not specified.

Returns
The value of http response header field, or NULL id fails.

§ getResponseLastModified()

long long getResponseLastModified ( )

A helper function that retrieves the value of http response header field Last-Modified in milliseconds since January 1, 1970 GMT, or 0 if not specified.

Returns
The value of http response header field, or NULL id fails.

§ getResponseCookies()

Core::MiniSTL::DataStructure::ArrayList* getResponseCookies ( )

Gets all cookies in http response header.

This function returns all the value strings of the "Set-Cookie" fields in http response header by a ArrayList .

Caution The returned ArrayList instance and all its element should be treated as read-only and should not be destroyed.

Returns
All cookies in http response header.

Member Data Documentation

§ METHOD_GET

const wchar_t* METHOD_GET
static

The string constant of http request method GET, the constant value is GET.

§ METHOD_POST

const wchar_t* METHOD_POST
static

The string constant of http request method POST, the constant value is POST.

§ CONTENT_TYPE_FORM_URLENCODED

const wchar_t* CONTENT_TYPE_FORM_URLENCODED
static

One of content types for html form. This constant has value application/x-www-form-urlencoded.

This is the default content type. Html forms submitted with this content type must be encoded as follows:

  • Control names and values are escaped. Space characters are replaced by `+', and then reserved characters are escaped as described in RFC1738, section 2.2: Non-alphanumeric characters are replaced by `HH', a percent sign and two hexadecimal digits representing the ASCII code of the character. Line breaks are represented as "CR LF" pairs (i.e., `%0D%0A').
  • The control names/values are listed in the order they appear in the document. The name is separated from the value by `=' and name/value pairs are separated from each other by `&'.

§ CONTENT_TYPE_FORM_MULTIPART

const wchar_t* CONTENT_TYPE_FORM_MULTIPART
static

One of content types for html form. This constant has value multipart/form-data.

When html forms needs to send large quantities of binary data or text containing non-ASCII characters, the content type multipart/form-data should be used. It is efficient for submitting forms that contain files, non-ASCII data, and binary data.

§ CONTENT_TYPE_TEXT_PLAIN

const wchar_t* CONTENT_TYPE_TEXT_PLAIN
static

One of content types indicates plain text content. This constant has value text/plain.

§ HEADER_CONTENT_ACCEPT

const wchar_t* HEADER_CONTENT_ACCEPT
static

One of http header fields that indicates content types that are acceptable for the response. This constant has value Accept.

§ HEADER_USER_AGENT

const wchar_t* HEADER_USER_AGENT
static

One of http header fields that contains the identifier string of the user agent. This constant has value User-Agent.

§ HEADER_CONTENT_TYPE

const wchar_t* HEADER_CONTENT_TYPE
static

One of http header fields that indicates the MIME type of this content. This constant has value Content-Type.

§ HEADER_CONTENT_LENGTH

const wchar_t* HEADER_CONTENT_LENGTH
static

One of http header fields that indicates the length of the request body in bytes. This constant has value Content-Length.

§ HEADER_SET_COOKIE

const wchar_t* HEADER_SET_COOKIE
static

One of http header fields that indicates a http cookie. This constant has value Set-Cookie.