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

Function regfnWriteClient

modules/arch/win32/mod_isapi.c:807–861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

805}
806
807static int APR_THREAD_FUNC regfnWriteClient(isapi_cid *cid,
808 void *buf_ptr,
809 apr_uint32_t *size_arg,
810 apr_uint32_t flags)
811{
812 request_rec *r = cid->r;
813 conn_rec *c = r->connection;
814 apr_uint32_t buf_size = *size_arg;
815 char *buf_data = (char*)buf_ptr;
816 apr_bucket_brigade *bb;
817 apr_bucket *b;
818 apr_status_t rv = APR_SUCCESS;
819
820 if (!cid->headers_set) {
821 /* It appears that the foxisapi module and other clients
822 * presume that WriteClient("headers\n\nbody") will work.
823 * Parse them out, or die trying.
824 */
825 apr_ssize_t ate;
826 ate = send_response_header(cid, NULL, buf_data, 0, buf_size);
827 if (ate < 0) {
828 apr_set_os_error(APR_FROM_OS_ERROR(ERROR_INVALID_PARAMETER));
829 return 0;
830 }
831
832 buf_data += ate;
833 buf_size -= ate;
834 }
835
836 if (buf_size) {
837 bb = apr_brigade_create(r->pool, c->bucket_alloc);
838 b = apr_bucket_transient_create(buf_data, buf_size, c->bucket_alloc);
839 APR_BRIGADE_INSERT_TAIL(bb, b);
840 b = apr_bucket_flush_create(c->bucket_alloc);
841 APR_BRIGADE_INSERT_TAIL(bb, b);
842 rv = ap_pass_brigade(r->output_filters, bb);
843 cid->response_sent = 1;
844 if (rv != APR_SUCCESS)
845 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r, APLOGNO(02984)
846 "WriteClient ap_pass_brigade failed: %s",
847 r->filename);
848 }
849
850 if ((flags & HSE_IO_ASYNC) && cid->completion) {
851 if (rv == APR_SUCCESS) {
852 cid->completion(cid->ecb, cid->completion_arg,
853 *size_arg, ERROR_SUCCESS);
854 }
855 else {
856 cid->completion(cid->ecb, cid->completion_arg,
857 *size_arg, ERROR_WRITE_FAULT);
858 }
859 }
860 return (rv == APR_SUCCESS);
861}
862
863static int APR_THREAD_FUNC regfnServerSupportFunction(isapi_cid *cid,
864 apr_uint32_t HSE_code,

Callers

nothing calls this directly

Calls 2

send_response_headerFunction · 0.85
ap_pass_brigadeFunction · 0.85

Tested by

no test coverage detected