Skip to content

web #9

@PSLLSP

Description

@PSLLSP

https://pike.lysator.liu.se/docs/tut/browser/fetching_the_page.md

Example with "curl" code doesn't output " Failed!" message when URL is invalid but it dumps a lot of errors and the program is terminated. It is possible that the code was working in the past but it needs an update.

$ ./webbrowser.pike cod.lysator.liu.se
Welcome to the Very Simple WWW Browser!
Fetching URL 'cod.lysator.liu.se'...Standards.URI: got a relative URI (no scheme) lacking a base_uri!
/usr/lib/pike8.0/modules/Standards.pmod/URI.pike:271: URI("")->reparse_uri(UNDEFINED)
/usr/lib/pike8.0/modules/Standards.pmod/URI.pike:418: URI("")->create("cod.lysator.liu.se",UNDEFINED)
/usr/lib/pike8.0/modules/Protocols.pmod/HTTP.pmod/module.pmod:294:
    Protocols.HTTP.do_method("GET","cod.lysator.liu.se",UNDEFINED,UNDEFINED,UNDEFINED,UNDEFINED)
/usr/lib/pike8.0/modules/Protocols.pmod/HTTP.pmod/module.pmod:666:
    Protocols.HTTP.get_url("cod.lysator.liu.se",UNDEFINED,UNDEFINED,UNDEFINED)
webbrowser.pike:9: /main()->handle_url("cod.lysator.liu.se")
webbrowser.pike:39: /main()->main(2,({"/home/psl/webbrowser.pike","cod.lysator.liu.se"}))
$ pike -v
Pike v8.0 release 1956 Copyright © 1994-2025 Linköping University
Pike comes with ABSOLUTELY NO WARRANTY; This is free software and you are
welcome to redistribute it under certain conditions; read the files
COPYING and COPYRIGHT in the Pike distribution for more details.

Other issue on that tutorial page is that I cannot run the code from interpreter. This is in tutorial:

> webbrowser.pike pike.lysator.liu.se
Welcome to the Very Simple WWW Browser!
Fetching URL 'pike.lysator.liu.se'... Done.

And this is reality in pike8.0:

> webbrowser.pike pike.lysator.liu.se
>> 

Other issue is that "URI scheme" is mandatory in 2025, example from tutorial fails with an error:

$ ./webbrowser.pike pike.lysator.liu.se
Welcome to the Very Simple WWW Browser!
Fetching URL 'pike.lysator.liu.se'...Standards.URI: got a relative URI (no scheme) lacking a base_uri!
/usr/lib/pike8.0/modules/Standards.pmod/URI.pike:271: URI("")->reparse_uri(UNDEFINED)
/usr/lib/pike8.0/modules/Standards.pmod/URI.pike:418: URI("")->create("pike.lysator.liu.se",UNDEFINED)
/usr/lib/pike8.0/modules/Protocols.pmod/HTTP.pmod/module.pmod:294:
    Protocols.HTTP.do_method("GET","pike.lysator.liu.se",UNDEFINED,UNDEFINED,UNDEFINED,UNDEFINED)
/usr/lib/pike8.0/modules/Protocols.pmod/HTTP.pmod/module.pmod:666:
    Protocols.HTTP.get_url("pike.lysator.liu.se",UNDEFINED,UNDEFINED,UNDEFINED)
webbrowser.pike:9: /main()->handle_url("pike.lysator.liu.se")
webbrowser.pike:39: /main()->main(2,({"/home/psl/webbrowser.pike","pike.lysator.liu.se"}))

When URI is valid (URL starts with http:// or https://), it works:

$ ./webbrowser.pike http://pike.lysator.liu.se
Welcome to the Very Simple WWW Browser!
Fetching URL 'http://pike.lysator.liu.se'... Done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions