Commit Graph

15 Commits

Author SHA1 Message Date
Daniel Stenberg
a1995ee1cb docs(capi): build 'upload' example too by default (#2625) 2021-08-18 14:16:07 -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
91bbce4ed3 chore(ffi): update gen_header script to use unpretty option 2021-08-04 11:45:03 -07:00
David Cook
6393a0cc03 docs(ffi): fix copy-paste error on hyper_waker_wake (#2604) 2021-07-26 11:18:50 -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
8c89a8c166 feat(ffi): add option to get raw headers from response 2021-06-15 08:43:50 -07:00
Sean McArthur
117cc492a6 chore(ci): quiet the warnings when verifying the generated header file (#2507) 2021-04-20 17:23:10 -07:00
Kevin Burke
ed2fdb7b6a chore(ffi): fix compile errors and warnings (#2492)
As I understand it, "cargo rustc" in gen_header.sh generates a ton of
errors, but still manages to generate an object that can be used by
cbindgen to generate hyper.h.

However, I tried to make a separate change to add more fields to
hyper.h, and learned that "cargo rustc" stops if it reaches 50 errors,
which I reached. I was able to buy some headroom and fix a number of
the compilation errors by adding imports to the fake Cargo.toml we
generate in gen_header.sh.

I wasn't sure how to resolve imports like "crate::Result" which appear
to reference the top-level src/error.rs, and print an error when they
are compiled in gen_header.sh. But I only need to buy headroom under
the 50 error count for now, which I was able to do by adding the
imports.

It is possible that someone more familiar with Rust than me could look
at this and know what to change to get the total number of errors to
zero.
2021-04-07 16:12:02 -07:00
Kevin Burke
a5464f761a chore(ffi): run gen_header.sh in CI environment (#2488)
Clean up the script so that any unexpected error terminates the
script, and stop suppressing errors that may contain useful
information (for example, that you are using the stable version but
need to use the nightly).

This is useful because if hyper.h is not up to date going forward the
CI should flag it. As is, there are a bunch of changes to hyper.h that
have not been checked in (or were generated by a newer version of the
cbindgen script.)

Fixes #2483.
2021-04-06 14:46:14 -07:00
CfirTsabari
a60280873b refactor(ffi): Removed need for cbindgen type renames (#2442)
Fixes hyperium/hyper#2428
2021-02-22 16:12:06 -08:00
Sean McArthur
1928682b33 feat(ffi): add HYPERE_INVALID_PEER_MESSAGE error code for parse errors 2021-01-20 15:10:19 -08:00
Sean McArthur
c9c46ed60b refactor(ffi): Add Reason-Phrase API
This adds an internal ability to copy the HTTP/1 reason-phrase and place
it in the `http::Extensions` of a response, if it doesn't match the
canonical reason. This could be exposed in the Rust API later, but for
now it is only used by the C API.
2021-01-08 10:25:53 -08:00
Sean McArthur
4c32daeea0 refactor(ffi): Add HeaderCaseMap preserving http1 header casing 2021-01-08 10:25:53 -08:00
Sean McArthur
3ae1581a53 feat(ffi): Initial C API for hyper 2021-01-08 10:25:53 -08:00