Main  /  Edit version 6  /  Edit version 7  /   /  Users Area

Difference "What's new in CppCMS 1.2.0" ver. 6 versus ver. 7

Content:

<!--toc-->
_Note: CppCMS 1.2.0 is future stable version of CppCMS 1.1 beta._
# Major Changes in this version
- Redesigned applications pool and its API
- New non-blocking I/O mode
- On-the-fly input content processing support
- Independent of context use of cache and session interfaces
- Integration of session handling with 3rd part technologies: PHP, Java Servlet, Aps.Net and so on and contributed modules.
- Major performance and memory use improvements.
- Headers and Source separation by templates compiler
- Headers and Source separation by templates compiler. _Special thanks to Lee Elenbaas for the major contribution_.
# API Improvements
## CppCMS Library
### Major API Changes in CppCMS:
- `cppcms::http::response`
- Flushing of `std::ostream &out()` now delegates to all underlying filters including gzip compression allowing to flush output in reliable way.
- Added non-blocking AIO operation API
- Added API to modify output buffer size
- `cppcms::http::request`
- Added an option to install custom content filters for asynchronous applications that would validate input on the fly
- Added an option to modify various security limits for filters on per request basis,
- `cppcms::cache_interface` - added an option to use it outside `cppcms::http::context` scope.
- `cppcms::session_interface`
- added an option to use outside of
`cppcms::http::context` scope to enable external
- added `session_interface_cookie_adapter` class to
simulate cookies operation for non-cookies based
session handling
- added API to retrieve session keys
- Introduced C API for access of CppCMS session for direct library access by other languages/platforms
- `cppcms::applications_pool` - major API changes
- Added an API that allows asynchronous applications to behave as uploaded content filters
- Added `application_specific_pool` to handle generation of applications, mounting and unmounting them
- New API for mounting applications with operation mode flags: asynchronous, synchronous, filtering and more.
- Added different pool management strategies
- Older style of application mounting isn't recommented to use any more, it will be deprecated in future versions
- `cppcms::http::context`
- Added an "official" method to "resubmit" context to a different pool or asynchrouns application
- Added a context-specific storage API to attach generic data to the storage (for example for passing it between applications)
### New Major CppCMS Classes:
- `cppcms`
- `session_interface_cookie_adapter` - a bridge to treat any storage as cookies
- `application_specific_pool` - new applications factory
- `cppcms::http`
- `content_limits` - security limits for input data
- `basic_content_filter`, `raw_content_filter`, `multipart_content_filter` - filters to handle uploaded content via POST or PUT methods.
- C API Classes: `cppcms_capi_session_pool`, `cppcms_capi_session`, `cppcms_capi_cookie`;
### Minor API Changes in CppCMS:
- `cppcms::http::content_type` - added queries for multipart/form-data and url-encoded content types.
- `cppcms::http::response` - Added `add_header()` function
- `cppcms::http::file` - added API to modify parameters
- `cppcms::http::cookie` - added API to get expiration times
- `cppcms::widgets::base_widget` - added readonly attribute
- `cppcms::url_dispatcher` - extended API to support up to 6 parameters.
- `cppcms::application` - added option to attach unowned `cppcms::http::context`
- `cppcms::view::generator` - added `enumerate()` function
- `cppcms::json`
- Added API to load data from `[char const *,char const *)` range
- Added `to_json` API to convert strings directly
- `cppcms::session_pool` - added an option to create one independently of `cppcms::service` for use in plugins.
## Booster API Changes
- `ptime `added operator `+=`/`-=`
- Added `pointer_type` to `callback`
- Added support of `ate` for `booster::nowide::fstream`
### Booster.AIO
- Added `bind` call to `basic_socket` to enable IP binding for both client and server ends.
- `*_buffer` - added `size()` and `bytes_count()` functions
- `stream_socket` - added `bytes_readable()` function
- `basic_io_device` - added `set_non_blocking_if_needed` member function
- `io_service` - additional `post()` options
# Templates Compiler
- Added option to generate separate API headers and C++ sources for both plugin management and optional compilation time improvements
# Performance Improvements
- Improved memory use and reduced memory copying in internal HTTP/FastCGI/SCGI APIs.
- Switched to reactor rather than proactor IO model when possible
- Improved parsing speed of JSON in about 2 times by using `std::streambuf` directly
- Non-blocking operation mode option provides major performance improvements for asynchronous applications
- Boost.RB-Shared memory allocator replaced with faster, simpler and well known Buddy memory allocator.
# Internal Modifications
- Redesigned internal IO models for performance improvements and non-blocking API support.
- Removed dependency on local version of `cppcms_boost`
# New Contrib (External) Modules
- Google Recaptcha module
- Server Sent-Events module
- Session Interface Access from Java, PHP, Asp.Net and Python
<h1>include <iostream></h1> <h1>include <string></h1> <h1>include <cstring></h1>

