Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up Rack input stream handling #59

Merged
merged 4 commits into from
Jun 26, 2016
Merged

Clean up Rack input stream handling #59

merged 4 commits into from
Jun 26, 2016

Conversation

no-reply
Copy link
Member

@no-reply no-reply commented Jun 26, 2016

The parser methods used to try to handle Strings, as well as valid Rack
inputs. This led to some unnecessary complexity, giving rise to errors
like those seen in #56. This refactors to handle only IO-like Rack Input
streams.

Most of the work here is just to reorganize the tests.

There is an odd case where RDFSource#update feeds the IO stream before
trying to parse a graph. For now, we aggressively #rewind the stream
in #parse_graph to this problem. This might be unduely costly, and
there is probably a better fix in the long run.


The later commits introduce Rack::Lint and deal with a few issues found by running the existing tests and the W3C suite with those in place.

The parser methods used to try to handle Strings, as well as valid Rack
inputs. This led to some unnecessary complexity, giving rise to errors
like those seen in #56. This refactors to handle only IO-like Rack Input
streams.

Most of the work here is just to reorganize the tests.

There is an odd case where `RDFSource#update` feeds the IO stream before
trying to parse a graph. For now, we aggressively `#rewind` the stream
in `#parse_graph` to this problem. This might be unduely costly, and
there is probably a better fix in the long run.
@no-reply
Copy link
Member Author

Closes #56 and replaces #57.

Tom Johnson added 3 commits June 26, 2016 14:12
We called a couple of methods which were out of scope for Rack input
streams: `#eof?` and `#binmode`. This fixes things up so we can pass a
Rack::Lint.
We use status code 204 on HTTP DELETE responses. `Rack::Lint` correctly
objects to returning a `Content-Type` header for these responses. We
strip it and return an empty body (rather than an empty String) for
DELETE requests.
The base Lamprey server now includes Rack::Lint. This has some runtime
overhead, but users concerned about this should be able to spin up their
own servers without the lint layer pretty easily.

This has the benefit of forcing linting when running the W3C test
suite.

Closes #58.
@no-reply
Copy link
Member Author

Closes #58

@no-reply no-reply merged commit 99570c9 into develop Jun 26, 2016
@no-reply no-reply deleted the feature/io-stream branch June 26, 2016 21:43
@no-reply no-reply mentioned this pull request Jun 26, 2016
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.

1 participant