File tree 1 file changed +18
-2
lines changed
lsp/src/Language/LSP/Server 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
20
20
import Colog.Core (LogAction (.. ), WithSeverity (.. ), Severity (.. ), (<&) )
21
21
import Control.Concurrent
22
22
import Control.Concurrent.STM.TChan
23
+ import Control.Applicative ((<|>) )
23
24
import Control.Monad
24
25
import Control.Monad.STM
25
26
import Control.Monad.IO.Class
@@ -187,10 +188,23 @@ ioLoop ioLogger logger clientIn serverDefinition vfs sendMsg = do
187
188
go (parse parser remainder)
188
189
189
190
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
190
198
_ <- string " Content-Length: "
191
199
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 ()
194
208
195
209
parseOne ::
196
210
MonadIO m
@@ -241,6 +255,8 @@ sendServer _logger msgChan clientOut = do
241
255
-- |
242
256
--
243
257
--
258
+ _ONE_CRLF :: BS. ByteString
259
+ _ONE_CRLF = " \r\n "
244
260
_TWO_CRLF :: BS. ByteString
245
261
_TWO_CRLF = " \r\n\r\n "
246
262
You can’t perform that action at this time.
0 commit comments