Open CyberShadow opened 8 months ago
I kinda managed to get it to work with url with an after-change-functions hook,
You mean like this?
(let ((b (url-retrieve "https://httpbin.org/range/1024?duration=8&chunk_size=64"
(lambda (&rest _args) (kill-buffer)))))
(push (lambda (beg end _len)
(message "Got %s" (buffer-substring beg end)))
(buffer-local-value 'after-change-functions b)))
I wouldn't use this library anymore. It's slow and more trouble than it's worth. Granted the built-in url library is written in precisely the wrong way, but I still prefer it to clumsily spawning a curl subprocess.
You mean like this?
Yes, that's what I'm doing. Aside from the problem of how to disconnect, the above code is not quite correct when something like "Content-Encoding: chunked" is used. But if you stick the hook in a 0-second timer so that it runs after url
does its postprocessing, then it seems to work fine.
I wouldn't use this library anymore.
Sorry, do you mean url
or request
?
Either way, what would you recommend?
I wouldn't use request
. It sucks, and while Content-Encoding: chunked
, whatever that means, doesn't work out of the box with url
, I wouldn't attempt to get it to work with request
. I also gag slightly when I hear about 0-second timers. Sorry bruh. Will accept crypto if you want me to do it right nice. Problem statement must be terse and limited to 500 words including code snippets.
Err, thanks, writing code is not the problem. It's all going up on GitHub in the end anyway. Was just wondering if there's a more established library I should be using instead. Cheers.
I believe some nimrod is floating his own http library as an alternative to this one which he denigrates every chance he gets. Google around.
Hi,
Is it possible to receive response data incrementally? E.g. for
Content-Type: text/event-stream
responses?I kinda managed to get it to work with
url
with anafter-change-functions
hook, but that seems hacky and there doesn't seem to be a clean way to interrupt an in-progress request.Thanks!