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
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
@@ -186,10 +187,23 @@ ioLoop ioLogger logger clientIn serverDefinition vfs sendMsg = do
186
187
go (parse parser remainder)
187
188
188
189
parser = do
190
+ try contentType <|> (return () )
191
+ len <- contentLength
192
+ try contentType <|> (return () )
193
+ _ <- string _ONE_CRLF
194
+ Attoparsec. take len
195
+
196
+ contentLength = do
189
197
_ <- string " Content-Length: "
190
198
len <- decimal
191
- _ <- string _TWO_CRLF
192
- Attoparsec. take len
199
+ _ <- string _ONE_CRLF
200
+ return len
201
+
202
+ contentType = do
203
+ _ <- string " Content-Type: "
204
+ skipWhile (/= ' \r ' )
205
+ _ <- string _ONE_CRLF
206
+ return ()
193
207
194
208
parseOne ::
195
209
MonadIO m
@@ -236,6 +250,8 @@ sendServer logger msgChan clientOut = do
236
250
-- |
237
251
--
238
252
--
253
+ _ONE_CRLF :: BS. ByteString
254
+ _ONE_CRLF = " \r\n "
239
255
_TWO_CRLF :: BS. ByteString
240
256
_TWO_CRLF = " \r\n\r\n "
241
257
You can’t perform that action at this time.
0 commit comments