summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Cochrane <alcinnz@lavabit.com>2022-07-23 20:40:24 +1200
committerAdrian Cochrane <alcinnz@lavabit.com>2022-07-23 20:40:24 +1200
commit4906052864a06bd1fb104d65e2c494fdba5c165e (patch)
treeb5ff13e0d5d3b54123d4e92b092a114d917fe24e
parent12c81bf0660acab500c2c9c234803e0fd1a47a0d (diff)
downloadhurl-4906052864a06bd1fb104d65e2c494fdba5c165e.tar.gz
hurl-4906052864a06bd1fb104d65e2c494fdba5c165e.tar.bz2
hurl-4906052864a06bd1fb104d65e2c494fdba5c165e.zip
Treat GET form submissions as normal fetch requests.
-rw-r--r--src/Network/URI/Fetch.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Network/URI/Fetch.hs b/src/Network/URI/Fetch.hs
index a243ab9..ca4f941 100644
--- a/src/Network/URI/Fetch.hs
+++ b/src/Network/URI/Fetch.hs
@@ -264,6 +264,8 @@ packQuery q "multipart/form-data" = HTTP.formDataBody $ Prelude.map encodePart q
body <- B.readFile value
return $ HTTP.RequestBodyBuilder size $ Builder.lazyByteString body
packQuery _ _ = return -- Do not upload data if requested to do so in an invalid format.
+submitURL' session mimes uri method "GET" query = fetchURL' session mimes uri {
+ uriQuery = '?': encodeQuery query } -- Specialcase GET!
submitURL' session accept uri method encoding query | uriScheme uri `elem` ["http:", "https:"] = do
-- HURL is very strict on when it allows cookies to be set: Only POST HTTP requests are considered consent.
-- For the sake of most webframeworks' CSRF protection, cookies from retrieving the form are retroactively set.
@@ -276,7 +278,7 @@ submitURL' session accept uri method encoding query | uriScheme uri `elem` ["htt
return ret {
HTTP.cookieJar = firstJust csrfCookies $ HTTP.cookieJar req,
HTTP.method = method
- }) $ \resp -> if method /= "POST" then return () else do
+ }) $ \resp -> do
let cookies = HTTP.responseCookieJar resp
swapMVar (globalCookieJar session) cookies
writeCookies (cookiesPath session) cookies False