Comments (7)
well yes I think the problem is there.
specifically to parse cookies from the server, the server returns them on two lines according to curl:
Set-Cookie: _redmine_session=blabla; path=/; HttpOnly
Set-Cookie: autologin=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT
And the following code:
main = do
maybeCookie <- login username password
print $ fromJust maybeCookie
-- returns the cookie
login :: ByteString -> ByteString -> IO (Maybe ByteString)
login username password = do
postForm
(BS.concat [serverUrl, "login"])
[("username", username), ("password", password)]
getCookies
getCookies :: Response -> InputStream ByteString -> IO (Maybe ByteString)
getCookies r i = return $ getHeader r "Set-Cookie"
.. that programs prints only:
"autologin=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT"
I'll see if I can add a test showing the problem. First I'll try to run the existing tests.
from http-streams.
Thanks for demonstrating the problem, @emmanueltouzery Yes, a test case would be very helpful indeed.
AfC
from http-streams.
I submitted a pull request, #14
Running the updated tests now print for me:
Parsing responses multiline response headers are properly parsed FAILED
Invalid response headers
expected: Just "line1\nline2"
but got: Just "line2"
Note that however many tests still fail for me, even though "host localhost" now returns 127.0.0.1. But I can test by replacing "localhost" by 127.0.0.1 in the tests (that workaround is not in the pull request obviously).
from http-streams.
Thanks for your patch on #14. I'll merge it. However, we still need a test that shows (our failure to parse correctly) a single HTTP header that flows over multiple lines ("continuation line", per RFC 2616 ยง2.2)
AfC
from http-streams.
Meanwhile, from the last paragraph of RFC 2616 ยง4.2),
Multiple message-header fields with the same field-name MAY be
present in a message if and only if the entire field-value for that
header field is defined as a comma-separated list [i.e., #(values)].
It MUST be possible to combine the multiple header fields into one
"field-name: field-value" pair, without changing the semantics of the
message, by appending each subsequent field-value to the first, each
separated by a comma.
so I'll have to amend your test case...
AfC
from http-streams.
Which kind of multi-line header is this ticket about?
-
Is this about multiple header fields as in
Server: Apache/2.0.48 (Unix) DAV/2 SVN/1.0.0 Catacomb/0.9.0 PHP/5.0.0b4 mod_ssl/2.0.48 OpenSSL/0.9.6e DAV: 1,2 DAV: version-control,checkout, checkin, report DAV: uncheckout,version-controlled-collection DAV: <http://apache.org/dav/propset/fs/1> MS-Author-Via: DAV
-
..or rather about continuation lines such as in
Server: xy X-Foo: 1st line of x-foo 2nd line of x-foo 3rd and last line of x-foo Content-Type: plain/text
?
from http-streams.
Which kind of multi-line header is this ticket about?
It started out as (2) but @emmanueltouzery hijacked it and now it is about (1) :)
I've been meaning to open a new bug for (2) as continuation lines need to be supported properly.
AfC
from http-streams.
Related Issues (20)
- receiveResponse function does not work when response is empty (i.e a head request) HOT 4
- the body of patch request is empty
- baselineContextSSL not initializing SSL HOT 3
- Provide a version of openConnection that doesn't throw an exception HOT 1
- Removing the dependency on blaze-builder HOT 4
- Usage of parseURL without input escaping HOT 2
- Support getting the "final URL" after redirects for `get`
- How to not read the response body?
- HEAD request must not look for a body HOT 1
- Double-escapes URLs
- [32bit] http-streams-0.8.8.1: Failures: tests/TestSuite.hs:757:9: 1) Convenience API PUT with json data HOT 1
- CI for Linux, macOS, and Windows HOT 1
- CHANGELOG misses some releases
- Adapt http-streams to use Program monad
- HTTP/2 support HOT 8
- support request for dependency `aeson` 2.2.0.0 HOT 1
- `http-streams-0.8.9.6` build failure with `aeson-2.2` HOT 1
- POST body content prefixed by size. HOT 2
- GHC 8 Support HOT 16
- fails to build on GNU/kFreeBSD HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http-streams.