Tizen Native API
4.0
|
The HTTP Session API provides functions for managing HTTP session.
Required Header
#include <http.h>
Overview
The HTTP Session API provides functions for managing HTTP session. Using the HTTP Session, you can implement features that allow the users of your application to:
- Create / Delete HTTP session
- Get activated transaction count
- Manage redirection
Related Features
This API is related with the following features:
- http://tizen.org/feature/network.internet
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | http_session_create (http_session_mode_e mode, http_session_h *http_session) |
Creates the HTTP session handle. | |
int | http_session_destroy (http_session_h http_session) |
Destroys the HTTP session handle. | |
int | http_session_open_transaction (http_session_h http_session, http_method_e method, http_transaction_h *http_transaction) |
Opens HTTP transaction from the HTTP Session. | |
int | http_session_set_auto_redirection (http_session_h http_session, bool auto_redirection) |
Sets the value to redirect the HTTP request automatically. | |
int | http_session_get_auto_redirection (http_session_h http_session, bool *auto_redirect) |
Gets the auto redirection for the HTTP request. | |
int | http_session_get_active_transaction_count (http_session_h http_session, int *active_transaction_count) |
Gets the number of active transactions in the current session. | |
int | http_session_get_max_transaction_count (http_session_h http_session, int *transaction_count) |
Gets the maximum number of transactions for the current session. | |
int | http_session_destroy_all_transactions (http_session_h http_session) |
Destroys all transactions. |
Enumeration Type Documentation
enum http_session_mode_e |
Function Documentation
int http_session_create | ( | http_session_mode_e | mode, |
http_session_h * | http_session | ||
) |
Creates the HTTP session handle.
- Since :
- 3.0
- Remarks:
- The http_session should be released using http_session_destroy(). Opened transactions can't be submitted after destroying session handle.
- Parameters:
-
[in] mode The HTTP session mode [out] http_session The HTTP session handle
- Returns:
0
on success, otherwise negative error value
- Return values:
-
HTTP_ERROR_NONE Successful HTTP_ERROR_INVALID_PARAMETER Invalid parameter HTTP_ERROR_INVALID_OPERATION Invalid operation HTTP_ERROR_OUT_OF_MEMORY Out of memory HTTP_ERROR_NOT_SUPPORTED Not Supported
- See also:
- http_session_destroy()
int http_session_destroy | ( | http_session_h | http_session | ) |
Destroys the HTTP session handle.
- Since :
- 3.0
- Remarks:
- http_session should be set to NULL after using it
- Parameters:
-
[in] http_session The HTTP session handle
- Returns:
0
on success, otherwise negative error value
- Return values:
-
HTTP_ERROR_NONE Successful HTTP_ERROR_INVALID_PARAMETER Invalid parameter HTTP_ERROR_INVALID_OPERATION Invalid operation HTTP_ERROR_NOT_SUPPORTED Not Supported
- See also:
- http_session_create()
int http_session_destroy_all_transactions | ( | http_session_h | http_session | ) |
Destroys all transactions.
- Since :
- 3.0
- Remarks:
- All http_transactions should be set to NULL after using it
- Parameters:
-
[in] http_session The HTTP session handle
- Returns:
0
on success, otherwise negative error value
- Return values:
-
HTTP_ERROR_NONE Successful HTTP_ERROR_INVALID_PARAMETER Invalid parameter HTTP_ERROR_INVALID_OPERATION Invalid operation HTTP_ERROR_OPERATION_FAILED Operation failed HTTP_ERROR_NOT_SUPPORTED Not Supported
int http_session_get_active_transaction_count | ( | http_session_h | http_session, |
int * | active_transaction_count | ||
) |
Gets the number of active transactions in the current session.
- Since :
- 3.0
- Parameters:
-
[in] http_session The HTTP session handle [out] active_transaction_count The number of activated transactions
- Returns:
0
on success, otherwise negative error value
- Return values:
-
HTTP_ERROR_NONE Successful HTTP_ERROR_INVALID_PARAMETER Invalid parameter HTTP_ERROR_INVALID_OPERATION Invalid operation HTTP_ERROR_NOT_SUPPORTED Not Supported
int http_session_get_auto_redirection | ( | http_session_h | http_session, |
bool * | auto_redirect | ||
) |
Gets the auto redirection for the HTTP request.
- Since :
- 3.0
- Parameters:
-
[in] http_session The HTTP session handle [out] auto_redirect The value of auto redirect
- Returns:
0
on success, otherwise negative error value
- Return values:
-
HTTP_ERROR_NONE Successful HTTP_ERROR_INVALID_PARAMETER Invalid parameter HTTP_ERROR_INVALID_OPERATION Invalid operation HTTP_ERROR_NOT_SUPPORTED Not Supported
- See also:
- http_session_set_auto_redirection()
int http_session_get_max_transaction_count | ( | http_session_h | http_session, |
int * | transaction_count | ||
) |
Gets the maximum number of transactions for the current session.
- Since :
- 3.0
- Parameters:
-
[in] http_session The HTTP session handle [out] transaction_count The maximum transaction count
- Returns:
0
on success, otherwise negative error value
- Return values:
-
HTTP_ERROR_NONE Successful HTTP_ERROR_INVALID_PARAMETER Invalid parameter HTTP_ERROR_INVALID_OPERATION Invalid operation HTTP_ERROR_NOT_SUPPORTED Not Supported
int http_session_open_transaction | ( | http_session_h | http_session, |
http_method_e | method, | ||
http_transaction_h * | http_transaction | ||
) |
Opens HTTP transaction from the HTTP Session.
- Since :
- 3.0
- Remarks:
- The http_transaction should be released using http_transaction_destroy().
- Parameters:
-
[in] http_session The HTTP session handle [in] method The HTTP request method [out] http_transaction The HTTP transaction handle
- Returns:
0
on success, otherwise negative error value
- Return values:
-
HTTP_ERROR_NONE Successful HTTP_ERROR_INVALID_PARAMETER Invalid parameter HTTP_ERROR_INVALID_OPERATION Invalid operation HTTP_ERROR_OUT_OF_MEMORY Out of memory HTTP_ERROR_NOT_SUPPORTED Not Supported
int http_session_set_auto_redirection | ( | http_session_h | http_session, |
bool | auto_redirection | ||
) |
Sets the value to redirect the HTTP request automatically.
- Since :
- 3.0
- Parameters:
-
[in] http_session The HTTP session handle [in] auto_redirection The value which determines whether allow redirection or not
- Returns:
0
on success, otherwise negative error value
- Return values:
-
HTTP_ERROR_NONE Successful HTTP_ERROR_INVALID_PARAMETER Invalid parameter HTTP_ERROR_INVALID_OPERATION Invalid operation HTTP_ERROR_NOT_SUPPORTED Not Supported
- See also:
- http_session_get_auto_redirection()