Commit Graph

6 Commits

Author SHA1 Message Date
Basti Ortiz
1d895b8dfc refactor(capi): make early returns consistent in C examples (#2812)
- Since the `if` condition already causes the loop to `break`,
  the `else` is not necessary. We wouldn't have reached the `else`
  block, anyway, if the prior `if` condition passed.
- We are more likely to poll a successful chunk than finish
  the request or throw an error. Thus, it is best if we go
  for the optimistic route and check for the successful
  case first.
2022-04-11 17:20:14 -07:00
Sean McArthur
39b6d01aa0 fix(ffi): on_informational callback had no headers 2021-08-19 12:21:17 -07:00
Sean McArthur
3b26572876 refactor(ffi): check pointer arguments for NULL (#2624)
This changes all the extern C functions in `hyper::ffi` to check passed
pointer arguments for being `NULL` before trying to use them. Before, we
would just assume the programmer had passed a good pointer, which could
result in segmentation faults. Now:

- In debug builds, it will assert they aren't null, and so if they are,
  a message identifying the argument name will be printed and then the
  process will crash.
- In release builds, it will still check for null, but if found, it will
  return early, with a return value indicating failure if the return type
  allows (such as returning NULL, or `HYPERE_INVALID_ARG`).

Closes #2620
2021-08-18 14:15:14 -07:00
Sean McArthur
c35153998e docs(capi): output the hyper_version in the capi examples (#2623) 2021-08-18 10:29:20 -07:00
Sean McArthur
25d18c0b74 feat(ffi): add hyper_request_on_informational
This defines an extension type used in requests for the client that is
used to setup a callback for receipt of informational (1xx) responses.
The type isn't currently public, and is only usable in the C API.
2021-07-12 15:43:58 -07:00
Sean McArthur
3ae1581a53 feat(ffi): Initial C API for hyper 2021-01-08 10:25:53 -08:00