include <sys/socket.h>

include <netinet/in.h>

include <unistd.h>

int main() { int server_fd, client_fd; struct sockaddr_in address; int addrlen = sizeof(address);

// HTML content to be served
std::string html = 
    "HTTP/1.1 200 OK\r\n"
    "Content-Type: text/html\r\n\r\n"
    "<!DOCTYPE html>"
    "<html>"
    "<head><title>My C++ Web</title></head>"
    "<body><h1>Welcome to a Simple Web Page!</h1><p>This is served from C++.</p></body>"
    "</html>";

// Create socket
server_fd = socket(AF_INET, SOCK_STREAM, 0);
if (server_fd == 0) {
    perror("socket failed");
    exit(EXIT_FAILURE);
}

// Bind
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons(8080);

if (bind(server_fd, (struct sockaddr *)&address, sizeof(address)) < 0) {
    perror("bind failed");
    exit(EXIT_FAILURE);
}

// Listen
if (listen(server_fd, 3) < 0) {
    perror("listen");
    exit(EXIT_FAILURE);
}

std::cout << "Server is running on http://localhost:8080" << std::endl;

while (true) {
    // Accept client
    client_fd = accept(server_fd, (struct sockaddr *)&address, (socklen_t*)&addrlen);
    if (client_fd < 0) {
        perror("accept");
        exit(EXIT_FAILURE);
    }

    char buffer[3000] = {0};
    read(client_fd, buffer, 3000);  // Read client request

    std::cout << "Request:\n" << buffer << std::endl;

    // Send response
    send(client_fd, html.c_str(), html.size(), 0);
    close(client_fd); // Close connection
}

return 0;

}

<h1>include <iostream></h1> <h1>include <string></h1> <h1>include <cstring></h1>

include <sys/socket.h>

include <netinet/in.h>

include <unistd.h>

int main() { int server_fd, client_fd; struct sockaddr_in address; int addrlen = sizeof(address);

// HTML content to be served
std::string html = 
    "HTTP/1.1 200 OK\r\n"
    "Content-Type: text/html\r\n\r\n"
    "<!DOCTYPE html>"
    "<html>"
    "<head><title>My C++ Web</title></head>"
    "<body><h1>Welcome to a Simple Web Page!</h1><p>This is served from C++.</p></body>"
    "</html>";

// Create socket
server_fd = socket(AF_INET, SOCK_STREAM, 0);
if (server_fd == 0) {
    perror("socket failed");
    exit(EXIT_FAILURE);
}

// Bind
address.sin_family = AF_INET;
address.sin_addr.s_addr = INADDR_ANY;
address.sin_port = htons(8080);

if (bind(server_fd, (struct sockaddr *)&address, sizeof(address)) < 0) {
    perror("bind failed");
    exit(EXIT_FAILURE);
}

// Listen
if (listen(server_fd, 3) < 0) {
    perror("listen");
    exit(EXIT_FAILURE);
}

std::cout << "Server is running on http://localhost:8080" << std::endl;

while (true) {
    // Accept client
    client_fd = accept(server_fd, (struct sockaddr *)&address, (socklen_t*)&addrlen);
    if (client_fd < 0) {
        perror("accept");
        exit(EXIT_FAILURE);
    }

    char buffer[3000] = {0};
    read(client_fd, buffer, 3000);  // Read client request

    std::cout << "Request:\n" << buffer << std::endl;

    // Send response
    send(client_fd, html.c_str(), html.size(), 0);
    close(client_fd); // Close connection
}

return 0;

}


Navigation

Main Page


Valid CSS | Valid XHTML 1.0