|
C/C++ Reference
|
A HttpPipe can be used to establish connections similar to a TCP socket connection between clients and the server. More...
#include <HttpServerPipe.h>


Public Member Functions | |
| HttpServerPipe (SoDisp *dispatcher, SoDispCon_DispRecEv onRecEvent) | |
| The HttpServerPipe constructor. | |
| int | start (HttpRequest *request) |
| Start the pipe. | |
| ~HttpServerPipe () | |
| destructor | |
| bool | hasMoreData () |
| returns true if more data on the socket. | |
| int | readData (void *data, int len) |
| read data from socket. | |
| int | sendData (void *data, int len) |
| Send data to client. | |
Static Public Member Functions | |
| static bool | isHttpPipeReq (HttpRequest *request) |
| Check if the request is from a HttpPipe client. | |
A HttpPipe can be used to establish connections similar to a TCP socket connection between clients and the server.
The pipe is tunneled using HTTP or HTTPS. The client decides which protocol to use.
Clients:
HttpsPipe Java client
The HttpPipe is part of the EventHandler plugin, but is not using any of the EventHandler logic. A client using the HttpPipe and the EventHandler must establish two separate socket connections -- one for the pipe and one for the EventHandler.
The EventHandler is typically used for sending formatted data between a client and the server and vice versa. The EventHandler automatically marshals and un-marshals the data in transit. A HttpPipe connection is just a "raw" socket connection and is identical in functionality to a standard TCP socket connection. The EventHandler can be used by browsers and non-browser clients. The HttpPipe can only be used by non-browser clients.
A traditional server socket is listening on port numbers such as 21 for ftp, 23 for telnet etc -- that is, the port number specifies which service to use. The HttpPipe uses port 80 if nonsecure or 443 if secure. This means that one cannot specify a service by using a port number. The HttpPipe is instead using one or several URL(s) to specify a service. A HttpPage or HttpDir is used as the entry for a HttpPipe service. The web-server delegates the client HttpPipe request to the resource (HttpPage) or resource collection (HttpDir). The resource then creates an instance of the HttpServerPipe class, and the standard HTTP request converts to a full duplex connection that is similar to a standard socket connection.
You can potentially have a system with many HttpPipe services. Each service is installed into the Barracuda virtual file system. An HttpPage can be used for simple services. A HttpDir can be used for more advanced services that either provide sub-services or wish to use the Barracuda URL authorization logic for providing restrictions on what services the user is allowed to use. For example, the BarracudaDrive HTTPS tunnel is using a relative URL for providing information about the host and port number the server should connect to. The Barracuda authorization logic verifies if the user has permission to access the host and port since the host and port number are sent as part of the URL -- i.e. host/port.
The HttpServerPipe class is an abstract base class and can, therefore, not be directly instantiated. You must create a class that implements the onRecData callback function. A HttpPipe instance is installed into an instance of the SoDisp class, and the dispatcher calls the onRecData callback function each time the client sends data to the server.
Please see the EchoPipe or the BarracudaDrive example for more information.