cmdline.txt - gopher-tutorials - The gopher tutorials project. | |
git clone git://bitreich.org/gopher-tutorials/ git://enlrupgkhuxnvlhsf6lc3fziv5… | |
Log | |
Files | |
Refs | |
Tags | |
--- | |
cmdline.txt (1704B) | |
--- | |
1 Dear reader, in this document we will see differents command line | |
2 software which can be used to connect to a gopher server. | |
3 | |
4 | |
5 Printf + netcat | |
6 =============== | |
7 | |
8 It's possible to write request "by hand" using printf to format the | |
9 request string and then netcat to send it to the remote server. | |
10 | |
11 A request of the file "/tutorials/cmdline.txt" will looks like this : | |
12 | |
13 printf "/tutorials/cmdline.txt\r\n" | nc somedomain.com 70 | |
14 | |
15 You will get the server answer directly into your output. Be careful | |
16 if you ask binary files, it will be displayed on your screen, this is | |
17 not something a regular user want. If you want to download a binary | |
18 file, you can redirect the output to a file using ">" or pipe it to | |
19 another software (or using tee for both at the same time). | |
20 | |
21 The following example will download a music file, save it on the | |
22 filesystem and play it with mpv while downloading. | |
23 | |
24 printf "/some_music.ogg\r\n" | nc somedomain.com 70 \ | |
25 | tee saved_music.ogg | mpv - | |
26 | |
27 You may have seen that the data type is not part of the request | |
28 string, this is because it is only useful for the client to decide how | |
29 to handle the content. In the current case, the client is YOU, so if | |
30 you ask a menu and you want to download a file which has been tagged | |
31 with type "I" then you should use the right process to deal with an | |
32 image file. | |
33 | |
34 | |
35 Curl | |
36 ==== | |
37 | |
38 It is possible to use curl to connect to a gopher server, most of its | |
39 options are supported, like timeout or traffic shaping. You need to | |
40 pass a full url with "gopher://" at the start to curl to tell it you | |
41 want to request a gopher server. | |
42 | |
43 By default, curl will output the server result to stdout. Explanations | |
44 can be found in the previous section about this. | |
45 |