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.4 by pcg, Mon Apr 7 01:12:56 2003 UTC vs.
Revision 1.9 by pcg, Wed Oct 15 00:41:59 2003 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines