Mercurial > pidgin
comparison src/html.c @ 268:f8a29745247c
[gaim-migrate @ 278]
Two star college football players need to pass the final to play in the big
game. The professor loves football, but knows these guys aren't the brightest
bulbs in teh box, so he gives them a special final, puts them in a room by
themselves, and gives them an hour.
The guys look at each other, and start in on the final, which has only one
question: "What did Old MacDonald have?"
One guy looks at the other and says, "Do you know the answer to this?"
The other guy says, "Duh, a farm."
"How do you spell that?"
"Stupid! EIEIO!"
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Thu, 25 May 2000 18:58:21 +0000 |
| parents | 5b28ef2b550e |
| children | 29e1669b006b |
comparison
equal
deleted
inserted
replaced
| 267:5c19f91e7ce4 | 268:f8a29745247c |
|---|---|
| 99 { | 99 { |
| 100 struct g_url website; | 100 struct g_url website; |
| 101 char *webdata = NULL; | 101 char *webdata = NULL; |
| 102 int sock; | 102 int sock; |
| 103 int len; | 103 int len; |
| 104 int read_rv; | |
| 104 int datalen = 0; | 105 int datalen = 0; |
| 105 struct in_addr *host; | 106 struct in_addr *host; |
| 106 char buf[256]; | 107 char buf[256]; |
| 107 char data; | 108 char data; |
| 108 FILE *sockfile; | |
| 109 int startsaving = 0; | 109 int startsaving = 0; |
| 110 GtkWidget *pw = NULL, *pbar = NULL, *label; | 110 GtkWidget *pw = NULL, *pbar = NULL, *label; |
| 111 | 111 |
| 112 website = parse_url(url); | 112 website = parse_url(url); |
| 113 | 113 |
| 121 host = (struct in_addr *)get_address(website.address); | 121 host = (struct in_addr *)get_address(website.address); |
| 122 if (!host) { return g_strdup("g001: Error resolving host\n"); } | 122 if (!host) { return g_strdup("g001: Error resolving host\n"); } |
| 123 if ((sock = connect_address(host->s_addr, website.port)) < 0) | 123 if ((sock = connect_address(host->s_addr, website.port)) < 0) |
| 124 return g_strdup("g003: Error opening connection.\n"); | 124 return g_strdup("g003: Error opening connection.\n"); |
| 125 | 125 |
| 126 sockfile = fdopen(sock, "r+"); | |
| 127 | |
| 128 g_snprintf(buf, sizeof(buf), "GET /%s HTTP/1.0\n\n", website.page); | 126 g_snprintf(buf, sizeof(buf), "GET /%s HTTP/1.0\n\n", website.page); |
| 129 g_snprintf(debug_buff, sizeof(debug_buff), "Request: %s\n", buf); | 127 g_snprintf(debug_buff, sizeof(debug_buff), "Request: %s\n", buf); |
| 130 debug_print(debug_buff); | 128 debug_print(debug_buff); |
| 131 fputs(buf, sockfile); | 129 write(sock, buf, strlen(buf)); |
| 132 | 130 |
| 133 webdata = NULL; | 131 webdata = NULL; |
| 134 len = 0; | 132 len = 0; |
| 135 | 133 |
| 134 /* | |
| 135 * avoid fgetc(), it causes problems on solaris | |
| 136 while ((data = fgetc(sockfile)) != EOF) { | 136 while ((data = fgetc(sockfile)) != EOF) { |
| 137 */ | |
| 138 /* read_rv will be 0 on EOF and < 0 on error, so this should be fine */ | |
| 139 while ((read_rv = read(sock, &data, 1)) > 0) { | |
| 137 if (!data) | 140 if (!data) |
| 138 continue; | 141 continue; |
| 139 | 142 |
| 140 if (!startsaving && data == '<') { | 143 if (!startsaving && data == '<') { |
| 141 #ifdef HAVE_STRSTR | 144 #ifdef HAVE_STRSTR |
