ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/vpn_tcp.C
(Generate patch)

Comparing gvpe/src/vpn_tcp.C (file contents):
Revision 1.5 by pcg, Mon Apr 7 01:28:56 2003 UTC vs.
Revision 1.8 by pcg, Tue Oct 14 15:48:15 2003 UTC

29 29
30#include <sys/types.h> 30#include <sys/types.h>
31#include <sys/socket.h> 31#include <sys/socket.h>
32#include <sys/poll.h> 32#include <sys/poll.h>
33#include <sys/wait.h> 33#include <sys/wait.h>
34#include <netinet/in.h>
35#include <sys/uio.h> 34#include <sys/uio.h>
36#include <arpa/inet.h>
37#include <errno.h> 35#include <errno.h>
38#include <time.h> 36#include <time.h>
39#include <unistd.h> 37#include <unistd.h>
40 38
41#include <map> 39#include <map>
42#include <unistd.h> 40#include <unistd.h>
43#include <fcntl.h> 41#include <fcntl.h>
44#include <sys/poll.h> 42#include <sys/poll.h>
43
44#include "netcompat.h"
45 45
46#include "vpn.h" 46#include "vpn.h"
47 47
48#if ENABLE_HTTP_PROXY 48#if ENABLE_HTTP_PROXY
49# include "conf.h" 49# include "conf.h"
169 if (w_ofs < 2) 169 if (w_ofs < 2)
170 { 170 {
171 u16 plen = htons (w_pkt->len); 171 u16 plen = htons (w_pkt->len);
172 172
173 iovec vec[2]; 173 iovec vec[2];
174 //TODO: char* is the right type? hardly...
174 vec[0].iov_base = ((u8 *)&plen) + w_ofs; 175 vec[0].iov_base = (char *)((u8 *)&plen) + w_ofs;
175 vec[0].iov_len = 2 - w_ofs; 176 vec[0].iov_len = 2 - w_ofs;
176 vec[1].iov_base = &((*w_pkt)[0]); 177 vec[1].iov_base = (char *)&((*w_pkt)[0]);
177 vec[1].iov_len = w_len - 2; 178 vec[1].iov_len = w_len - 2;
178 179
179 len = writev (fd, vec, 2); 180 len = writev (fd, vec, 2);
180 } 181 }
181 else 182 else
320 321
321 fcntl (fd, F_SETFL, O_NONBLOCK); 322 fcntl (fd, F_SETFL, O_NONBLOCK);
322 323
323 if (i < 12) 324 if (i < 12)
324 { 325 {
325 slog (L_ERR, _("%s: unable to do proxy-forwarding, short response"), 326 slog (L_ERR, _("(%s): unable to do proxy-forwarding, short response"),
326 (const char *)si); 327 (const char *)si);
327 error (); 328 error ();
328 } 329 }
329 else if (r[0] != 'H' || r[1] != 'T' || r[2] != 'T' || r[3] != 'P' || r[4] != '/' 330 else if (r[0] != 'H' || r[1] != 'T' || r[2] != 'T' || r[3] != 'P' || r[4] != '/'
330 || r[5] != '1' // http-major 331 || r[5] != '1' // http-major
331 || r[9] != '2') // response 332 || r[9] != '2') // response
332 { 333 {
333 slog (L_ERR, _("%s: malformed or unexpected proxy response (%.12s)"), 334 slog (L_ERR, _("(%s): malformed or unexpected proxy response (%.12s)"),
334 (const char *)si, r); 335 (const char *)si, r);
335 error (); 336 error ();
336 } 337 }
337 else 338 else
338 state = ESTABLISHED; 339 state = ESTABLISHED;
401 // right thing to do, not using tcp *is* the right thing to do. 402 // right thing to do, not using tcp *is* the right thing to do.
402 if (!w_pkt) 403 if (!w_pkt)
403 { 404 {
404 // how this maps to the underlying tcp packets we don't know 405 // how this maps to the underlying tcp packets we don't know
405 // and we don't care. at least we tried ;) 406 // and we don't care. at least we tried ;)
407#if defined(SOL_IP) && defined(IP_TOS)
406 setsockopt (fd, SOL_IP, IP_TOS, &tos, sizeof tos); 408 setsockopt (fd, SOL_IP, IP_TOS, &tos, sizeof tos);
409#endif
407 410
408 w_pkt = pkt; 411 w_pkt = pkt;
409 w_ofs = 0; 412 w_ofs = 0;
410 w_len = pkt->len + 2; // length + size header 413 w_len = pkt->len + 2; // length + size header
411 414

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines