1
// Copyright 2010 Google Inc.
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
7
// http://www.apache.org/licenses/LICENSE-2.0
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
15
#ifndef MOD_SPDY_COMMON_HTTP_RESPONSE_VISITOR_INTERFACE_H_
16
#define MOD_SPDY_COMMON_HTTP_RESPONSE_VISITOR_INTERFACE_H_
18
#include "base/basictypes.h"
19
#include "base/string_piece.h"
23
// Interface that gets called back as an HTTP response is visited.
24
class HttpResponseVisitorInterface {
26
HttpResponseVisitorInterface();
27
virtual ~HttpResponseVisitorInterface();
29
// Called when an HTTP response status line is visited. Indicates that a new
30
// HTTP response is being visited.
31
virtual void OnStatusLine(const base::StringPiece& version,
32
const base::StringPiece& status_code,
33
const base::StringPiece& status_phrase) = 0;
35
// Called zero or more times, once for each leading (i.e. normal, not
36
// trailing) HTTP header. This is called after OnStatusLine but before
37
// OnLeadingHeadersComplete.
38
virtual void OnLeadingHeader(const base::StringPiece& key,
39
const base::StringPiece& value) = 0;
41
// Called after the leading HTTP headers have been visited. This will be
42
// called exactly once when the leading headers are done (even if there were
43
// no leading headers). If the `fin` argument is true, the response is now
44
// complete (i.e. it has no body) and no more methods will be called.
45
virtual void OnLeadingHeadersComplete(bool fin) = 0;
47
// Called zero or more times, after OnLeadingHeadersComplete. If the `fin`
48
// argument is true, the response is now complete and no more methods will be
50
virtual void OnData(const base::StringPiece& data, bool fin) = 0;
53
DISALLOW_COPY_AND_ASSIGN(HttpResponseVisitorInterface);
56
} // namespace mod_spdy
58
#endif // MOD_SPDY_COMMON_HTTP_RESPONSE_VISITOR_INTERFACE_H_