anchor.diff:              PingInterval = int config.PingInterval.TotalMilliseconds }
           let payload = Payload([Open(handshake)])
           let engineContext = EngineIoContext.FromHttp ctx
  -        let ctx = { ctx with response = { ctx.response with headers = (ctx.response.headers |> List.map(fun (k,v) -> if k = "Access-Control-Allow-Credentials" then k,v.ToLower() else k,v)) } }
  -        return! respondPayload payload engineContext ctx
  +        let pipeline = setIoCookie config sid >=> respondPayload payload engineContext
  +        return! pipeline ctx
       }
           
  -    cors config.CORSConfig >=> choose [
  -        handshakePart
  -    ]
  +    choose [ handshakePart ]
  +        >=> cors config.CORSConfig
  +        >=> removeBuggyCorsHeader
  +        >=> disableXSSProtectionForIE
   
   [<EntryPoint>]
   let main argv = 
  
positive.code:             getPayload = (fun _ -> async { return None })
          }
  
  (*
  [<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
  module EngineIoConfig =
      let empty =
      *)
  
  let okJson x : WebPart = Writers.setMimeType "application/json" >=> Successful.OK x
  
  let parseIntChoice s =
      let ok, i = Int32.TryParse(s)
      if ok then Choice1Of2 i else Choice2Of2 (sprintf "Not a number: '%s'" s)
  
  type EngineIoContext = 
      {
          Transport: string
          JsonPIndex: int option
          SessionId: string
          Base64: bool
      }
  
      with static member FromHttp (ctx: HttpContext) = {
              Transport = defaultArg (ctx.request.queryParam "transport" |> Option.ofChoice) "polling"
              JsonPIndex = ctx.request.queryParam "j" |> Choice.bind parseIntChoice |> Option.ofChoice
              SessionId = defaultArg (ctx.request.queryParam "sid" |> Option.ofChoice) ""
              Base64 = (defaultArg (ctx.request.queryParam "b64" |> Choice.bind parseIntChoice |> Option.ofChoice) 0) = 1
          }
  
  let serveSocketIo (config: EngineIoConfig) =
      let respondPayload payload engineContext = 
          if engineContext.Base64 then
              Successful.OK (payload |> Payload.encodeToString)
          else
              Successful.ok (payload |> Payload.encodeToBinary |> Segment.toArray)
  
      let handshakePart ctx = async {
          let! sid = config.getHandshakeSid ctx
          let handshake = {
              Sid = sid;
  
negative.code:     }
  
      with static member empty = {
              CookieName = Some "io"
              CookiePath = Some "/"
              CookieHttpOnly = false
              Upgrades = Array.empty
              CORSConfig =
                  { defaultCORSConfig with
                      allowedMethods = InclusiveOption.Some([HttpMethod.GET; HttpMethod.POST])
                      allowedUris = InclusiveOption.All
                      allowCookies = false }
              PingTimeout = TimeSpan.FromSeconds(60.)
              PingInterval = TimeSpan.FromSeconds(25.)
              getHandshakeSid = (fun _ -> async { return Guid.NewGuid().ToString() })
  