Minimal http connection support. More...
#include <yarp/os/impl/HttpCarrier.h>
Public Member Functions | |
HttpTwoWayStream (TwoWayStream *delegate, const char *txt, const char *prefix, yarp::os::Property &prop, bool writer) | |
virtual | ~HttpTwoWayStream () |
InputStream & | getInputStream () override |
Get an InputStream to read from. | |
OutputStream & | getOutputStream () override |
Get an OutputStream to write to. | |
const Contact & | getLocalAddress () const override |
Get the address of the local side of the stream. | |
const Contact & | getRemoteAddress () const override |
Get the address of the remote side of the stream. | |
bool | isOk () const override |
Check if the stream is ok or in an error state. | |
void | reset () override |
Reset the stream. | |
void | write (const Bytes &b) override |
Write a block of bytes to the stream. | |
virtual void | apply (char ch) |
void | close () override |
Terminate the stream. | |
void | beginPacket () override |
Mark the beginning of a logical packet. | |
void | endPacket () override |
Mark the end of a logical packet (see beginPacket). | |
void | flip () |
void | finish () |
bool | useJson () |
std::string * | typeHint () |
Public Member Functions inherited from yarp::os::TwoWayStream | |
virtual | ~TwoWayStream () |
Destructor. | |
Public Member Functions inherited from yarp::os::OutputStream | |
virtual | ~OutputStream () |
Destructor. | |
virtual void | write (char ch) |
Write a single byte to the stream. | |
virtual void | write (const Bytes &b, int offset, int len) |
Write a block of bytes to the stream. | |
virtual void | flush () |
Make sure all pending write operations are finished. | |
virtual void | writeLine (const char *data, int len) |
Write some text followed by a line feed. | |
virtual bool | setWriteTimeout (double timeout) |
Set activity timeout. | |
virtual bool | setTypeOfService (int tos) |
virtual int | getTypeOfService () |
Minimal http connection support.
Most useful for connections to YARP ports from browsers. No support for connections in the opposite direction. This carrier is recruited when a port sees a TCP stream that begins with "GET /".
For "GET /", the URL following the "/" is currently translated to text as follows: ", " becomes newline "+" becomes " " This text is then passed on to the port, just as for a normal text connection. For example "GET /d, list" is the same as telnetting into a port and typing: CONNECT anon d list or typing "list" to "yarp rpc /portname". The response of the port, if any, is output in ugly html.
For "POST /" ... not done yet.
Definition at line 43 of file HttpCarrier.h.
yarp::os::impl::HttpTwoWayStream::HttpTwoWayStream | ( | TwoWayStream * | delegate, |
const char * | txt, | ||
const char * | prefix, | ||
yarp::os::Property & | prop, | ||
bool | writer | ||
) |
Definition at line 167 of file HttpCarrier.cpp.
|
virtual |
Definition at line 352 of file HttpCarrier.cpp.
Definition at line 401 of file HttpCarrier.cpp.
|
overridevirtual |
Mark the beginning of a logical packet.
This is a unit that should be treated in an atomic fashion by YARP. If any part is corrupted, the whole should be dropped.
Implements yarp::os::TwoWayStream.
Definition at line 503 of file HttpCarrier.cpp.
|
overridevirtual |
Terminate the stream.
Implements yarp::os::TwoWayStream.
Definition at line 496 of file HttpCarrier.cpp.
|
overridevirtual |
Mark the end of a logical packet (see beginPacket).
Implements yarp::os::TwoWayStream.
Definition at line 508 of file HttpCarrier.cpp.
void yarp::os::impl::HttpTwoWayStream::finish | ( | ) |
Definition at line 518 of file HttpCarrier.cpp.
void yarp::os::impl::HttpTwoWayStream::flip | ( | ) |
Definition at line 513 of file HttpCarrier.cpp.
|
overridevirtual |
Get an InputStream to read from.
Implements yarp::os::TwoWayStream.
Definition at line 360 of file HttpCarrier.cpp.
Get the address of the local side of the stream.
Implements yarp::os::TwoWayStream.
Definition at line 370 of file HttpCarrier.cpp.
|
overridevirtual |
Get an OutputStream to write to.
Implements yarp::os::TwoWayStream.
Definition at line 365 of file HttpCarrier.cpp.
Get the address of the remote side of the stream.
Implements yarp::os::TwoWayStream.
Definition at line 375 of file HttpCarrier.cpp.
|
overridevirtual |
Check if the stream is ok or in an error state.
Implements yarp::os::TwoWayStream.
Definition at line 380 of file HttpCarrier.cpp.
|
overridevirtual |
Reset the stream.
Implements yarp::os::TwoWayStream.
Definition at line 385 of file HttpCarrier.cpp.
std::string * yarp::os::impl::HttpTwoWayStream::typeHint | ( | ) |
Definition at line 528 of file HttpCarrier.cpp.
bool yarp::os::impl::HttpTwoWayStream::useJson | ( | ) |
Definition at line 523 of file HttpCarrier.cpp.
Write a block of bytes to the stream.
b | the bytes to write |
Implements yarp::os::OutputStream.
Definition at line 390 of file HttpCarrier.cpp.