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. More... | |
OutputStream & | getOutputStream () override |
Get an OutputStream to write to. More... | |
const Contact & | getLocalAddress () const override |
Get the address of the local side of the stream. More... | |
const Contact & | getRemoteAddress () const override |
Get the address of the remote side of the stream. More... | |
bool | isOk () const override |
Check if the stream is ok or in an error state. More... | |
void | reset () override |
Reset the stream. More... | |
void | write (const Bytes &b) override |
Write a block of bytes to the stream. More... | |
virtual void | apply (char ch) |
void | close () override |
Terminate the stream. More... | |
void | beginPacket () override |
Mark the beginning of a logical packet. More... | |
void | endPacket () override |
Mark the end of a logical packet (see beginPacket). More... | |
void | flip () |
void | finish () |
bool | useJson () |
std::string * | typeHint () |
Public Member Functions inherited from yarp::os::TwoWayStream | |
virtual | ~TwoWayStream () |
Destructor. More... | |
Public Member Functions inherited from yarp::os::OutputStream | |
virtual | ~OutputStream () |
Destructor. More... | |
virtual void | write (char ch) |
Write a single byte to the stream. More... | |
virtual void | write (const Bytes &b, int offset, int len) |
Write a block of bytes to the stream. More... | |
virtual void | flush () |
Make sure all pending write operations are finished. More... | |
virtual void | writeLine (const char *data, int len) |
Write some text followed by a line feed. More... | |
virtual bool | setWriteTimeout (double timeout) |
Set activity timeout. More... | |
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 48 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 170 of file HttpCarrier.cpp.
|
virtual |
Definition at line 355 of file HttpCarrier.cpp.
|
virtual |
Definition at line 404 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 506 of file HttpCarrier.cpp.
|
overridevirtual |
Terminate the stream.
Implements yarp::os::OutputStream.
Definition at line 499 of file HttpCarrier.cpp.
|
overridevirtual |
Mark the end of a logical packet (see beginPacket).
Implements yarp::os::TwoWayStream.
Definition at line 511 of file HttpCarrier.cpp.
void yarp::os::impl::HttpTwoWayStream::finish | ( | ) |
Definition at line 521 of file HttpCarrier.cpp.
void yarp::os::impl::HttpTwoWayStream::flip | ( | ) |
Definition at line 516 of file HttpCarrier.cpp.
|
overridevirtual |
Get an InputStream to read from.
Implements yarp::os::TwoWayStream.
Definition at line 363 of file HttpCarrier.cpp.
|
overridevirtual |
Get the address of the local side of the stream.
Implements yarp::os::TwoWayStream.
Definition at line 373 of file HttpCarrier.cpp.
|
overridevirtual |
Get an OutputStream to write to.
Implements yarp::os::TwoWayStream.
Definition at line 368 of file HttpCarrier.cpp.
|
overridevirtual |
Get the address of the remote side of the stream.
Implements yarp::os::TwoWayStream.
Definition at line 378 of file HttpCarrier.cpp.
|
overridevirtual |
Check if the stream is ok or in an error state.
Implements yarp::os::OutputStream.
Definition at line 383 of file HttpCarrier.cpp.
|
overridevirtual |
Reset the stream.
Implements yarp::os::TwoWayStream.
Definition at line 388 of file HttpCarrier.cpp.
std::string * yarp::os::impl::HttpTwoWayStream::typeHint | ( | ) |
Definition at line 531 of file HttpCarrier.cpp.
bool yarp::os::impl::HttpTwoWayStream::useJson | ( | ) |
Definition at line 526 of file HttpCarrier.cpp.
|
overridevirtual |
Write a block of bytes to the stream.
b | the bytes to write |
Implements yarp::os::OutputStream.
Definition at line 393 of file HttpCarrier.cpp.