Ticket #4: preservable-browser-state.dpatch

File preservable-browser-state.dpatch, 14.3 kB (added by bringert, 6 years ago)

Will Thompson's preservable state patch

Line 
1Wed May 21 13:06:28 BST 2008  Will Thompson <will@willthompson.co.uk>
2  * Make default bsAuthorityGen return Nothing rather than calling 'error'.
3  Previously, comments claimed that by default the user was asked for a
4  username/password combination, but this was not the case.
5
6Thu May 22 18:49:29 BST 2008  Will Thompson <will@willthompson.co.uk>
7  * Split defaultBrowserState definition out of browse
8
9Thu May 22 18:49:46 BST 2008  Will Thompson <will@willthompson.co.uk>
10  * Add and export browseS, which lets the library user supply an initial state and save the resulting state.
11
12New patches:
13
14[Make default bsAuthorityGen return Nothing rather than calling 'error'.
15Will Thompson <will@willthompson.co.uk>**20080521120628
16 Previously, comments claimed that by default the user was asked for a
17 username/password combination, but this was not the case.
18] {
19hunk ./Network/Browser.hs 50
20+    defaultAuthorityGen,
21hunk ./Network/Browser.hs 315
22-  4) generate a username/password combination using the browsers
23-     "bsAuthorityGen" function (the default behaviour is to ask
24-     the user)
25+  4) generate a username/password combination using the browser's
26+     "bsAuthorityGen" function.  (The default behaviour is not to
27+     generate a combination.)
28hunk ./Network/Browser.hs 496
29+-- | Returns 'Nothing' for any uri and realm.
30+defaultAuthorityGen :: URI -> String -> IO (Maybe (String,String))
31+defaultAuthorityGen uri realm = return Nothing
32+
33hunk ./Network/Browser.hs 670
34-               , bsAuthorityGen     = (error "bsAuthGen wanted")
35+               , bsAuthorityGen     = defaultAuthorityGen
36}
37
38[Split defaultBrowserState definition out of browse
39Will Thompson <will@willthompson.co.uk>**20080522174929] {
40hunk ./Network/Browser.hs 658
41+defaultBrowserState :: BrowserState
42+defaultBrowserState =
43+    BS { bsErr              = putStrLn
44+       , bsOut              = putStrLn
45+       , bsCookies          = []
46+       , bsCookieFilter     = defaultCookieFilter
47+       , bsAuthorityGen     = defaultAuthorityGen
48+       , bsAuthorities      = []
49+       , bsAllowRedirects   = True
50+       , bsAllowBasicAuth   = False
51+       , bsConnectionPool   = []
52+       , bsProxy            = NoProxy
53+       , bsDebug            = Nothing
54+       }
55hunk ./Network/Browser.hs 677
56-    where
57-        defaultBrowserState :: BrowserState
58-        defaultBrowserState =
59-            BS { bsErr              = putStrLn
60-               , bsOut              = putStrLn
61-               , bsCookies          = []
62-               , bsCookieFilter     = defaultCookieFilter
63-               , bsAuthorityGen     = defaultAuthorityGen
64-               , bsAuthorities      = []
65-               , bsAllowRedirects   = True
66-               , bsAllowBasicAuth   = False
67-               , bsConnectionPool   = []
68-               , bsProxy            = NoProxy
69-               , bsDebug            = Nothing
70-               }
71}
72
73[Add and export browseS, which lets the library user supply an initial state and save the resulting state.
74Will Thompson <will@willthompson.co.uk>**20080522174946] {
75hunk ./Network/Browser.hs 39
76+    browseS,
77hunk ./Network/Browser.hs 679
78+-- | Run a browser action, optionally starting from a supplied state, yielding
79+--   the result of the action and the new state of the browser.
80+--
81+--   This might be useful if you need to periodically make requests in a given
82+--   browser "session" (with cookies, authentication tokens, etc. intact)
83+--   within a larger application.
84+browseS :: Maybe BrowserState -> BrowserAction a -> IO (BrowserState, a)
85+browseS st act = lift act $ fromMaybe defaultBrowserState st
86+
87}
88
89Context:
90
91[Fix for socket close code.
92prb@mult.ifario.us**20080502192705]
93[Accept the empty string as a cookie value.
94Will Thompson <will@willthompson.co.uk>**20080426132046
95 http://wp.netscape.com/newsref/std/cookie_spec.html does not specify whether
96 a cookie's value can be the empty string, but there is no obvious reason not
97 to accept it.
98]
99[Bump version number to 3001.1.0. Incremented minor number since the patch from Eric Mertens extends the API.
100bjorn@bringert.net**20080305202825]
101[Export getRequestHead and processRequest, add support for custom RequestMethods
102Eric Mertens <emertens@galois.com>**20080305190759]
103[Include uriQuery in request line.
104bjorn@bringert.net**20080128094645]
105[Send abs_path as Request-URI to comply with HTTP 1.1 spec.
106'Daniel McAllansmith <dm.maillists@gmail.com>'**20080128053024
107 RFC2616 Section 5.1.2 specifies that abs_path MUST be used to identify a resource on a origin server or gateway, not absoluteURI which is for use with proxies.
108 
109 Change Request's Show instance to use /path/to/resource rather than
110 http://server/path/to/resource.
111]
112[Bump version to 3001.0.4
113bjorn@bringert.net**20071213122237]
114[Expose Network.HTTP.Headers in cabal file
115Eric Mertens <emertens@galois.com>**20071212220235
116 
117 Failure to do this breaks :browse functionality in GHCi
118 as well as makes these useful functions unavailable
119]
120[Resolved conflicts in Network.Stream.
121robin@shorestreet.com**20071203042948]
122[Resolve conflict in HTTP.cabal.
123robin@shorestreet.com**20071029195007]
124[Split Header functionality into Network.HTTP.Headers module.
125robin@shorestreet.com**20070725192851]
126[Added files to .cabal file, made deps explicit in Network.TCP module.
127robin@shorestreet.com**20070725184005]
128[Refactored Network.Stream.
129robin@shorestreet.com**20070725061114]
130[Made more deps explicit.
131robin@shorestreet.com**20070724054038]
132[Made dependencies explicit in import statements.
133robin@shorestreet.com**20070724043419]
134[Bumped version number to 3001.0.3.
135bjorn@bringert.net**20071130225017]
136[Change myrecv to allow a 0 length. Suggested by Eric Mertens.
137bjorn@bringert.net**20071130224542
138 On Wed, 2007-08-15 at 23:25 +0200, Bjorn Bringert wrote:
139 Why doesn't the existing code work? Does recv fail when given 0?
140 
141 On Nov 30, 2007, at 23:36 , Eric Mertens wrote:
142 Yes, recv can not cope with an argument of 0
143 
144 http://darcs.haskell.org/packages/network/Network/Socket.hsc
145 
146 recv :: Socket -> Int -> IO String
147 recv sock l = recvLen sock l >>= \ (s,_) -> return s
148 
149 recvLen :: Socket -> Int -> IO (String, Int)
150 recvLen sock@(MkSocket s _family _stype _protocol status) nbytes
151  | nbytes <= 0 = ioError (mkInvalidRecvArgError "Network.Socket.recv")
152 
153]
154[Set version number to 3001.0.2.
155bjorn@bringert.net**20071118211601]
156[Change version to 3001.0.1.
157bjorn@bringert.net**20071117212431]
158[Don't treat any chunk size starting with '0' as a 0 chunk size.
159bjorn@bringert.net**20071117212214
160 Radosław Grzanka reported that Network.HTTP can't get http://www.podshow.com/feeds/gbtv.xml, see http://article.gmane.org/gmane.comp.lang.haskell.cafe/31783
161 
162 This turned out to be a bug in how Network.HTTP handled Chunked Transfer Encoding. The web server sent the chunk size as "00004000" (according to RFC 2616 this can be non-empty sequence of hex digits). However, Network.HTTP treated any chunk size starting with '0' as a chunk size of 0, which indicates the end of the chunked encoding.
163]
164[TAG 3001.0.0
165Duncan Coutts <duncan@haskell.org>**20071021133823]
166[Fix building with ghc-6.4 and base-1.0
167Duncan Coutts <duncan@haskell.org>**20071017225318
168 Also drop -O since Cabal does that automatically now.
169]
170[Added DELETE method.
171Greg Heartsfield <scsibug@imap.cc>**20070919075758]
172[Use Cabal configurations.
173bjorn@bringert.net**20071008204007]
174[Exporting ResponseCode from Network.HTTP
175ricky@dtek.chalmers.se**20070423155719]
176[WWW-Authenticate parsing bug.
177bjorn@bringert.net**20070625204602
178 RFC1945 says a challenge matches:
179 
180 challenge      = auth-scheme 1*SP realm *( "," auth-param )
181 
182 but, as I understand it, the "1*SP" term is not permitted. The fix is of
183 course simple:
184 
185 With this I can successfully perform Basic authentication against my cheap
186 ADSL router.
187 
188 Patch by cb224@cs.york.ac.uk
189]
190[Updated authentication scheme names
191jgbailey@gmail.com**20070613233759
192 
193 
194 When authenticating, the HTTP library
195 responded with "basic" or "digest". Web
196 servers expect "Basic" or "Digest", and some
197 are case-sensitive. THerefore, this update is necessary.
198 
199]
200[Added support for proxies with ports
201jgbailey@gmail.com**20070612212844
202 
203 A proxy can be both a host name with a port. This patch adds support for proxies that use a port other than 80.
204 
205 
206]
207[get rid of annoying cpp include kludge
208alex@happs.org**20070216191216]
209[Changed version number to 3000.0.0 to avoid ordering problems with old date-based version numbers.
210bjorn@bringert.net**20070211094535]
211[Changed version number scheme. Set version number to 1.0.
212bjorn@bringert.net**20070206143514]
213[Renamed http.cabal to HTTP.cabal.
214bjorn@bringert.net**20070206111455]
215[Bumped version number.
216bjorn@bringert.net**20070206111242]
217[Export authority stuff from Network.Browser.
218bjorn@bringert.net**20070206110917]
219[Use the non-deprecated Network.URI API
220trebla@vex.net**20070201210541]
221[Added -fwarn-missing-signatures. Added type signatures for defaultCookieFilter, userCookieFilter, setCookies, getCookies and defaultGETRequest.
222bjorn@bringert.net**20070129202633]
223[Added type signature for Network.Browser.request.
224bjorn@bringert.net**20070129201740]
225[Allowing - and : in cookie names/values, plus allowing a trailing semicolon in cookie value.
226bakert@gmail.com**20070111105703]
227[Fixed README typo.
228bjorn@bringert.net**20061226230117]
229[Set content-type: application/x-www-form-urlencoded in formToRequest. Patch by Artem Gr.
230bringert@cs.chalmers.se**20061114125602
231 Artem Gr wrote:
232 > The "Haskell HTTP package", present in http://haskell.org/http/,
233 > contains the formToRequest, which does not work, because it lacks the
234 > proper Content-Type header definition. Adding /Header HdrContentType
235 > "application/x-www-form-urlencoded"/ to the /rqHeaders/ of the /Request/
236 > solves the problem. Attached is the patch.
237]
238[Removed debian directory, as requested by haskell-http Debian maintainer Arjan Oosting.
239bjorn@bringert.net**20060811203429]
240[s/BSD4/BSD3/. Dunno where that came from.
241bjorn@bringert.net**20060707085613]
242[Added other-modules and -O according to patch by dcoutts. Couldn't apply his patch because of a darcs bug (!). Bumped version number.
243bjorn@bringert.net**20060707085029]
244[Removed obsolote references to the browser package from the README.
245bjorn@bringert.net**20060707083845]
246[Copied the Base64, MD5 and MD5Aux modules from the Crypto package to Network.HTTP and merged the http and browser packages back together.
247bjorn@bringert.net**20060705194820]
248[Moved the browser module to a separate package, as suggested by shapr.
249bjorn@bringert.net**20060423132859]
250[Cleaned up some haddock comments.
251bringert@cs.chalmers.se**20060327133857]
252[Added basic server-side functions and modularised
253Simon Foster <S.Foster@dcs.shef.ac.uk>**20060324201059
254  - Split module up into to sepearate Network.[Stream,TCP,HTTP] modules
255  - Created functions receiveHTTP and responseHTTP to allow server side interactions
256    (although 100-continue is unsupported and I haven't checked for standard compliancy).
257  - Pulled the transfer functions from sendHTTP to global scope to allow access by
258    above functions.
259]
260[Make Network.Browser support servers in different ports
261Einar Karttunen <ekarttun@cs.helsinki.fi>**20060302150224]
262[Make BrowserAction a Functor
263Einar Karttunen <ekarttun@cs.helsinki.fi>**20060302150203]
264[Handle GET requests with query string
265Einar Karttunen <ekarttun@cs.helsinki.fi>**20060221235500]
266[Don't leave socket half-open on failed connect. Patch by Samuel Bronson.
267bjorn@bringert.net**20060115203624]
268[Post requests should not add the query parameters to the URI
269Einar Karttunen <ekarttun@cs.helsinki.fi>**20051216193432]
270[Update version number.
271bjorn@bringert.net**20051122232535]
272[Added simpleHTTP_, which takes a Stream argument.
273bjorn@bringert.net**20050830084009]
274[ Added dependency on the base package. Patch by Henning GÃŒnther.
275bjorn@bringert.net**20050818225020]
276[Fixed bugs in writeBlock implementations that would resend the same data over and over. Changes by Lemmih.
277bjorn@bringert.net**20050614180545]
278[Fixed typo in dist name.
279bjorn@bringert.net**20050505192119]
280[Fixed haddock comments so that they parse.
281bjorn@bringert.net**20050505191121]
282[Updated build system and cabal-description.
283bjorn@bringert.net**20050505191006]
284[Use Base64 and MD5 from the Crypto package.
285bjorn@bringert.net**20050505190723]
286[Export Proxy type from Browser, as suggested by Uwe Schmidt.
287bjorn@bringert.net**20050413104916]
288[Fixed homepage url in cabal file
289bjorn@bringert.net**20050328212813]
290[Updated to support GHC 6.4: more cabal fields, Setup.lhs uses runghc, use new Network.URI, changed moulde for importing som IO error functions.
291bjorn@bringert.net**20050328212438]
292[Moved to http.cabal and changed contents to be compatible with current Cabal.
293bjorn@bringert.net**20050218223528]
294[Catch EOF exceptions thrown by recv when 0 bytes are read. Patch by John Goerzen.
295bjorn@bringert.net**20050218220503
296 
297 Description from John Goerzen:
298 
299 > First, even though I am sending an accurate Content-Length header with
300 > my POST message, the server is timing out and returning a 500 Internal
301 > Server Error document.
302 
303 Looks like that was a server bug.
304 
305 > Second, after reading that error document, Network.HTTP is generating an
306 > error of its own.  Here's an strace illustrating it:
307 
308 This one was a bug in HTTP.  Actually, I am stunned that nobody found it
309 before, because it looks to me that it would cause an exception to be
310 raised on every single HTTP hit.
311 
312 It turns out that Network.Socket.recv raises an EOF error when it gets
313 back 0 bytes of data.  HTTP is expecting it to return an empty list for
314 some reason.
315 
316]
317[minor debian packaging fixes
318ganesh@earth.li**20041213235450]
319[add debian/copyright file
320ganesh@earth.li**20041213235441]
321[LICENSE now covers entire package, added all contributors to LICENSE.
322bjorn@bringert.net**20041213230231]
323[Support '.' characters in cookie names
324ganesh@earth.li**20041213010128]
325[Initial debianisation
326ganesh@earth.li**20041213002245]
327[dependencies fixes
328ganesh@earth.li**20041213001849]
329[Added -package posix to work around missing posix package dependency in current version of Cabal.
330bjorn@bringert.net**20041113133508]
331[distclean now removes Setup.o and Setup.hi
332bjorn@bringert.net**20041113132459]
333[Added patch from Andre Furtado which removes the trailing ampersand in urlEncodeVars
334bjorn@bringert.net**20041015151040]
335[Imported current HTTP and Browser module versions.
336bjorn@bringert.net**20041015145806]
337Patch bundle hash:
3389874f8e5f0c0446d9909e606ff014c9e3934f857