PDA

View Full Version : Lynx/Wget won't connect!


kuran
03-04-2002, 10:12 AM
Hello, I'm running 10.1.3 on a QS, and have a cable connection.

I recently installed Lynx/Wget, but both applications are unable to establish a connection with the net, they both time out.

I 'think' that this has something to do with my proxy server, is there any way to configure this for the terminal?

Thanks a lot for helping out!

pmccann
03-05-2002, 09:32 AM
Hi,

lynx should read the proxy server information out of the file

~/.lynx/lynx.cfg

Just search in there for the string

http_proxy

and set it (and whichever other services you want it to send through the proxy).

Mine reads

http_proxy:http://www-proxy.adelaide.edu.au:xxxx/

where xxxx is the port number (usually 8080).

(Of course this won't work if you're not in the Adelaide University network! Oops, "The University of Adelaide". Like a bad take-off of Monty Python this venerable institution went through the process of changing its name from the second form to the first form above, and now --about two years later-- is changing it back to the more formal "The University of Adelaide". Sigh...)

If the proxy is authenticating (as is the above-listed) you'll be asked to enter the username and password upon start-up. Maybe there's a config file way to store these, but I haven't bothered, as I rarely use lynx in any case.

Now to wget: unfortunately I haven't used that for quite some time. curl seems to be apple's preferred CLI downloader these days. It can be made to download through a proxy server via

curl -x www-proxy.wherever.com:8080 -U username:Password www.macosxhints.com

Just redirect it to a file if you want to actually store a file:

curl -x www-proxy.wherever.com:8080 -U username:Password www.macosxhints.com > hints.html

wget probably does something similar.

Cheers,
Paul

(Good grief: "you have included too many images or smilies and thus can't post this message". Yeaah, right...! No image tags at all, no smileys that I can see ("normal mode"). Grr. Maybe it's all the "colonp" strings being interpreted as smileys in the count. OK, I'll change them and see.... Yep that was it...)

kuran
03-05-2002, 03:01 PM
Thanks a lot for your thorough and entertaining post :)
I couldn't locate the file 'lynx.cfg', at least sherlock couldn't, in what directory is this stored?

Also, curl worked! Is it similar to wget? Since it lists all the html code which makes it impossible to view the contents of a site, does wget do the same?

Once again, thanks for your help.

pmccann
03-05-2002, 09:12 PM
For lynx:

% cd
% cd .lynx

(Note the dot there!)

% ls

You should see lynx.cfg I think/hope. Otherwise just search for it:

% locate lynx | grep cfg

(I'm hoping that your machine has run /etc/weekly at least once! That is, that it's been turned on (and not sleeping!) at 4.30am one Sunday morning. If you get an error when you try the command above you might want to get "macjanitor" from versiontracker, which lets you run the system cleanup scripts whenever you want to. Or if you're patient you can use find instead:

% sudo find / -name "lynx.cfg" -print
password: ******

Enter your usual password here. This will take a minute or so to run through.)

curl and wget are both downloaders: they're not for viewing at all, and offer very similar functionality. Viewing from the command line is the province of lynx and "links". Of course if you catch the html files that curl throws to the screen (as per my first message) you can view them in the browser of your choice.

Cheers,
Paul

kuran
03-06-2002, 07:25 PM
I opened the file using Pico, and found this string, ".h2 HTTP_PROXY" which I then altered into ".h2 HTTP_PROXY:http:/www-proxy.pandora.be:8080/"

When that was done, I saved the file, and tried lynx, but it still gives me a 'Alert!: Unable to connect to remote host.' error...

Is this because I need to setup a different proxy, or was it the wrong line that I edited?

I'm sorry if i'm still going on about this, I'm new to UNIX and very interested in it, but still need a lot of help, so thank you :)

pmccann
03-06-2002, 07:44 PM
No problem at all:

you're **almost** there. You just changed the wrong line in the file!

Scroll down about a page further and you should see a series of lines looking something like

#http_proxy:http://some.server.dom:port/
#https_proxy:http://some.server.dom:port/
#ftp_proxy:http://some.server.dom:port/
#gopher_proxy:http://some.server.dom:port/
#news_proxy:http://some.server.dom:port/

They're the one's that you need to edit. Just remove the "#" from the start of the line (to uncomment it), and add in your proxy server, almost exactly as you illustrated above: for example

http_proxy:http://www-proxy.pandora.be:8080/

(note the double slashes however).

You should probably add in https_proxy and ftp_proxy as well (in the same manner). Then you should finally have your papers in order!

Best wishes,
Paul

kuran
03-06-2002, 11:27 PM
It works! Thanks a lot for your patience!

:)