|
proxygen
|
#include <RFC1867.h>
Classes | |
| class | Callback |
Public Member Functions | |
| RFC1867Codec (const std::string &boundary) | |
| void | setCallback (Callback *callback) |
| std::unique_ptr< folly::IOBuf > | onIngress (std::unique_ptr< folly::IOBuf > data) |
| void | onIngressEOM () |
| uint64_t | getBytesProcessed () const |
Private Types | |
| enum | ParserState { ParserState::START, ParserState::HEADERS_START, ParserState::HEADERS, ParserState::FIELD_DATA, ParserState::DONE, ParserState::ERROR } |
Private Attributes | |
| std::string | boundary_ |
| Callback * | callback_ {nullptr} |
| ParserState | state_ {ParserState::START} |
| HTTP1xCodec | headerParser_ {TransportDirection::DOWNSTREAM} |
| std::string | field_ |
| folly::IOBufQueue | input_ {folly::IOBufQueue::cacheChainLength()} |
| folly::IOBufQueue | value_ |
| std::unique_ptr< folly::IOBuf > | pendingCR_ |
| uint64_t | bytesProcessed_ {0} |
| bool | parseError_ {false} |
Class for stream-parsing RFC 1867 style post data. At present it does not support nested multi-part content (multipart/mixed). Can parse multiple POST bodies unless one of them invokes the onError() callback. After that, the codec is no longer usable.
|
strongprivate |
| Enumerator | |
|---|---|
| START | |
| HEADERS_START | |
| HEADERS | |
| FIELD_DATA | |
| DONE | |
| ERROR | |
Definition at line 71 of file RFC1867.h.
|
inlineexplicit |
Definition at line 48 of file RFC1867.h.
References boundary_, headerParser_, and proxygen::HTTP1xCodec::setCallback().
|
inline |
|
inlineoverrideprivatevirtual |
Called for each block of message body data
| stream | The stream ID |
| chain | One or more buffers of body data. The codec will remove any protocol framing, such as HTTP/1.1 chunk headers, from the buffers before calling this function. |
| padding | Number of pad bytes that came with the data segment |
Implements proxygen::HTTPCodec::Callback.
Definition at line 85 of file RFC1867.h.
References headerParser_, parseError_, and proxygen::HTTP1xCodec::setParserPaused().
|
inlineoverrideprivatevirtual |
Called when a parsing or protocol error has occurred
| stream | The stream ID |
| error | Description of the error |
| newTxn | true if onMessageBegin has not been called for txn |
Implements proxygen::HTTPCodec::Callback.
Definition at line 101 of file RFC1867.h.
References headerParser_, parseError_, readToBoundary(), and proxygen::HTTP1xCodec::setParserPaused().
|
overrideprivatevirtual |
Called when all the headers of an ingress message have been parsed
| stream | The stream ID |
| msg | The message |
| size | Size of the ingress header |
Implements proxygen::HTTPCodec::Callback.
Definition at line 178 of file RFC1867.cpp.
References callback_, folly::Range< Iter >::data(), proxygen::ERROR, proxygen::HTTP_HEADER_CONTENT_DISPOSITION, folly::gen::move, name, folly::Range< Iter >::reset(), folly::Range< Iter >::size(), folly::Range< Iter >::str(), and value.
Referenced by onMessageBegin().
| std::unique_ptr< IOBuf > proxygen::RFC1867Codec::onIngress | ( | std::unique_ptr< folly::IOBuf > | data | ) |
Definition at line 61 of file RFC1867.cpp.
References folly::IOBufQueue::append(), c, callback_, ch, proxygen::ERROR, proxygen::spdy::HEADERS, folly::gen::move, and uint8_t.
Referenced by setCallback().
| void proxygen::RFC1867Codec::onIngressEOM | ( | ) |
Definition at line 299 of file RFC1867.cpp.
References callback_, proxygen::ERROR, and uint8_t.
Referenced by setCallback().
|
inlineoverrideprivatevirtual |
Called when a new message is seen while parsing the ingress
| stream | The stream ID |
| msg | A newly allocated HTTPMessage |
Implements proxygen::HTTPCodec::Callback.
Definition at line 81 of file RFC1867.h.
References onHeadersComplete().
|
inlineoverrideprivatevirtual |
Called at end of a message (including body and trailers, if applicable)
| stream | The stream ID |
| upgrade | Whether the connection has been upgraded to another protocol. |
Implements proxygen::HTTPCodec::Callback.
Definition at line 96 of file RFC1867.h.
References headerParser_, and proxygen::HTTP1xCodec::setParserPaused().
|
inlineoverrideprivatevirtual |
Called when all the trailers of an ingress message have been parsed, but only if the number of trailers is nonzero.
| stream | The stream ID |
| trailers | The message trailers |
Implements proxygen::HTTPCodec::Callback.
Definition at line 91 of file RFC1867.h.
References headerParser_, parseError_, and proxygen::HTTP1xCodec::setParserPaused().
|
private |
Definition at line 225 of file RFC1867.cpp.
References c, ch, folly::IOBuf::data(), folly::IOBuf::length(), folly::gen::move, ptr, folly::io::detail::CursorBase< Derived, BufType >::read(), folly::io::detail::CursorBase< Derived, BufType >::skip(), uint32_t, uint64_t, and uint8_t.
Referenced by onError().
|
inline |
Definition at line 54 of file RFC1867.h.
References callback_, data, onIngress(), and onIngressEOM().
|
private |
Definition at line 110 of file RFC1867.h.
Referenced by RFC1867Codec().
|
private |
Definition at line 118 of file RFC1867.h.
Referenced by getBytesProcessed().
Definition at line 111 of file RFC1867.h.
Referenced by setCallback().
|
private |
|
private |
Definition at line 113 of file RFC1867.h.
Referenced by onBody(), onError(), onMessageComplete(), onTrailersComplete(), and RFC1867Codec().
|
private |
|
private |
Definition at line 119 of file RFC1867.h.
Referenced by onBody(), onError(), and onTrailersComplete().
|
private |
|
private |
|
private |