MCPcopy Create free account
hub / github.com/apache/httpd / sendv_data

Function sendv_data

modules/aaa/mod_authnz_fcgi.c:213–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213static apr_status_t sendv_data(const fcgi_provider_conf *conf,
214 request_rec *r,
215 apr_socket_t *s,
216 struct iovec *vec,
217 int nvec,
218 apr_size_t *len)
219{
220 apr_size_t to_write = 0, written = 0;
221 apr_status_t rv = APR_SUCCESS;
222 int i, offset;
223
224 for (i = 0; i < nvec; i++) {
225 to_write += vec[i].iov_len;
226#if AP_MODULE_MAGIC_AT_LEAST(20130702,2)
227 ap_log_rdata(APLOG_MARK, APLOG_TRACE5, r, "FastCGI data sent",
228 vec[i].iov_base, vec[i].iov_len, AP_LOG_DATA_SHOW_OFFSET);
229#endif
230 }
231
232 offset = 0;
233 while (to_write) {
234 apr_size_t n = 0;
235 rv = apr_socket_sendv(s, vec + offset, nvec - offset, &n);
236 if (rv != APR_SUCCESS) {
237 ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
238 APLOGNO(02498) "Sending data to %s failed",
239 conf->backend);
240 break;
241 }
242 if (n > 0) {
243 written += n;
244 if (written >= to_write)
245 break; /* short circuit out */
246 for (i = offset; i < nvec; ) {
247 if (n >= vec[i].iov_len) {
248 offset++;
249 n -= vec[i++].iov_len;
250 } else {
251 vec[i].iov_len -= n;
252 vec[i].iov_base = (char *) vec[i].iov_base + n;
253 break;
254 }
255 }
256 }
257 }
258
259 *len = written;
260
261 return rv;
262}
263
264static apr_status_t send_begin_request(request_rec *r,
265 const fcgi_provider_conf *conf,

Callers 2

send_begin_requestFunction · 0.85
send_environmentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected