Commit graph

214 commits

Author SHA1 Message Date
Parnell Springmeyer
112777023f
Plumb the MaxMetadataSize parameter through to the server (#134)
* Plumb the `maxMetadataSize` parameter through to the server

* Update `proto3-suite` dependency

* Bump proto3-wire to 1.2.2

* Re-generate Echo.hs

* Regenerate `Arithmetic.hs`

* Derp

* Fix codegen

* Update the tests for new codegen

* Patch-bump to `0.2.1`

* Bump to `0.3.0` to indicate a breaking API change...

Suggested by @intractable.
2022-02-25 16:23:22 -06:00
intractable
e1091b9c0d
grpc-haskell{-core} -> 0.2.0: Fix MetadataMap duplicate-key ordering (#132)
* Put LD_LIBRARY_PATH set back into Linux `nix-shell`

...as we need it for `ghci` workflows inside the shell(s).

* Add (failing) test case to check MetadataMap ordering

* Remove SortedList value-component from MetadataMap

...which fixes the failing test case introduced by `85a2d13`.

This is a potentially breaking change that warrants a library rev bump.

I'm not sure what the original reason was for the sorted list component of
`MetadataMap` (i.e., header values), but that implementation choice makes it so
that determining the "last provided" header value associated with a duplicate
key cannot be recovered. That is, it is in violation of this requirement from
the [spec](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md):

```
Custom-Metadata header order is not guaranteed to be preserved except for values
with duplicate header names.
```

I'm guessing that the original motivation might have been to ensure that the Eq
instance was not sensitive to ordering of values for duplicate keys.

I think we can drop the existing `Eq` assumption about order-insensitive values
for duplicate keys (there is order sensitivity after all), and if we end up
discovering a common use case for an order-insensitive equality on values, we
should address that via a utility function (instead via the type's `Eq`
instance).

So, this commit changes the value component of the `MetadataMap` type to be a
list of `ByteString` values instead of `SortedList ByteString`, and removes the
`sorted-list` package as a dependency, as it has no other uses in the library.

Note that this commit is not claiming we are now spec-compliant w.r.t. header
treatment after this change. In particular (and at least),

1. We do not yet support base64-encoded binary data via the special `-bin` key
suffix.

2. As far as I am aware, we do not (yet) interpret comma-separated header values
the same as duplicate header keys for each of those values.

3. As far as I am aware, we do not (yet) do any validation of header names nor
whitespace handling as per the request grammar from the spec.

* Extend Arbitrary MetadataMap to explicitly encode key duplication

Duplicate keys were allowed by the previous implementation, but this commit
makes key duplication more explicit and more frequent.

* Add metadata map ordering QC prop

* Drop qualified use of @?= since it's so common in this module

* Extend checkMetadataOrdering to check instance Eq MetadataMap

...and use the appropriate bracketing wrapper.

* Relocate MetadataMap type to its own module

* Add some helper functions for MetadataMap lookup; documentation

* Extend testMetadataOrdering w/ use of lookup{All,Last}

* Bump grpc-haskell{,-core} -> 0.2.0
2021-06-30 20:32:33 -05:00
Evan Relf
0dd0e637ed
Minor Nix cleanup (#131) 2021-06-30 15:19:02 -07:00
intractable
b9ed537f64
Minor cleanup (#130)
* Remove unnecessary self-dependency

* Regenerate core/default.nix and build -core via callCabal2nix

* grpc-haskell-core: -Wall -Werror and fix warnings

* grpc-haskell: -Wall -Werror and fix warnings

* Update documentation

* Remove LD_LIBRARY_PATH sets from usesGRPC

...as they no longer seem to be needed.

* Remove dead code

* Remove core/default.nix

...as suggested by @evanrelf.
2021-06-30 12:31:45 -05:00
Matt Friede
28e9e68f3b
Add 1 to malloc'd buffer size for null terminator (#128) 2021-06-22 14:58:44 -07:00
Evan Relf
7cfe19fe14
Switch from Travis CI to GitHub Actions (#127) 2021-06-10 15:38:15 -07:00
Gabriel Gonzalez
8525994a4f
grpc-haskell-core: Version 0.0.0.0 → 0.1.0 (#126) 2021-05-14 14:34:57 -07:00
Gabriel Gonzalez
d821e58c2b
Fix lower bound on proto3-suite dependency (#124)
Fixes https://github.com/awakesecurity/gRPC-haskell/issues/122
2021-04-26 12:33:51 -07:00
Tristan de Cacqueray
0d1f54b6b8
Add the overlay to the release.nix with extend instruction (#123)
This change enables the integration of grpc-haskell within
foreign package set by exporting its overlay.
2021-04-26 10:24:33 -07:00
Gabriel Gonzalez
1bdc3662db
Version 0.1.0 (#119)
This is to prepare for an upcoming release to Hackage.  I increased the
version to 0.1.0 to reflect what I believe is a breaking change in #117
(since `grpc-haskell` will now require a newer version of the C `grpc`
dependency).
2021-03-23 10:40:51 -07:00
Tim McGilchrist
0c57ab0785
Upgrade gRPC C library (#117) 2021-03-08 13:44:36 -08:00
Gabriel Gonzalez
641f0bab04
Remove support for stack (#116)
Fixes #113
2021-01-13 15:56:23 -08:00
Gabriel Gonzalez
01e138e98d
Add Travis CI (#64) 2021-01-11 14:24:41 -08:00
Gabriel Gonzalez
2af32db3a9
Fix examples (#115)
Fixes https://github.com/awakesecurity/gRPC-haskell/issues/112
2021-01-11 09:24:25 -08:00
Nick
0cb7999e9e
Fixed typo. (#111) 2020-11-23 11:28:46 -06:00
intractable
6382857e2c
grpc-haskell-0.2.0.0: Upgrade to proto3-wire-1.2.0, proto3-suite-0.4.2.0 (#110)
* .gitignore

* release.nix: Minor cleanup

* Fix warning

* Expose max receive message length channel arg in `ServiceOptions`

* Fix warning

* Bump upstream dependencies and patch parameterized-0.5.0.0

* grpc-haskell 0.0.1.0 -> 0.0.2.0
2020-11-16 11:43:28 -06:00
Gabriel Gonzalez
d8f6e0b476
Fix Arithmetic example (#107)
The instructions for testing the `Arithmetic` example were
out of date
2020-09-04 12:04:30 -07:00
Gabriel Gonzalez
d7c3c3847a
Add new test-derivation target to release.nix (#108)
This comes in handy for `nix-shell` when you want to test
against an already built `grpc-haskell`
2020-09-04 11:02:41 -07:00
Gabriel Gonzalez
d532cec4d1
Make server process killable (#105)
35163c3 introduced a new use of `mask` which makes the server
process uninterruptible while waiting for a new incoming request.
This change fixes that by surrounding the logic that waits for a
new request with `unmask`.  This new `unmask` should still
respect the finalization guarantees of the surrounding masked
code.
2020-05-28 13:56:03 -04:00
Gabriel Gonzalez
595cb6a3bf
Update Arithmetic example to use newer proto3-suite (#102)
Related to https://github.com/awakesecurity/proto3-suite/issues/119
2020-02-10 10:19:29 -08:00
Fabian Schneider
bc155c1a52 format correction (#99)
changed , to . to correct the ordering
2019-12-20 08:13:53 -08:00
Moritz Kiefer
4164623844 Don’t free op array values in op_array_destroy (#98)
These values are all already freed in freeOpContext and doing it twice
is an error, see #91
2019-11-21 15:47:55 -08:00
Cj-bc
3defd1dcc5 Fix stack.yaml format to support stack 2.0 configuration (#93)
Information is here:
http://docs.haskellstack.org/en/stable/yaml_configuration/#packages
2019-09-18 08:25:00 -05:00
Moritz Kiefer
be70fc49b0 Mask body of runOps to avoid a heap corruption (#89) 2019-08-29 11:15:48 -05:00
Moritz Kiefer
01b17286b6 Free slice in OpSendStatusFromServerContext (#90)
We allocate the slice in createOpContext via byteStringToSlice but we
never freed it.
2019-08-28 09:46:14 -05:00
Moritz Kiefer
11681ec6b9
Fix sdist tarballs (#88)
A bunch of files have been missing from the tarballs created by `cabal
sdist`. I’ve changed the nix config to check for this and also found
some examples that I forgot to update in a previous PR (sorry about
that).
2019-08-28 09:28:26 +02:00
Moritz Kiefer
5ceeae74cc Upgrade to gRPC 1.22 (#85) 2019-08-22 11:12:21 -05:00
Moritz Kiefer
35163c3c18 Fix async exception handling (#86)
Previously, grpc-haskell used a lot of code in the form of

```
do x <- acquireResource
   f x `finally` releaseResource x
```

This is not safe since you can get killed after acquiring the resource
but before installing the exception handler via `finally`. We have
seen various gRPC assertion errors and crashes on shutdown when this
got triggered.
2019-08-22 10:55:33 -05:00
Moritz Kiefer
a26497c82c Expose ClientCall in ClientReaderHandler and ClientRWHandler (#87)
This allows you to cancel the call from within the callback using
`clientCallCancel`.
2019-08-22 10:53:41 -05:00
Moritz Kiefer
6e09678dc7 Upgrade nixpkgs to the latest nixpkgs-unstable (#84)
* Upgrade nixpkgs to the latest nixpkgs-unstable

* Bump proto3-suite
2019-08-20 10:47:32 -05:00
intractable
a818985323
Provide Network.GRPC.HighLevel.Client.simplifyServerStreaming (#82) 2019-08-12 13:03:25 -05:00
j6carey
c83eacd1f3
Move to newer proto3-suite. (#81) 2019-06-18 12:51:25 -07:00
j6carey
75cf21839b
Port grpc-haskell[-core] to ghc-8.6 and modern tasty. (#77)
Note that even though we can now build grpc-haskell and grpc-haskell-core
with modern tasty, the environment in which we built those test programs
did not support actually running all them successfully, due to the need to test
generated code in the context of the appropriate libraries.  We do not yet
know whether test programs built with new versions of tasty would succeed
in the appropriate environment.  In principle this could be discovered, but
the work involved is far from trivial, and therefore we defer it to another
time.  Tests built with the old tasty still succeed.
2019-03-25 16:52:04 -07:00
j6carey
c2a3aa6496
Allow dependency upon async-2.2.* (#75) 2019-02-11 10:44:16 -08:00
Manoj P R
e17f2cee46 Fix broken links to proto3-wire and proto3-suite (#72) 2019-01-22 08:40:55 -06:00
j6carey
bc457cc4e3
Shut down server when serverLoop thread is killed. (#71)
Previously, killing the thread running serverLoop
would not actually shut down the server, leading
to file descriptor leaks and perhaps worse effects.
2019-01-07 15:53:10 -08:00
intractable
28288a17b7
Client helpers, re-exports, and fixups (#70)
* Derive `Show` instance for `ClientSSLKeyCertPair`

* Add a couple client helper functions & add additional exports

* Add `grpc-haskell-core` target; add `c2hs` dep

* Fix examples broken by #68

* rm `build-tools` and `include-dirs` directives from toplevel `.cabal`

* More `ClientConfig` fixes

* Ensure examples are built
2018-10-14 17:52:59 -05:00
ryan4729
c80269089c fix tests broken by previous commit (#69) 2018-10-09 19:29:29 -05:00
ryan4729
24bdacca3a allow clients to set authority header (#68) 2018-09-24 08:37:05 -07:00
Travis Athougies
991b389a16 Add max metadata size option (#67) 2018-07-27 10:41:18 -05:00
Ewout
9c6b3f63b6 Fix build on GHC 8.4 (#63)
* Fix haddock: postfix comments on GADT constructors don't work.

See https://github.com/haskell/haddock/issues/43 .

* Remove unused dependencies from cabal file..

* Semigroup instances for compatibility with GHC 8.4.
2018-06-18 12:24:19 -07:00
Gabriel Gonzalez
55f51eaa24
Build against latest proto3-suite (#56)
This reflects the latest changes in generating `ToSchema` instances
2018-04-20 13:37:12 -07:00
j6carey
3ee4dabc2d
Add a comment to ClientReaderRequest. (#55)
It was not obvious from the type how many times the
final field of ClientReaderRequest would be invoked.
(Assuming it is invoked once per stream increment
results in a hang, which can be confusing.)
2018-04-02 09:34:35 -07:00
Parnell Springmeyer
2cfca15c31
Fix the output of the nixpkgs derivation and make the pin forwards compatible with Nix 2.0 (#52)
* Fix the output of the nixpkgs derivation

* Use the fixed-output sha256 hash for builtins.fetchTarball

This change makes the nixpkgs pin forwards compatible with Nix 1.12.x
and Nix 2.0.

* Correct the phrasing of the code comment
2018-03-12 11:06:21 -05:00
Christian Lavoie
5fd44880da Remove proto3-wire dependency from core package. (#47) 2018-01-30 09:20:05 -08:00
Christian Lavoie
9cfb3da770 Extract lowlevel bits into a core package (#42) 2018-01-29 08:59:34 -08:00
Gabriel Gonzalez
1959939f50
Update to Nixpkgs 17.09 (#45)
This is a "shallow" update, meaning that there are still several dependencies
(such as `grpc` or Haskell packages) that are still pinned and those pins might
not be necessary any longer after this change.
2018-01-26 12:14:53 -08:00
gbaz
f0925d5b5f
Merge pull request #43 from awakesecurity/gb/use-latest-proto3-suite
update to latest proto3-suite
2018-01-17 12:17:51 -05:00
Gershom
351e8a8f75 update to latest proto3-suite 2018-01-17 12:16:38 -05:00
intractable
3fb4d88526
Tweak shebangs to run tests from nix-shell under NixOS (#41) 2017-12-28 10:04:44 -06:00