From 914a3808ebefb0f7f0a728469a2ce6b56dfc316c Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 15 Nov 2021 20:45:21 -0500 Subject: Http protocol support (#2012) * #include an absolute path didn't work - because paths were taken to always be relative. * Use 'Process' to communicate with an command line tool. * Remove slang-win-stream * Tidy up windows ProcessUtil. * First version of BufferedReadStream. * Windows working IPC for steams. * Test proxy count option. * Split Process/ProcessUtil. Process is platform dependant. ProcessUtil are functions that are platform independent. * First implementation of Unix Process interface. * Unix process compiles on cygwin. * Fix typo in unix process. * Separate unix pipe stream error of invalid access, from pipe availability. * Fix in standard line extraction. * Make fd non blocking. * Fix issues with Windows Process streams. * Added UnixPipe. * Some fixes around UnixPipeStream. * Make a unix stream closed explicit. * Hack to debug linux process/stream. * Revert to old linux pipe handling. * Pass executable path for unit tests. Split out CommandLine into own source. * Small improvements in process/command line. * Check process behavior with crash. * Make stderr and stdout unbuffered for crash testing. * Only turn disable buffering in crash test. * Disable crash test on CI. * Fix crash on clang/linux. * Enable crash test. Remove _appendBuffer as can use StreamUtil functionality. * Added inital processing for http headers. * Small improvements to HttpHeader. * First pass HTTPPacketConnection working on windows. * Enable other Process communication tests. * Update comments. --- source/core/slang-stream.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'source/core/slang-stream.h') diff --git a/source/core/slang-stream.h b/source/core/slang-stream.h index f6c9f54a3..a163a0c5d 100644 --- a/source/core/slang-stream.h +++ b/source/core/slang-stream.h @@ -201,16 +201,34 @@ public: /// Will read assuming backing stream is SlangResult update(); + /// Consume bytes in the buffer. + void consume(Index byteCount); + Byte* getBuffer() { return m_buffer.getBuffer() + m_startIndex; } const Byte* getBuffer() const { return m_buffer.getBuffer() + m_startIndex; } size_t getCount() const { return m_buffer.getCount() - m_startIndex; } + /// Read until the buffer contains the specified amount of bytes + SlangResult readUntilContains(size_t size); + ConstArrayView getView() const { return ConstArrayView(getBuffer(), Index(getCount())); } ArrayView getView() { return ArrayView(getBuffer(), Index(getCount())); } + BufferedReadStream(Stream* stream) : + m_stream(stream), + m_startIndex(0) + { + + } + protected: - void _advanceStartIndex(Index byteCount); + + void _resetBuffer() + { + m_startIndex = 0; + m_buffer.setCount(0); + } size_t m_defaultReadSize = 1024; ///< When initiating a read the default read size List m_buffer; ///< Holds the characters -- cgit v1.2.3