1 /** @file 2 3 Http1Transaction.cc - The Transaction class for Http1* 4 5 @section license License 6 7 Licensed to the Apache Software Foundation (ASF) under one 8 or more contributor license agreements. See the NOTICE file 9 distributed with this work for additional information 10 regarding copyright ownership. The ASF licenses this file 11 to you under the Apache License, Version 2.0 (the 12 "License"); you may not use this file except in compliance 13 with the License. You may obtain a copy of the License at 14 15 http://www.apache.org/licenses/LICENSE-2.0 16 17 Unless required by applicable law or agreed to in writing, software 18 distributed under the License is distributed on an "AS IS" BASIS, 19 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 See the License for the specific language governing permissions and 21 limitations under the License. 22 */ 23 24 #include "Http1Transaction.h" 25 #include "Http1ClientSession.h" 26 #include "HttpSM.h" 27 28 void release(IOBufferReader * r)29Http1Transaction::release(IOBufferReader *r) 30 { 31 } 32 33 void reset()34Http1Transaction::reset() 35 { 36 _sm = nullptr; 37 } 38 39 void transaction_done()40Http1Transaction::transaction_done() 41 { 42 SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread()); 43 super_type::transaction_done(); 44 if (_proxy_ssn) { 45 static_cast<Http1ClientSession *>(_proxy_ssn)->release_transaction(); 46 } 47 } 48 49 bool allow_half_open() const50Http1Transaction::allow_half_open() const 51 { 52 bool config_allows_it = (_sm) ? _sm->t_state.txn_conf->allow_half_open > 0 : true; 53 if (config_allows_it) { 54 // Check with the session to make sure the underlying transport allows the half open scenario 55 return static_cast<Http1ClientSession *>(_proxy_ssn)->allow_half_open(); 56 } 57 return false; 58 } 59 60 void increment_client_transactions_stat()61Http1Transaction::increment_client_transactions_stat() 62 { 63 HTTP_INCREMENT_DYN_STAT(http_current_client_transactions_stat); 64 } 65 66 void decrement_client_transactions_stat()67Http1Transaction::decrement_client_transactions_stat() 68 { 69 HTTP_DECREMENT_DYN_STAT(http_current_client_transactions_stat); 70 } 71 72 // 73 int get_transaction_id() const74Http1Transaction::get_transaction_id() const 75 { 76 // For HTTP/1 there is only one on-going transaction at a time per session/connection. Therefore, the transaction count can be 77 // presumed not to increase during the lifetime of a transaction, thus this function will return a consistent unique transaction 78 // identifier. 79 // 80 return _proxy_ssn->get_transact_count(); 81 } 82