Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsHttpChunkedDecoder_h__
7 #define nsHttpChunkedDecoder_h__
9 #include "nsError.h"
10 #include "nsString.h"
11 #include "nsHttpHeaderArray.h"
13 namespace mozilla { namespace net {
15 class nsHttpChunkedDecoder
16 {
17 public:
18 nsHttpChunkedDecoder() : mTrailers(nullptr)
19 , mChunkRemaining(0)
20 , mReachedEOF(false)
21 , mWaitEOF(false) {}
22 ~nsHttpChunkedDecoder() { delete mTrailers; }
24 bool ReachedEOF() { return mReachedEOF; }
26 // called by the transaction to handle chunked content.
27 nsresult HandleChunkedContent(char *buf,
28 uint32_t count,
29 uint32_t *contentRead,
30 uint32_t *contentRemaining);
32 nsHttpHeaderArray *Trailers() { return mTrailers; }
34 nsHttpHeaderArray *TakeTrailers() { nsHttpHeaderArray *h = mTrailers;
35 mTrailers = nullptr;
36 return h; }
38 uint32_t GetChunkRemaining() { return mChunkRemaining; }
40 private:
41 nsresult ParseChunkRemaining(char *buf,
42 uint32_t count,
43 uint32_t *countRead);
45 private:
46 nsHttpHeaderArray *mTrailers;
47 uint32_t mChunkRemaining;
48 nsCString mLineBuf; // may hold a partial line
49 bool mReachedEOF;
50 bool mWaitEOF;
51 };
53 }} // namespace mozilla::net
55 #endif