HttpReply.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef SQUID_HTTPREPLY_H
10 #define SQUID_HTTPREPLY_H
11 
12 #include "http/StatusLine.h"
13 #include "HttpBody.h"
14 #include "HttpRequest.h"
15 
16 void httpReplyInitModule(void);
17 
18 /* Sync changes here with HttpReply.cc */
19 
20 class HttpHdrContRange;
21 
22 class HttpHdrSc;
23 
24 class HttpReply: public Http::Message
25 {
27 
28 public:
30 
31  HttpReply();
32  ~HttpReply();
33 
34  virtual void reset();
35 
41  virtual bool sanityCheckStartLine(const char *buf, const size_t hdr_len, Http::StatusCode *error);
42 
44  time_t date;
45 
46  time_t last_modified;
47 
48  time_t expires;
49 
51 
53 
55  const HttpHdrContRange *contentRange() const;
56 
57  short int keep_alive;
58 
61 
66  bool do_clean;
67 
68 public:
69  virtual int httpMsgParseError();
70 
71  virtual bool expectingBody(const HttpRequestMethod&, int64_t&) const;
72 
73  virtual bool inheritProperties(const Http::Message *);
74 
75  bool updateOnNotModified(HttpReply const *other);
76 
78  void setHeaders(Http::StatusCode status,
79  const char *reason, const char *ctype, int64_t clen, time_t lmt, time_t expires);
80 
82  MemBuf *pack() const;
83 
85  HttpReply *make304() const;
86 
87  void redirect(Http::StatusCode, const char *);
88 
89  int64_t bodySize(const HttpRequestMethod&) const;
90 
94  bool receivedBodyTooLarge(HttpRequest&, int64_t receivedBodySize);
95 
100 
101  int validatorsMatch (HttpReply const *other) const;
102 
103  void packHeadersInto(Packable * p) const;
104 
108  HttpReply *clone() const;
109 
111  void removeStaleWarnings();
112 
113  virtual void hdrCacheInit();
114 
117  bool olderThan(const HttpReply *them) const;
118 
119 private:
121  void init();
122 
123  void clean();
124 
125  void hdrCacheClean();
126 
127  void packInto(Packable * p) const;
128 
129  /* ez-routines */
131  MemBuf *packed304Reply() const;
132 
133  /* header manipulation */
134  time_t hdrExpirationTime();
135 
139  void calcMaxBodySize(HttpRequest& request) const;
140 
141  String removeStaleWarningValues(const String &value);
142 
143  mutable int64_t bodySizeMax;
146 
147 protected:
148  virtual void packFirstLineInto(Packable * p, bool) const { sline.packInto(p); }
149 
150  virtual bool parseFirstLine(const char *start, const char *end);
151 };
152 
153 #endif /* SQUID_HTTPREPLY_H */
154 
short int keep_alive
Definition: HttpReply.h:57
void packInto(Packable *) const
pack fields into a Packable object
Definition: StatusLine.cc:46
void calcMaxBodySize(HttpRequest &request) const
Definition: HttpReply.cc:518
void httpReplyInitModule(void)
HttpReply * make304() const
Definition: HttpReply.cc:110
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
void error(char *format,...)
MemBuf * pack() const
Definition: HttpReply.cc:101
~HttpReply()
Definition: HttpReply.cc:42
bool expectedBodyTooLarge(HttpRequest &request)
Definition: HttpReply.cc:497
int64_t bodySize(const HttpRequestMethod &) const
Definition: HttpReply.cc:361
void removeStaleWarnings()
Remove Warnings with warn-date different from Date value.
Definition: HttpReply.cc:571
void hdrCacheClean()
Definition: HttpReply.cc:337
void redirect(Http::StatusCode, const char *)
Definition: HttpReply.cc:186
virtual void hdrCacheInit()
Definition: HttpReply.cc:305
char * p
Definition: membanger.c:43
String protoPrefix
Definition: HttpReply.h:64
int validatorsMatch(HttpReply const *other) const
Definition: HttpReply.cc:204
void clean()
Definition: HttpReply.cc:71
virtual int httpMsgParseError()
Definition: HttpReply.cc:448
MemBuf * packed304Reply() const
Definition: HttpReply.cc:139
virtual bool sanityCheckStartLine(const char *buf, const size_t hdr_len, Http::StatusCode *error)
Definition: HttpReply.cc:386
const HttpHdrContRange * contentRange() const
Definition: HttpReply.cc:329
int64_t bodySizeMax
Definition: HttpReply.h:143
StatusCode
Definition: StatusCode.h:20
time_t hdrExpirationTime()
Definition: HttpReply.cc:267
virtual bool expectingBody(const HttpRequestMethod &, int64_t &) const
Definition: HttpReply.cc:461
void setHeaders(Http::StatusCode status, const char *reason, const char *ctype, int64_t clen, time_t lmt, time_t expires)
Definition: HttpReply.cc:151
bool updateOnNotModified(HttpReply const *other)
Definition: HttpReply.cc:246
String content_type
Definition: HttpReply.h:50
bool do_clean
Definition: HttpReply.h:66
time_t last_modified
Definition: HttpReply.h:46
common parts of HttpRequest and HttpReply
Definition: Message.h:24
Http::StatusLine sline
Definition: HttpReply.h:60
virtual bool parseFirstLine(const char *start, const char *end)
Definition: HttpReply.cc:441
time_t date
Definition: HttpReply.h:44
HttpHdrSc * surrogate_control
Definition: HttpReply.h:52
void const char * buf
Definition: stub_helper.cc:16
RefCount< HttpReply > Pointer
Definition: HttpReply.h:29
bool olderThan(const HttpReply *them) const
Definition: HttpReply.cc:636
HttpBody body
Definition: HttpReply.h:62
Definition: MemBuf.h:23
virtual void packFirstLineInto(Packable *p, bool) const
Definition: HttpReply.h:148
void packHeadersInto(Packable *p) const
Definition: HttpReply.cc:85
void init()
Definition: HttpReply.cc:49
bool receivedBodyTooLarge(HttpRequest &, int64_t receivedBodySize)
Definition: HttpReply.cc:489
virtual void reset()
Definition: HttpReply.cc:57
MEMPROXY_CLASS(HttpReply)
time_t expires
Definition: HttpReply.h:48
void packInto(Packable *p) const
Definition: HttpReply.cc:93
HttpHdrContRange * content_range
parsed Content-Range; nil for non-206 responses!
Definition: HttpReply.h:145
String removeStaleWarningValues(const String &value)
Definition: HttpReply.cc:591
virtual bool inheritProperties(const Http::Message *)
Definition: HttpReply.cc:561
HttpReply * clone() const
Definition: HttpReply.cc:545

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors