2
* Copyright 2010 Google Inc.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
// Author: sligocki@google.com (Shawn Ligocki)
19
// Input resource created based on a network resource.
21
#ifndef NET_INSTAWEB_REWRITER_PUBLIC_URL_INPUT_RESOURCE_H_
22
#define NET_INSTAWEB_REWRITER_PUBLIC_URL_INPUT_RESOURCE_H_
24
#include "net/instaweb/http/public/request_context.h"
25
#include "net/instaweb/rewriter/public/cacheable_resource_base.h"
26
#include "net/instaweb/util/public/basictypes.h"
27
#include "net/instaweb/util/public/string_util.h"
28
#include "pagespeed/kernel/base/string.h" // for GoogleString
30
namespace net_instaweb {
36
class UrlInputResource : public CacheableResourceBase {
38
// Created only from RewriteDriver::CreateInputResource*
39
virtual ~UrlInputResource();
41
static void InitStats(Statistics* stats);
44
friend class RewriteDriver;
45
friend class UrlInputResourceTest;
46
UrlInputResource(RewriteDriver* rewrite_driver,
47
const ContentType* type,
48
const StringPiece& url,
49
bool is_authorized_domain);
51
virtual void PrepareRequest(const RequestContextPtr& request_context,
52
RequestHeaders* headers);
54
// If the resource is from a domain that is not explicitly authorized,
55
// the domain for the resource is stored in origin_ by the constructor
56
// so that when PrepareRequest is eventually called, this domain can be
57
// temporarily authorized for fetching purposes. Note that this is done
58
// to support inlining of unauthorized resources into the HTML, which is
59
// considered to be a safe action.
62
DISALLOW_COPY_AND_ASSIGN(UrlInputResource);
65
} // namespace net_instaweb
67
#endif // NET_INSTAWEB_REWRITER_PUBLIC_URL_INPUT_RESOURCE_H_