all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Carriage return and process-send-string
@ 2016-12-08  7:57 Vibhav Pant
  2016-12-08  8:25 ` Helmut Eller
  0 siblings, 1 reply; 2+ messages in thread
From: Vibhav Pant @ 2016-12-08  7:57 UTC (permalink / raw
  To: emacs-devel@gnu.org

While working on a library for the Language Server Protocol[1] (which
uses \r\n to
separate headers), I found out that `process-send-string` will convert
carriage returns in
the provided string to newlines. As an example, strace shows that

(process-send-string proc
    (format "Content-Length: 0\r\n\r\n")

ends up sending

read(0, "Content-Length: 0\n", 8192)  = 17
read(0, "\n", 8192)                     = 1
read(0, "\n", 8192)                     = 1
read(0, "\n", 8192)                     = 1

to the process. I tried setting `:coding-system` in `make-process` to
`'no-conversion`, but
this didn't fix the issue. Is this intended behavior? If so, are there
any ways to go around it?

Thanks,
Vibhav

[1] Language Server Protocol:
https://github.com/Microsoft/language-server-protocol

-- 
Vibhav Pant
vibhavp@gmail.com



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Carriage return and process-send-string
  2016-12-08  7:57 Carriage return and process-send-string Vibhav Pant
@ 2016-12-08  8:25 ` Helmut Eller
  0 siblings, 0 replies; 2+ messages in thread
From: Helmut Eller @ 2016-12-08  8:25 UTC (permalink / raw
  To: emacs-devel

On Thu, Dec 08 2016, Vibhav Pant wrote:

> (process-send-string proc
>     (format "Content-Length: 0\r\n\r\n")
>
> ends up sending
>
> read(0, "Content-Length: 0\n", 8192)  = 17

That's the receiving side, not the sender.

Are you using a subprocess or a socket?  A subprocess can go through a
PTY which can do all sorts of translations on the receiving side.

Helmut




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-08  8:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-08  7:57 Carriage return and process-send-string Vibhav Pant
2016-12-08  8:25 ` Helmut Eller

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.