// Copyright 2009 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Protocol buffers to provide input to the pagespeed library.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;
option java_package = "com.googlecode.page_speed";

package pagespeed;

message ProtoResource {
  message Header {
    required string key = 1;
    required string value = 2;
  }

  // Requested URL.
  optional string request_url = 1;

  // Request method (i.e. GET, POST).
  optional string request_method = 2;

  // Request protocol and version.
  optional string request_protocol = 3;

  // List request header key-value pairs.
  repeated Header request_headers = 4;

  // Request body.  Effectively the body of a HTTP POST.
  optional bytes request_body = 5;

  // Response protocol and version.
  optional string response_protocol = 6;

  // Status code.  See RFC 2616, sec 6.1.
  optional int32 response_status_code = 7;

  // List response header key-value pairs.
  repeated Header response_headers = 8;

  // Response body.
  optional bytes response_body = 9;
}

message ProtoInput {
  // Identifier to use when referring to this input set as a whole.
  optional string identifier = 1;

  // List of resources that are part of this page.
  repeated ProtoResource resources = 2;
}
