-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong 'Content-Length' in response? #76
Comments
To save someone's time, this is in (define (display-message msg [out (current-output-port)])
(when (verbose-io?)
(eprintf "\nresp = ~v\n" msg))
(define null-port (open-output-nowhere))
(write-json msg null-port)
(define content-length (file-position null-port))
(fprintf out "Content-Length: ~a\r\n\r\n" content-length)
(write-json msg out)) Idea is writing message to nowhere port then rely on The following simple test shows write a string works normally (define out (open-output-nowhere))
(fprintf out "123")
(file-position out) ; 3 |
@dannypsnl Thank you for pointing it out! Just out of curiosity, were you able to replicate the issue? |
Yes, I have meet this problem before, and it became more frequently in 8.4 |
I have figured out the problem, and it's my fault. The |
But it still shouldn't be |
Yes. But it's not |
@Dev-XYS Should this issue be closed? It sounds like you worked out what was happening…? |
Yes. I will close it now. |
I am not entirely sure this problem really exists, but I have found that the response for
textDocument/completion
seems to give a wrongContent-Length
. However, usingracket-langserver
with VSCode is all right, but I'm not sure whether VSCode uses theContent-Length
field or just reads a complete JSON object for parsing responses.The way to reproduce the issue:
requests.txt
(contains 4 requests:initialize
,didOpen
,didChange
(inserts a character),completion
(requests completion) ). Use CRLF.(cat requests.txt && cat) | racket -l racket-langserver
. Wait for enough time that all four requests are processed, then Ctrl-C to terminate.It's the fourth request that gives the wrong
Content-Length
(72071), but the actual length of the JSON object is 72066. I've looked intomsg-io.rkt
, whereContent-Length
is computed, but I cannot figure out what's going wrong in the code.The text was updated successfully, but these errors were encountered: