File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
lsp/src/Language/LSP/Server Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import qualified Colog.Core as L
2020import Colog.Core (LogAction (..), WithSeverity (..), Severity (..), (<&))
2121import Control.Concurrent
2222import Control.Concurrent.STM.TChan
23+ import Control.Applicative((<|>))
2324import Control.Monad
2425import Control.Monad.STM
2526import Control.Monad.IO.Class
@@ -187,10 +188,23 @@ ioLoop ioLogger logger clientIn serverDefinition vfs sendMsg = do
187188 go (parse parser remainder)
188189
189190 parser = do
191+ try contentType <|> (return ())
192+ len <- contentLength
193+ try contentType <|> (return ())
194+ _ <- string _ONE_CRLF
195+ Attoparsec.take len
196+
197+ contentLength = do
190198 _ <- string "Content-Length: "
191199 len <- decimal
192- _ <- string _TWO_CRLF
193- Attoparsec.take len
200+ _ <- string _ONE_CRLF
201+ return len
202+
203+ contentType = do
204+ _ <- string "Content-Type: "
205+ skipWhile (/='\r')
206+ _ <- string _ONE_CRLF
207+ return ()
194208
195209parseOne ::
196210 MonadIO m
@@ -241,6 +255,8 @@ sendServer _logger msgChan clientOut = do
241255-- |
242256--
243257--
258+ _ONE_CRLF :: BS.ByteString
259+ _ONE_CRLF = "\r\n"
244260_TWO_CRLF :: BS.ByteString
245261_TWO_CRLF = "\r\n\r\n"
246262
You can’t perform that action at this time.
0 commit comments