Commit Graph

21 Commits (d18d92f925f791271b095df968d290ced05d065a)

Author SHA1 Message Date
Cheng d18d92f925
Replace fmt.Errorf with no parameters with errors.New (#3747) 1 month ago
Junegunn Choi 05453881c3
Set a 2-second timeout for POST requests
Close #3685
2 months ago
onee-only 61bc129e1d Update parseGetParams to call strconv.Atoi when params are valid 3 months ago
onee-only 52210a57f0 Update error return position according to convention 3 months ago
onee-only 8061a2f108 Remove duplicate code 3 months ago
Junegunn Choi 7484292e63
Avoid deadlocks by adding a 2 second timeout to GET / endpoint
Because fzf processes HTTP GET requests in the main event loop,
accessing the endpoint from within execute/transform actions would
result in a deadlock and hang fzf indefinitely. This commit sets
a 2 second timeout to avoid the deadlock.
4 months ago
Jan Verbeek 91387a741b
Terminate simple server success response with double CRLF (#3542)
The simple success case had only the status line plus a single CRLF,
and pedantic HTTP client implementations (`hyper`) stumbled over
this. A double CRLF makes it OK.

Fixes #3541.
6 months ago
Junegunn Choi a818653174
Add --listen-unsafe=ADDR to allow remote process execution (#3498) 7 months ago
Junegunn Choi c5aa8729a1
Fix failing test case 7 months ago
Junegunn Choi 3f78d76da1
Allow accepting remote connections
Close #3498

  # FZF_API_KEY is required for a non-localhost listen address
  FZF_API_KEY=xxx fzf --listen 0.0.0.0:6266
7 months ago
Junegunn Choi 901939bd96
Add support for limit and offset parameters for GET / endpoint
Related #3372
9 months ago
Junegunn Choi 0f50dc848e
Add 'GET /' endpoint for getting the program state (experimental)
Related #3372
9 months ago
Boaz Yaniv c0435fdff4
Add API Keys for fzf --listen (#3374) 11 months ago
Junegunn Choi fcd7e8768d
Omit port number in `--listen` for automatic port assignment
Close #3200
1 year ago
Junegunn Choi ec20dfe312
Only allow local requests 1 year ago
Junegunn Choi b7bb973118
Revert "Add GET endpoints for getting the state of the finder"
This reverts commit 750b2a6313.

This can cause a deadlock if the endpoints are accessed in the core event
loop via execute action.

  fzf --listen 6266 --bind 'space:execute:curl localhost:6266'

Technically, there's no reason to use the API because the information is
already available via `{}` and `{q}`, but I'd like to completely remove
the risk of misuse.
1 year ago
Junegunn Choi 750b2a6313
Add GET endpoints for getting the state of the finder
* GET / (or GET /current)
* GET /query
1 year ago
Junegunn Choi 1a9761736e
Add time and size limit to remote requests 1 year ago
Junegunn Choi fd1f7665a7
Abort fzf if --listen port is unavailable 1 year ago
Junegunn Choi cf69b836ac Only trim CR and NF from the submitted expression
So the trailing space in the following case is respected.

  curl -XPOST localhost:6266 -d "change-prompt:$(date)> "
1 year ago
Junegunn Choi 4b055bf260 Rewrite HTTP server without net/http
This cuts down the binary size from 5.7MB to 3.3MB.
1 year ago