Skip to content

Commit

Permalink
Fixes spelling/license formatting in traffic_dump plugin (apache#7047)
Browse files Browse the repository at this point in the history
  • Loading branch information
randall committed Jul 28, 2020
1 parent 35d28d5 commit 9467a2c
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 21 deletions.
7 changes: 6 additions & 1 deletion plugins/experimental/traffic_dump/global_variables.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/** @sensitive_fields.h
/** @file
The set of fields considered user-sensitive.
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
Expand Down
7 changes: 6 additions & 1 deletion plugins/experimental/traffic_dump/json_utils.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/** @json_utils.cc
/** @file
Implementation of JSON formatting functions.
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
Expand Down
7 changes: 6 additions & 1 deletion plugins/experimental/traffic_dump/json_utils.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/** @json_utils.h
/** @file
JSON formatting functions.
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
Expand Down
9 changes: 7 additions & 2 deletions plugins/experimental/traffic_dump/sensitive_fields.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/** @sensitive_fields.h
/** @file
Define the type used to store user-sensitive HTTP fields (such as cookies).
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
Expand All @@ -26,7 +31,7 @@

namespace traffic_dump
{
// A case-insensitive comparitor used for comparing HTTP field names.
// A case-insensitive comparator used for comparing HTTP field names.
struct InsensitiveCompare {
bool
operator()(std::string_view a, std::string_view b) const
Expand Down
11 changes: 8 additions & 3 deletions plugins/experimental/traffic_dump/session_data.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/** @session_handler.h
/** @file
Traffic Dump session handling implementation
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
regarding copyright ownership. The ASF licenses this file
to you 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.
Expand Down Expand Up @@ -287,7 +292,7 @@ SessionData::~SessionData()

/*
* Note this assumes that the caller holds the disk_io_mutex lock. This is a
* private member function. The two publically accessible functions hold the
* private member function. The two publicly accessible functions hold the
* lock before calling this.
*/
int
Expand Down
9 changes: 7 additions & 2 deletions plugins/experimental/traffic_dump/session_data.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/** @session_handler.h
/** @file
Traffic Dump session handling encapsulation.
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
regarding copyright ownership. The ASF licenses this file
to you 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.
Expand Down
7 changes: 6 additions & 1 deletion plugins/experimental/traffic_dump/traffic_dump.cc
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
/** @traffic_dump.cc
/** @file
Plugin Traffic Dump captures traffic on a per session basis. A sampling ratio can be set via plugin.config or traffic_ctl to dump
one out of n sessions. The dump file schema can be found
https://github.com/apache/trafficserver/tree/master/tests/tools/lib/replay_schema.json
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
Expand Down
21 changes: 13 additions & 8 deletions plugins/experimental/traffic_dump/transaction_data.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/** @txn_data.cc
/** @file
Implementation of Traffic Dump transaction data.
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
Expand All @@ -26,7 +31,7 @@ namespace traffic_dump
int TransactionData::transaction_arg_index = 0;
sensitive_fields_t TransactionData::sensitive_fields;

std::string defaut_sensitive_field_value;
std::string default_sensitive_field_value;

/// Fields considered sensitive because they may contain user-private
/// information. These fields are replaced with auto-generated generic content by
Expand All @@ -45,9 +50,9 @@ TransactionData::initialize_default_sensitive_field()
// 128 KB is the maximum size supported for all headers, so this size should
// be plenty large for our needs.
constexpr size_t default_field_size = 128 * 1024;
defaut_sensitive_field_value.resize(default_field_size);
default_sensitive_field_value.resize(default_field_size);

char *field_buffer = defaut_sensitive_field_value.data();
char *field_buffer = default_sensitive_field_value.data();
for (auto i = 0u; i < default_field_size; i += 8) {
sprintf(field_buffer, "%07x ", i / 8);
field_buffer += 8;
Expand Down Expand Up @@ -95,13 +100,13 @@ TransactionData::replace_sensitive_fields(std::string_view name, std::string_vie
return original_value;
}
auto new_value_size = original_value.size();
if (original_value.size() > defaut_sensitive_field_value.size()) {
new_value_size = defaut_sensitive_field_value.size();
if (original_value.size() > default_sensitive_field_value.size()) {
new_value_size = default_sensitive_field_value.size();
TSError("[%s] Encountered a sensitive field value larger than our default "
"field size. Default size: %zu, incoming field size: %zu",
debug_tag, defaut_sensitive_field_value.size(), original_value.size());
debug_tag, default_sensitive_field_value.size(), original_value.size());
}
return std::string_view{defaut_sensitive_field_value.data(), new_value_size};
return std::string_view{default_sensitive_field_value.data(), new_value_size};
}

std::string
Expand Down
9 changes: 7 additions & 2 deletions plugins/experimental/traffic_dump/transaction_data.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
/** @txn_data.h
/** @file
Traffic Dump data specific to transactions.
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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.
Expand Down Expand Up @@ -37,7 +42,7 @@ class TransactionData
/** The string for the JSON content of this transaction. */
std::string txn_json;

/** The '"protocol" node for this transaction's server-side conection. */
/** The '"protocol" node for this transaction's server-side connection. */
std::string server_protocol_description;

// The index to be used for the TS API for storing this TransactionData on a
Expand Down

0 comments on commit 9467a2c

Please sign in to comment.