| 1053 | } |
| 1054 | |
| 1055 | static int |
| 1056 | synserver_txn_read_request(TSCont contp) |
| 1057 | { |
| 1058 | ServerTxn *txn = static_cast<ServerTxn *>(TSContDataGet(contp)); |
| 1059 | TSAssert(txn->magic == MAGIC_ALIVE); |
| 1060 | |
| 1061 | int end; |
| 1062 | TSIOBufferBlock block = TSIOBufferReaderStart(txn->req_reader); |
| 1063 | |
| 1064 | while (block != nullptr) { |
| 1065 | int64_t blocklen; |
| 1066 | const char *blockptr = TSIOBufferBlockReadStart(block, txn->req_reader, &blocklen); |
| 1067 | |
| 1068 | if (txn->request_len + blocklen <= REQUEST_MAX_SIZE) { |
| 1069 | memcpy((txn->request + txn->request_len), blockptr, blocklen); |
| 1070 | txn->request_len += blocklen; |
| 1071 | } else { |
| 1072 | TSError("Error: Request length %" PRId64 " > request buffer size %d", txn->request_len + blocklen, REQUEST_MAX_SIZE); |
| 1073 | } |
| 1074 | |
| 1075 | block = TSIOBufferBlockNext(block); |
| 1076 | } |
| 1077 | |
| 1078 | txn->request[txn->request_len] = '\0'; |
| 1079 | Dbg(dbg_ctl_SockServer, "Request = |%s|, req len = %d", txn->request, txn->request_len); |
| 1080 | |
| 1081 | end = (strstr(txn->request, HTTP_REQUEST_END) != nullptr); |
| 1082 | Dbg(dbg_ctl_SockServer, "End of request = %d", end); |
| 1083 | |
| 1084 | return end; |
| 1085 | } |
| 1086 | |
| 1087 | static int |
| 1088 | synserver_txn_read_request_handler(TSCont contp, TSEvent event, void * /* data ATS_UNUSED */) |
no test coverage detected