Skip to content

Fixed a bug when writing the response#81

Open
lodi-g wants to merge 2 commits intosolusipse:masterfrom
lodi-g:fixresponse
Open

Fixed a bug when writing the response#81
lodi-g wants to merge 2 commits intosolusipse:masterfrom
lodi-g:fixresponse

Conversation

@lodi-g
Copy link

@lodi-g lodi-g commented Apr 8, 2018

Changed the way to write response

- Writing len - 1, to avoid writing a \0 to stdout
- Using asprintf to build the url instead of a VLA

lodi-g added 2 commits April 8, 2018 20:10
- Writing len - 1, to avoid writing a \0 to stdout
- Using asprintf to build the url instead of a VLA
@amckinlay
Copy link

Why is the related change reducing the socket timeout to 500ms better? Why switch to asprintf()? It is not SUS.

+1 on this PR. nc termbin.com 9999 terminates with a null character. When the output of nc is piped directly to the clipboard, the termbin URL looks like:

Screen Shot 2020-11-02 at 2 23 54 PM

When termbin is run from Vim it also shows the null character:

  1 hi
~

:w !{nc termbin.com 9999}
https://termbin.com/jtrg
^@
Press ENTER or type command to continue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants