guile-user
[
Top
][
All Lists
]
Advanced
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
]
Re: A question about http-get of (web client)
From
:
Sunjoong Lee
Subject
:
Re: A question about http-get of (web client)
Date
:
Thu, 26 Apr 2012 21:50:48 +0900
I suspect "ISO-8859-1" make a problem. open-socket-for-uri of (web client) sets encoding of port to "ISO-8859-1". read-response of (web response) also sets encoding of port to "ISO-8859-1".
(use-modules ((srfi srfi-11) #:select (let-values))
((web uri) #:select (string->uri))
((web client) #:select (http-get)))
(let-values (((res-headers res-body)
(http-get (string->uri "
http://www.gnu.org/home.html
")
#:extra-headers
(acons 'Accept "text/html"
(acons 'Accept-Charset "ISO-8859-1"
(acons 'Accept-Language "en-US"
'()))))))
(display res-body)
(newline))
Above code makes an error:
...
In web/response.scm:
187: 2 [read-response #<input-output: socket 5>]
In web/http.scm:
218: 1 [lp ((server . "Apache/2.2.14") (date . #))]
184: 0 [read-header #<input-output: socket 5>]
Same error after changing above "ISO-8859-1" to "utf-8" of course; It's meaningless.
(let-values (((res-headers res-body)
(http-get (string->uri "
http://www.gnu.org/home.html
")
#:extra-headers
(acons 'Accept "text/plain" '()))))
(display res-body)
(newline))
Above code display this:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>406 Not Acceptable</title>
</head><body>
<h1>Not Acceptable</h1>
<p>An appropriate representation of the requested resource /home.html could not be found on this server.</p>
Available variants:
<ul>
<li><a href="" , type text/html, language ar</li>
...
406 Not Acceptable? I think 'Accept "text/html" and 'Accept-Language "en-US" will be need. But, "text/html" makes a above error!!
After changing (display res-body) to (display res-headers):
#<<response> version: (1 . 1) code: 406 reason-phrase: "Not Acceptable" headers: ((date . #<date nanosecond: 0 second: 52 minute: 34 hour: 12 day: 26 month: 4 year: 2012 zone-offset: 0>) (server . "Apache/2.2.14") (alternates . "{\"home.ar.html\" 1 {type text/html} {language ar}}, {\"home.bg.html\" 1 {type text/html} {language bg}}, {\"home.ca.html\" 1 {type text/html} {language ca}}, {\"home.cs.html\" 1 {type text/html} {language cs}}, {\"home.de.html\" 1 {type text/html} {language de}}, {\"home.el.html\" 1 {type text/html} {language el}}, {\"home.es.html\" 1 {type text/html} {language es}}, {\"home.fa.html\" 1 {type text/html} {language fa}}, {\"home.fr.html\" 1 {type text/html} {language fr}}, {\"home.html\" 1 {type text/html} {language en}}, {\"home.id.html\" 1 {type text/html} {language id}}, {\"home.it.html\" 1 {type text/html} {language it}}, {\"home.ja.html\" 1 {type text/html} {language ja}}, {\"home.kn.html\" 1 {type text/html} {language kn}}, {\"home.ko.html\" 1 {type text/html} {language ko}}, {\"home.nb.html\" 1 {type text/html} {language nb}}, {\"home.nl.html\" 1 {type text/html} {language nl}}, {\"home.pl.html\" 1 {type text/html} {language pl}}, {\"home.pt-br.html\" 1 {type text/html} {language pt-br}}, {\"home.ro.html\" 1 {type text/html} {language ro}}, {\"home.ru.html\" 1 {type text/html} {language ru}}, {\"home.sq.html\" 1 {type text/html} {language sq}}, {\"home.sr.html\" 1 {type text/html} {language sr}}, {\"home.tr.html\" 1 {type text/html} {language tr}}, {\"home.uk.html\" 1 {type text/html} {language uk}}, {\"home.zh-cn.html\" 1 {type text/html} {language zh-cn}}") (vary negotiate accept-language accept-encoding) (tcn . "list") (content-length . 2425) (connection close) (content-type text/html (charset . "iso-8859-1"))) port: #<closed: file 0>>
reply via email to
[
Prev in Thread
]
Current Thread
[
Next in Thread
]
A question about http-get of (web client)
,
Sunjoong Lee
,
2012/04/25
Re: A question about http-get of (web client)
,
Sunjoong Lee
<=
Re: A question about http-get of (web client)
,
Sunjoong Lee
,
2012/04/27
Prev by Date:
SRFI-64 module and SRFI-78 module -- archive file attached
Next by Date:
crash in guile-sqlite3
Previous by thread:
A question about http-get of (web client)
Next by thread:
Re: A question about http-get of (web client)
Index(es):
Date
Thread