Http client fails when parsing some client response #48

Closed
akoprow opened this Issue Mar 14, 2012 · 1 comment

Comments

Projects
None yet
3 participants
Contributor

akoprow commented Mar 14, 2012

Report as submitted by Nicolas Glondu on Opa's mailing list:

As said in title, OPA's webclient always returns an error for some website. The error is :

{other = Cannot parse response: Http_client: parse response error: expected "    " or " " or "
" or "
" or "
" or ':'  (pos:17)}

I guess the answer is not well formatted.

See attached file for an example. Links 2 and 3 return this error.

Other bug less important : the uri parser does not recognize urls containing "?&" (4th link in my example).

import stdlib.web.client

function test_link(url, _) {
    res = match (Parser.try_parse(Uri.uri_parser, url)) {
    case { some : e } :
        match (WebClient.Get.try_get(e)) {
        case ~{ failure }: "{failure}"
        case { success : _ }: "OK"
        }
    default: "INVALID URL"
    }
    #debug = <>{res}</>
}

function body() {
    function link(u) {
        <div>
        <a onclick={test_link(u, _)}>{u}</a>
        <a onclick={function(_){
        _ = Client.winopen(u, {_blank}, [], false)
        void
        }}>Direct</a>
        </div>
    }
    <>
    {link("http://www.google.com")}
    {link("http://www.gqmagazine.fr")}
    {link("http://www.glamourparis.com")}
    {link("https://www.google.com/search?&q=j")}
    <pre id="debug"/>
    </>
}

Server.start(Server.http, {title: "Bug get", page: body})

@ghost ghost assigned cedricss Mar 14, 2012

Contributor

cedricss commented Mar 14, 2012

Those issues have been fixed in Opa 9.0.1

@cedricss cedricss closed this Mar 14, 2012

@ghost ghost assigned Aqua-Ye and cedricss Mar 14, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment