| 30 | static TSTextLogObject pluginlog; |
| 31 | |
| 32 | bool |
| 33 | is_get_request(TSHttpTxn transaction) |
| 34 | { |
| 35 | TSMLoc req_loc; |
| 36 | TSMBuffer req_bufp; |
| 37 | if (TSHttpTxnClientReqGet(transaction, &req_bufp, &req_loc) == TS_ERROR) { |
| 38 | TSError("Error while retrieving client request header\n"); |
| 39 | return false; |
| 40 | } |
| 41 | int method_len = 0; |
| 42 | const char *method = TSHttpHdrMethodGet(req_bufp, req_loc, &method_len); |
| 43 | if (method_len != static_cast<int>(strlen(TS_HTTP_METHOD_GET)) || strncasecmp(method, TS_HTTP_METHOD_GET, method_len) != 0) { |
| 44 | TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc); |
| 45 | return false; |
| 46 | } |
| 47 | TSHandleMLocRelease(req_bufp, TS_NULL_MLOC, req_loc); |
| 48 | return true; |
| 49 | } |
| 50 | |
| 51 | int |
| 52 | global_handler(TSCont /* continuation ATS_UNUSED */, TSEvent event, void *data) |
no test coverage detected