Migrating to Appweb 8

Architectural Changes

Appweb 8 includes some major architectural changes to support the HTTP/2 protocol. HTTP/2 is a higher performance binary protocol that supports multiplexing multiple request streams over a single network connection and offers decreased latency and improved efficiency. This necessitates some API changes and so handlers and filters may need some minor refactoring to work with Appweb 8. ESP, CGI and PHP applications should not need any changes.

The architectural changes in Appweb 8 are:

Changed APIs

To assist with migrating to Appweb 8 you can set the preprocessor constant ME_COMPAT to "1" which will map prior definitions into the Appweb 8 equivalents. You should use this as a transitional aid only as these mappings will be removed in future releases.

Networks and Connections

The previous HttpConn structure contained information regarding the network connection and the current request. With HTTP/2 a single network connection must support multiple simultaneous requests. To support this, the HttpNet structure is introduced and it assumes the management of the network connection. The HttpConn structure is renamed HttpStream for clarity as it is no-longer responsible for the connection. It retains responsibility for a single request / response exchange with the peer.

For compatibility, a CPP define is provided for HttpConn which maps to HttpStream. Similarly, defines are provided which map legacy HttpConn APIs to their HttpStream equivalents. However, you should refactor your applications and rename all HttpConn references to HttpStream. You should also change your "conn" variable declarations to be "stream" for clarity.

Some HttpConn APIs have been migrated to HttpNet and consequently now take a HttpNet* parameter as their argument. Note: the HttpNet object owns the event dispatcher which is now shared across all HttpStream instances so that all activity on a network socket is serialized and non-blocking.

Here is a list of the API changes. Please let us know at dev@embedthis.com if we have missed any impacting change and we'll update the list.

ESP Changes

Here is a list of ESP changes:

ME_COMPAT Definitions

To enable the compatibility mappings, configure with compat set to true.

./configure --set compat=true

If you are building with Make, run make with ME_COMPAT=1.

make ME_COMPAT=1

These are the mappings defined via ME_COMPAT:

#define conn stream
#define HttpConn HttpStream
#define httpCreateConn httpCreateStream
#define httpDestroyConn httpDestoryStream
#define httpDisconnectConn httpDisconnectStream
#define httpResetClientConn httpResetClientStream
#define httpPrepClientConn httpPrepClientStream

#define httpGetConnContext httpGetStreamContext
#define httpGetConnEventMask httpGetStreamEventMask
#define httpGetConnHost httpGetStreamHost
#define httpSetConnContext httpSetStreamContext
#define httpSetConnHost httpSetStreamHost
#define httpSetConnData httpSetStreamData
#define httpSetConnNotifier httpSetStreamNotifier
#define httpSetConnUser httpSetStreamUser

#define httpEnableConnEvents(stream) httpEnableNetEvents(stream->net)
#define httpClientConn(stream) httpClientStream(stream)
#define httpServerConn(stream) httpServerStream(stream)
#define httpDisconnect(stream) httpDisconnectStream(stream)

You should use the ME_COMPAT mappings only as a transitional aid as they may be removed in a future release.

© Embedthis Software. All rights reserved.