Mercurial > pidgin
comparison src/proxy.c @ 5872:059d95c67cda
[gaim-migrate @ 6304]
The legendary Header File Cleanup! Files now only include what they need.
This should reduce the number of files that must recompile when a header
file changes. It's a lot nicer. Trust me on it. I also added a couple new
header files. I hope I didn't break TOO much!
committer: Tailor Script <tailor@pidgin.im>
| author | Christian Hammond <chipx86@chipx86.com> |
|---|---|
| date | Sat, 14 Jun 2003 23:21:02 +0000 |
| parents | 46d7ad0dfa26 |
| children | 730015652f4d |
comparison
equal
deleted
inserted
replaced
| 5871:508adf90fbb9 | 5872:059d95c67cda |
|---|---|
| 25 | 25 |
| 26 /* this is a little piece of code to handle proxy connection */ | 26 /* this is a little piece of code to handle proxy connection */ |
| 27 /* it is intended to : 1st handle http proxy, using the CONNECT command | 27 /* it is intended to : 1st handle http proxy, using the CONNECT command |
| 28 , 2nd provide an easy way to add socks support */ | 28 , 2nd provide an easy way to add socks support */ |
| 29 | 29 |
| 30 #ifdef HAVE_CONFIG_H | 30 #include "internal.h" |
| 31 #include "config.h" | 31 #include "debug.h" |
| 32 #endif | 32 #include "prefs.h" |
| 33 #include <stdio.h> | |
| 34 #include <stdlib.h> | |
| 35 #include <string.h> | |
| 36 #include <sys/types.h> | |
| 37 #include <sys/time.h> | |
| 38 | |
| 39 #ifndef _WIN32 | |
| 40 #include <sys/socket.h> | |
| 41 #include <netdb.h> | |
| 42 #include <netinet/in.h> | |
| 43 #include <arpa/inet.h> | |
| 44 #include <unistd.h> | |
| 45 #include <signal.h> | |
| 46 #else | |
| 47 #include <winsock.h> | |
| 48 #endif | |
| 49 | |
| 50 #include <fcntl.h> | |
| 51 #include <errno.h> | |
| 52 #include "gaim.h" | |
| 53 #include "proxy.h" | 33 #include "proxy.h" |
| 54 #include "prefs.h" | 34 #include "util.h" |
| 55 | |
| 56 #ifdef _WIN32 | |
| 57 #include "win32dep.h" | |
| 58 #endif | |
| 59 | 35 |
| 60 #define GAIM_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) | 36 #define GAIM_READ_COND (G_IO_IN | G_IO_HUP | G_IO_ERR) |
| 61 #define GAIM_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) | 37 #define GAIM_WRITE_COND (G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL) |
| 62 | 38 |
| 63 static GaimProxyInfo *global_proxy_info = NULL; | 39 static GaimProxyInfo *global_proxy_info = NULL; |
| 64 static gboolean global_proxy_info_from_prefs = FALSE; | 40 static gboolean global_proxy_info_from_prefs = FALSE; |
| 41 | |
| 42 static int opt_debug = 0; | |
| 65 | 43 |
| 66 struct PHB { | 44 struct PHB { |
| 67 GaimInputFunction func; | 45 GaimInputFunction func; |
| 68 gpointer data; | 46 gpointer data; |
| 69 char *host; | 47 char *host; |
| 595 struct timeval tv = { .tv_sec = 40 , .tv_usec = 0 }; | 573 struct timeval tv = { .tv_sec = 40 , .tv_usec = 0 }; |
| 596 FD_ZERO(&fds); | 574 FD_ZERO(&fds); |
| 597 FD_SET(child_in[0], &fds); | 575 FD_SET(child_in[0], &fds); |
| 598 rc = select(child_in[0]+1, &fds, NULL, NULL, &tv); | 576 rc = select(child_in[0]+1, &fds, NULL, NULL, &tv); |
| 599 if(!rc) { | 577 if(!rc) { |
| 600 if(opt_debug) | 578 if (opt_debug) |
| 601 fprintf(stderr,"dns[%d]: nobody needs me... =(\n", getpid()); | 579 fprintf(stderr,"dns[%d]: nobody needs me... =(\n", getpid()); |
| 602 break; | 580 break; |
| 603 } | 581 } |
| 604 rc = read(child_in[0], &dns_params, sizeof(dns_params)); | 582 rc = read(child_in[0], &dns_params, sizeof(dns_params)); |
| 605 if(rc < 0) { | 583 if(rc < 0) { |
| 1390 int i; | 1368 int i; |
| 1391 struct PHB *phb = data; | 1369 struct PHB *phb = data; |
| 1392 unsigned int len; | 1370 unsigned int len; |
| 1393 int error = ETIMEDOUT; | 1371 int error = ETIMEDOUT; |
| 1394 | 1372 |
| 1395 gaim_debug(GAIM_INFO, "socks5 proxy", "Connected.\n"); | 1373 gaim_debug(GAIM_DEBUG_INFO, "socks5 proxy", "Connected.\n"); |
| 1396 | 1374 |
| 1397 if (phb->inpa > 0) | 1375 if (phb->inpa > 0) |
| 1398 gaim_input_remove(phb->inpa); | 1376 gaim_input_remove(phb->inpa); |
| 1399 | 1377 |
| 1400 len = sizeof(error); | 1378 len = sizeof(error); |
