A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
11
Task/HTTP/Haskell/http-1.hs
Normal file
11
Task/HTTP/Haskell/http-1.hs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import Network.Browser
|
||||
import Network.HTTP
|
||||
import Network.URI
|
||||
|
||||
httpreq = do
|
||||
rsp <- Network.Browser.browse $ do
|
||||
setAllowRedirects True
|
||||
setOutHandler $ const (return ())
|
||||
request $ getRequest "http://www.rosettacode.org/"
|
||||
|
||||
putStrLn $ rspBody $ snd rsp
|
||||
19
Task/HTTP/Haskell/http-2.hs
Normal file
19
Task/HTTP/Haskell/http-2.hs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
link cfunc
|
||||
procedure main(arglist)
|
||||
get(arglist[1])
|
||||
end
|
||||
|
||||
procedure get(url)
|
||||
local f, host, port, path
|
||||
url ? {
|
||||
="http://" | ="HTTP://"
|
||||
host := tab(upto(':/') | 0)
|
||||
if not (=":" & (port := integer(tab(upto('/'))))) then port := 80
|
||||
if pos(0) then path := "/" else path := tab(0)
|
||||
}
|
||||
write(host)
|
||||
write(path)
|
||||
f := tconnect(host, port) | stop("Unable to connect")
|
||||
writes(f, "GET ", path | "/" ," HTTP/1.0\r\n\r\n")
|
||||
while write(read(f))
|
||||
end
|
||||
1
Task/HTTP/Haskell/http-3.hs
Normal file
1
Task/HTTP/Haskell/http-3.hs
Normal file
|
|
@ -0,0 +1 @@
|
|||
|icon req.icn http://www.rosettacode.org
|
||||
4
Task/HTTP/Haskell/http-4.hs
Normal file
4
Task/HTTP/Haskell/http-4.hs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
procedure main(arglist)
|
||||
m := open(arglist[1],"m")
|
||||
while write(read(m))
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue