When I make the request like this:
(drakma:http-request "http://www.w3.org/2001/06/utf-8-test/UTF-8-demo.html")
It results in error:
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head><title>UTF-8 test file</title></head>
<body>
<p>Original by Markus Kuhn, adapted for HTML by Martin Dürst.</p>
<pre>
UTF-8 encoded sample plain-text file
debugger invoked on a SB-INT:STREAM-ENCODING-ERROR in thread #<THREAD
"initial t
hread" {BBDF5A9}>:
encoding error on stream #<SB-SYS:FD-STREAM for "standard output"
{BBDF859}>
(:EXTERNAL-FORMAT :ASCII):
the character with code 8254 cannot be encoded.
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [OUTPUT-NOTHING] Skip output of this character.
1: [ABORT ] Exit debugger, returning to top level.
(SB-INT:STREAM-ENCODING-ERROR
#<SB-SYS:FD-STREAM for "standard output" {BBDF859}>
8254)
0]
Is it some parameter that I forgot to call http-request with to make it
aware of utf-8 encoding?
Thank you,
Andrew
has anyone layered xml-rpc on top of drakma? seems like a natural
thing to do. s-xml-rpc seems nice, but I don't think it supports https.
Thanks,
Cyrus
Hi Cyrus,
On Wed, 9 May 2007 16:27:57 -0700, Cyrus Harmon <cyrus(a)cyrusharmon.org> wrote:
[Cc to mailing list.]
> So I've been trying to do http-requesting with DRAKMA and I see some
> weird results:
>
> (drakma:http-request "http://patft.uspto.gov/netacgi/nph-Parser?
> Sect1=PTO2&Sect2=HITOFF&u=%2Fnetahtml%2FPTO%2Fsearch-
> adv.htm&r=80&f=G&l=50&d=PTXT&s1=affymetrix&p=2&OS=affymetrix&RS=affymetr
> ix")
Seems Paul Graham's Arc server is not the only one which sends wrong
line endings. Luckily, Chunga was modified to cope with that just two
days ago... :)
CL-USER 15 > (let ((chunga:*accept-bogus-eols* t)
(drakma:*header-stream* *standard-output*))
(nth-value 1 (drakma:http-request "http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=%2Fneta…")))
GET /netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=%2Fnetahtml%2FPTO%2Fsearch-adv.htm&r=80&f=G&l=50&d=PTXT&s1=affymetrix&p=2&OS=affymetrix&RS=affymetrix HTTP/1.1
Host: patft.uspto.gov
User-Agent: Drakma/0.7.0 (LispWorks 5.0.2; Windows NT; Windows XP: 5.1 (build 2600) Service Pack 2; http://weitz.de/drakma/)
Accept: */*
Connection: close
HTTP/1.0 200 Script results follow
Server: NetAnswer Server 1.0
Content-Type: text/html
200
Cheers,
Edi.
I've attached a small patch which makes chunga:read-line* a little more
lenient with regards to line endings.
Currently (drakma:http-request "http://news.ycombinator.com")
fails with an EOF since the arc server doesn't respond with CRLF but
only uses plain LF.
The attached patch works around this by assuming that when a LineFeed is
encountered it also designates the end of a line, although it is quite
possibly the wrong thing.
Cheers,
Sean.
--
...Please don't assume Lisp is only useful for Animation and Graphics,
AI, Bioinformatics, B2B and E-Commerce, Data Mining, EDA/Semiconductor
applications, Expert Systems, Finance, Intelligent Agents, Knowledge
Management, Mechanical CAD, Modeling and Simulation, Natural Language,
Optimization, Research, Risk Analysis, Scheduling, Telecom, and Web
Authoring just because these are the only things they happened to list.
Kent Pitman.
I'm starting to use Drakma in a program of mine, and it seems to work
fine for me except in one strange case. I was trying to retrieve a page,
with (drakma:http-request "http://cesa.iust.ac.ir/"), that I got "Lisp
connection closed unexpectedly: exited abnormally with code 256".
I set *header-stream* to see what's happening. This is the result:
GET / HTTP/1.1
Host: cesa.iust.ac.ir
User-Agent: Drakma/0.7.0 (SBCL 1.0.3; Linux; 2.6.20-15-generic;
http://weitz.de/drakma/)
Accept: */*
Connection: close
HTTP/1.1 302 Found
Connection: close
Date: Mon, 30 Apr 2007 22:52:19 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Location: /Default.aspx?AspxAutoDetectCookieSupport=1
Set-Cookie: AspxAutoDetectCookieSupport=1; path=/
Cache-Control: private
Content-Type: text/html
GET /Default.aspx?AspxAutoDetectCookieSupport=1 HTTP/1.1
Host: cesa.iust.ac.ir
User-Agent: Drakma/0.7.0 (SBCL 1.0.3; Linux; 2.6.20-15-generic;
http://weitz.de/drakma/)
Accept: */*
Connection: close
HTTP/1.1 302 Found
Connection: close
Date: Mon, 30 Apr 2007 22:52:28 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Location:
/(X(1)S(rmofw345wvkjbzjz54jnyu45))/Default.aspx?AspxAutoDetectCookieSupport=1
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 194
GET
/(X(1)S(rmofw345wvkjbzjz54jnyu45))/Default.aspx?AspxAutoDetectCookieSupport=1
HTTP/1.1
Host: cesa.iust.ac.ir
User-Agent: Drakma/0.7.0 (SBCL 1.0.3; Linux; 2.6.20-15-generic;
http://weitz.de/drakma/)
Accept: */*
Connection: close
HTTP/1.1 200 OK
Connection: close
Date: Mon, 30 Apr 2007 22:52:34 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 72459
Other web pages I have tested work fine, but this is the one page I'm
going to work with. Any ideas? Thanks.
Homayoon, (new-comer)