109
static ngx_str_t ngx_http_gif_type = ngx_string("image/gif");
109
113
ngx_http_empty_gif_handler(ngx_http_request_t *r)
115
ngx_http_complex_value_t cv;
115
117
if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {
116
118
return NGX_HTTP_NOT_ALLOWED;
119
rc = ngx_http_discard_request_body(r);
125
r->headers_out.content_type.len = sizeof("image/gif") - 1;
126
r->headers_out.content_type.data = (u_char *) "image/gif";
128
if (r->method == NGX_HTTP_HEAD) {
129
r->headers_out.status = NGX_HTTP_OK;
130
r->headers_out.content_length_n = sizeof(ngx_empty_gif);
131
r->headers_out.last_modified_time = 23349600;
133
return ngx_http_send_header(r);
136
b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
138
return NGX_HTTP_INTERNAL_SERVER_ERROR;
144
b->pos = ngx_empty_gif;
145
b->last = ngx_empty_gif + sizeof(ngx_empty_gif);
149
r->headers_out.status = NGX_HTTP_OK;
150
r->headers_out.content_length_n = sizeof(ngx_empty_gif);
121
ngx_memzero(&cv, sizeof(ngx_http_complex_value_t));
123
cv.value.len = sizeof(ngx_empty_gif);
124
cv.value.data = ngx_empty_gif;
151
125
r->headers_out.last_modified_time = 23349600;
153
rc = ngx_http_send_header(r);
155
if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
159
return ngx_http_output_filter(r, &out);
127
return ngx_http_send_response(r, NGX_HTTP_OK, &ngx_http_gif_type, &cv);