MCPcopy Create free account
hub / github.com/apache/trafficserver / getMethod

Method getMethod

src/tscpp/api/Request.cc:110–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110HttpMethod
111Request::getMethod() const
112{
113 if (state_->hdr_buf_ && state_->hdr_loc_) {
114 int method_len;
115 const char *method_str = TSHttpHdrMethodGet(state_->hdr_buf_, state_->hdr_loc_, &method_len);
116 if (method_str && method_len) {
117 if (method_str == TS_HTTP_METHOD_GET) {
118 state_->method_ = HTTP_METHOD_GET;
119 } else if (method_str == TS_HTTP_METHOD_POST) {
120 state_->method_ = HTTP_METHOD_POST;
121 } else if (method_str == TS_HTTP_METHOD_HEAD) {
122 state_->method_ = HTTP_METHOD_HEAD;
123 } else if (method_str == TS_HTTP_METHOD_CONNECT) {
124 state_->method_ = HTTP_METHOD_CONNECT;
125 } else if (method_str == TS_HTTP_METHOD_DELETE) {
126 state_->method_ = HTTP_METHOD_DELETE;
127 } else if (method_str == TS_HTTP_METHOD_OPTIONS) {
128 state_->method_ = HTTP_METHOD_OPTIONS;
129 } else if (method_str == TS_HTTP_METHOD_PURGE) {
130 state_->method_ = HTTP_METHOD_PURGE;
131 } else if (method_str == TS_HTTP_METHOD_PUT) {
132 state_->method_ = HTTP_METHOD_PUT;
133 } else if (method_str == TS_HTTP_METHOD_TRACE) {
134 state_->method_ = HTTP_METHOD_TRACE;
135 } else if (method_str == TS_HTTP_METHOD_PUSH) {
136 state_->method_ = HTTP_METHOD_PUSH;
137 }
138 LOG_DEBUG("Request method=%d [%s] on hdr_buf=%p, hdr_loc=%p", state_->method_, HTTP_METHOD_STRINGS[state_->method_].c_str(),
139 state_->hdr_buf_, state_->hdr_loc_);
140 } else {
141 LOG_ERROR(
142 "TSHttpHdrMethodGet returned null string or it was zero length, hdr_buf=%p, hdr_loc=%p, method str=%p, method_len=%d",
143 state_->hdr_buf_, state_->hdr_loc_, method_str, method_len);
144 }
145 }
146 return state_->method_;
147}
148
149Url &
150Request::getUrl()

Callers 1

runMethod · 0.45

Calls 2

TSHttpHdrMethodGetFunction · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected