Skip to content

Commit

Permalink
Accept OPTIONS in addition to GET for cross-domain queries.
Browse files Browse the repository at this point in the history
  • Loading branch information
jedisct1 authored and slact committed May 31, 2010
1 parent 296b7f0 commit a9d5452
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ngx_http_push_module.c
Expand Up @@ -255,7 +255,7 @@ static ngx_int_t ngx_http_push_subscriber_handler(ngx_http_request_t *r) {
ngx_str_t *content_type=NULL;
ngx_str_t *etag;

if (r->method != NGX_HTTP_GET) {
if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_OPTIONS) {
ngx_http_push_add_response_header(r, &NGX_HTTP_PUSH_HEADER_ALLOW, &NGX_HTTP_PUSH_ALLOW_GET); //valid HTTP for teh win
return NGX_HTTP_NOT_ALLOWED;
}
Expand Down Expand Up @@ -618,7 +618,7 @@ static void ngx_http_push_publisher_body_handler(ngx_http_request_t * r) {
return;
}
ngx_shmtx_unlock(&shpool->mutex);

switch(method) {
ngx_http_push_msg_t *msg, *previous_msg;
size_t content_type_len;
Expand Down Expand Up @@ -755,7 +755,8 @@ static void ngx_http_push_publisher_body_handler(ngx_http_request_t * r) {
return;

case NGX_HTTP_PUT:
case NGX_HTTP_GET:
case NGX_HTTP_GET:
case NGX_HTTP_OPTIONS:
r->headers_out.status = NGX_HTTP_OK;
ngx_http_finalize_request(r, ngx_http_push_channel_info(r, messages, subscribers, last_seen));
return;
Expand Down

0 comments on commit a9d5452

Please sign in to comment.