Github user chewbranca commented on a diff in the pull request:

    https://github.com/apache/couchdb-chttpd/pull/101#discussion_r54460184
  
    --- Diff: src/chttpd_cors.erl ---
    @@ -159,17 +159,24 @@ handle_preflight_request(Req, Config, Origin) ->
     
     
     headers(Req, RequestHeaders) ->
    -    case get_origin(Req) of
    -        undefined ->
    -            %% If the Origin header is not present terminate
    -            %% this set of steps. The request is outside the scope
    -            %% of this specification.
    -            %% http://www.w3.org/TR/cors/#resource-processing-model
    -            RequestHeaders;
    -        Origin ->
    -            headers(Req, RequestHeaders, Origin, get_cors_config(Req))
    +    case is_preflight_response(RequestHeaders) of
    --- End diff --
    
    Why do we need the extra level of nesting checking for 
`is_preflight_response/1`? It's not clear to me that we can reach a scenario 
where `Access-Control-Allow-Origin` header has been set but the Origin header 
is absent. Is this addressing a missed edge case?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to