Commits

Anonymous committed 8a69559

websockets: removed masking for server-to-client messages

Comments (0)

Files changed (1)

src/amall_http.ml

       let () =
         if len <= 125
         then
-          ( msg.[1] := Char.chr (0x80 lor len)
+          ( msg.[1] := Char.chr len
           )
         else if len < 0x10000
         then
-          ( msg.[1] := Char.chr (0x80 lor 126)
+          ( msg.[1] := Char.chr 126
           ; msg.[2] := Char.chr (len lsr 8)
           ; msg.[3] := Char.chr (len land 0xFF)
           )
         else
-          ( msg.[1] := Char.chr (0x80 lor 127)
+          ( msg.[1] := Char.chr 127
           ; msg.[2] := Char.chr  (len lsr 56)
           ; msg.[3] := Char.chr ((len lsr 48) land 0xFF)
           ; msg.[4] := Char.chr ((len lsr 40) land 0xFF)
       in
       let () = String.blit body 0 msg hdr_len len in
       (* IO.write (in lwt and in direct io) is atomic *)
+      let () = dbg "Ws.send: %S" (Bytes.hexdump ~style:`Line msg) in
       IO.write sock.ch msg >>% fun () ->
       IO.flush sock.ch
     ;