I'm uwap (they/them) and I do Nix, Haskell and TypeScript.
uwap / idris-http Goto Github PK
View Code? Open in Web Editor NEWAn HTTP library for idris
License: BSD 2-Clause "Simplified" License
An HTTP library for idris
License: BSD 2-Clause "Simplified" License
As of #6 we had a fix ensuring travis gets output all the time so it doesn't terminate after 20 Minutes. Though after merging the PR at seems that it still terminates after 20 Minutes making it really lucky if idris itself compiles. At least #6 does caching allowing us to use the same binary (for idris) as long as we have the latest version cached. Some ways we discussed to solve this was providing a PPA with idris nightly or idris releases. Another way would be to manually download a precompiled idris from one of our servers. There is still no way that seems to work completely without either having luck or pulling a binary version of idris in.
When it comes to transfer encodings idris-http lacks a lot of features. Chunked Encoding is a special case that needs special review. With chunked encoding we are bound to counting bytes. The String type doesn't have the ability to check a length in bytes. That is a huge problem.
Idea 1: ByteString
We could just start making a ByteString library to support it. We would have one large problem with it: We would need to get TCP libraries to use them. Then chunked encoding wouldn't be too much magic here.
Idea 2: Do awkward requests
We could start reqeusting single bytes over TCP and then finally when we get to chunked encoding we request the nujmber of bytes of the next chunk. This is an awful implementation that I wouldn't like to support.
Are there any other ways to go?
It seems absolute URLs in request lines should only be sent to proxy servers [0], but idris-http always sends them regardless.
This is a problem for me because the webserver I am talking to (https://github.com/mozilla/geckodriver) does not accept them.
Can URLs always be sent in relative form instead? I can send a pull-request if you agree.
[0] https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html (section 5.1.2)
Http.httpRequest
accepts Request a
, where a
is the type of the body of the request, but there is no way of passing a value for the body such that it gets sent in the request.
Do you have an idea for how this is supposed to work?
In my local hacked version I have just got rid of the type parameter from Request
, and changed the type of requestBody
into String
-- but this is possibly not what you want (and really a byte array would be better than String
)
This test:
simpleRequestTest : String -> IO ()
simpleRequestTest testName = do
Right response <- simpleHttp "www.google.com" 80 "/" | Left err => failed testName err
if Strings.isInfixOf "google" $ responseBody response then ok testName
else failed testName "`google` not found within response"
fails with:
At 16:11738:
crlf new-line
At 16:11738:
' character '
At 16:11738:
a different token
Hi,
I'm unable to build / install this library with Idris v0.12.3:
Can't find import Classes/Verified
Class.Verified
was renamed to Interfaces.Verified
in idris-lang/Idris-dev@c3f0755 but just renaming the import didn't do the job for me.
In idris-lang/Idris-dev@f754d9c, VerifiedMonad
changed from
monadRightIdentity : (mx : m a) -> mx >>= Monad.return = mx
to
monadRightIdentity : (mx : m a) -> mx >>= pure = mx
resulting in the following error:
./Http/RawResponse.idr:58:22:
When checking right hand side of Interfaces.Verified.Http.RawResponse.RawResponse implementation of Interfaces.Verified.VerifiedMonad, method monadRightIdentity with expected type
MkRawResponse _ >>= pure = MkRawResponse _
Type mismatch between
MkRawResponse _ = MkRawResponse _ (Type of Refl)
and
pure _ = MkRawResponse _ (Expected type)
Specifically:
Type mismatch between
MkRawResponse _
and
pure _
I would have loved to resolve this myself and open a PR, but unfortunately, I was not able to detect the error in question. (I'm still quite new to the language)
Thank you for looking into this.
Travis fails all the time because it is running in some timeouts. I assume there is a way to fix this.
We need to implement cookie support for the initial release.
Implementation Details
Since for now we see header fields as a SortedMap String String
(which I would like to change to some case-insensitive type in the future) a cookie header field that can appear multiple times wouldn't fit in that scheme so I suggest making a special case just for cookies and providing some cookie jar type that is a monoid so we can append new cookies on it. I would suggest implementing cookies after RFC6265.
Travis is broken. An alternative to installing idris via cabal would be using nix to install and build idris-http.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.