ReactOS  0.4.14-dev-52-g6116262
session.c
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Hans Leidekker for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #include "config.h"
20 #include "wine/port.h"
21 #include "wine/debug.h"
22 
23 #include <stdarg.h>
24 #include <stdlib.h>
25 
26 #ifdef HAVE_CORESERVICES_CORESERVICES_H
27 #define GetCurrentThread MacGetCurrentThread
28 #define LoadResource MacLoadResource
29 #include <CoreServices/CoreServices.h>
30 #undef GetCurrentThread
31 #undef LoadResource
32 #undef DPRINTF
33 #endif
34 
35 #include "windef.h"
36 #include "winbase.h"
37 #ifndef __MINGW32__
38 #define USE_WS_PREFIX
39 #endif
40 #include "winsock2.h"
41 #include "ws2ipdef.h"
42 #include "winhttp.h"
43 #include "wincrypt.h"
44 #include "winreg.h"
45 #define COBJMACROS
46 #include "ole2.h"
47 #include "dispex.h"
48 #include "activscp.h"
49 
50 #include "winhttp_private.h"
51 
53 
54 #define DEFAULT_RESOLVE_TIMEOUT 0
55 #define DEFAULT_CONNECT_TIMEOUT 20000
56 #define DEFAULT_SEND_TIMEOUT 30000
57 #define DEFAULT_RECEIVE_TIMEOUT 30000
58 
60 {
61  /* FIXME */
63 }
64 
66 {
67  /* FIXME */
68  return GetLastError();
69 }
70 
72 {
73  if (hdr->callback && (hdr->notify_mask & status))
74  {
75  TRACE("%p, 0x%08x, %p, %u\n", hdr, status, info, buflen);
76  hdr->callback( hdr->handle, hdr->context, status, info, buflen );
77  TRACE("returning from 0x%08x callback\n", status);
78  }
79 }
80 
81 /***********************************************************************
82  * WinHttpCheckPlatform (winhttp.@)
83  */
85 {
86  TRACE("\n");
87  return TRUE;
88 }
89 
90 /***********************************************************************
91  * session_destroy (internal)
92  */
94 {
95  session_t *session = (session_t *)hdr;
96  struct list *item, *next;
97  domain_t *domain;
98 
99  TRACE("%p\n", session);
100 
101  if (session->unload_event) SetEvent( session->unload_event );
102  if (session->cred_handle_initialized) FreeCredentialsHandle( &session->cred_handle );
103 
105  {
106  domain = LIST_ENTRY( item, domain_t, entry );
107  delete_domain( domain );
108  }
109  heap_free( session->agent );
110  heap_free( session->proxy_server );
111  heap_free( session->proxy_bypass );
112  heap_free( session->proxy_username );
113  heap_free( session->proxy_password );
114  heap_free( session );
115 }
116 
118 {
119  session_t *session = (session_t *)hdr;
120 
121  switch (option)
122  {
124  {
125  if (!buffer || *buflen < sizeof(DWORD))
126  {
127  *buflen = sizeof(DWORD);
129  return FALSE;
130  }
131 
132  *(DWORD *)buffer = hdr->redirect_policy;
133  *buflen = sizeof(DWORD);
134  return TRUE;
135  }
137  *(DWORD *)buffer = session->resolve_timeout;
138  *buflen = sizeof(DWORD);
139  return TRUE;
141  *(DWORD *)buffer = session->connect_timeout;
142  *buflen = sizeof(DWORD);
143  return TRUE;
145  *(DWORD *)buffer = session->send_timeout;
146  *buflen = sizeof(DWORD);
147  return TRUE;
149  *(DWORD *)buffer = session->recv_timeout;
150  *buflen = sizeof(DWORD);
151  return TRUE;
152  default:
153  FIXME("unimplemented option %u\n", option);
155  return FALSE;
156  }
157 }
158 
160 {
161  session_t *session = (session_t *)hdr;
162 
163  switch (option)
164  {
166  {
168 
169  FIXME("%u %s %s\n", pi->dwAccessType, debugstr_w(pi->lpszProxy), debugstr_w(pi->lpszProxyBypass));
170  return TRUE;
171  }
173  {
174  DWORD policy;
175 
176  if (buflen != sizeof(policy))
177  {
179  return FALSE;
180  }
181 
182  policy = *(DWORD *)buffer;
183  TRACE("0x%x\n", policy);
184  hdr->redirect_policy = policy;
185  return TRUE;
186  }
188  {
189  if (buflen != sizeof(session->secure_protocols))
190  {
192  return FALSE;
193  }
194  session->secure_protocols = *(DWORD *)buffer;
195  TRACE("0x%x\n", session->secure_protocols);
196  return TRUE;
197  }
200  return FALSE;
202  session->resolve_timeout = *(DWORD *)buffer;
203  return TRUE;
205  session->connect_timeout = *(DWORD *)buffer;
206  return TRUE;
208  session->send_timeout = *(DWORD *)buffer;
209  return TRUE;
211  session->recv_timeout = *(DWORD *)buffer;
212  return TRUE;
214  FIXME("WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH: 0x%x\n", *(DWORD *)buffer);
215  return TRUE;
217  TRACE("WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT: %p\n", *(HANDLE *)buffer);
218  session->unload_event = *(HANDLE *)buffer;
219  return TRUE;
221  FIXME("WINHTTP_OPTION_MAX_CONNS_PER_SERVER: %d\n", *(DWORD *)buffer);
222  return TRUE;
224  FIXME("WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER: %d\n", *(DWORD *)buffer);
225  return TRUE;
226  default:
227  FIXME("unimplemented option %u\n", option);
229  return FALSE;
230  }
231 }
232 
234 {
238 };
239 
240 #ifdef __REACTOS__
241 BOOL netconn_init_winsock();
242 #endif /* __REACTOS__ */
243 /***********************************************************************
244  * WinHttpOpen (winhttp.@)
245  */
247 {
248  session_t *session;
250 #ifdef __REACTOS__
251  if (!netconn_init_winsock()) return NULL;
252 #endif
253 
254  TRACE("%s, %u, %s, %s, 0x%08x\n", debugstr_w(agent), access, debugstr_w(proxy), debugstr_w(bypass), flags);
255 
256  if (!(session = heap_alloc_zero( sizeof(session_t) ))) return NULL;
257 
259  session->hdr.vtbl = &session_vtbl;
260  session->hdr.flags = flags;
261  session->hdr.refs = 1;
263  list_init( &session->hdr.children );
268  list_init( &session->cookie_cache );
269 
270  if (agent && !(session->agent = strdupW( agent ))) goto end;
272  {
274 
276  session->access = info.dwAccessType;
277  if (info.lpszProxy && !(session->proxy_server = strdupW( info.lpszProxy )))
278  {
279  GlobalFree( (LPWSTR)info.lpszProxy );
280  GlobalFree( (LPWSTR)info.lpszProxyBypass );
281  goto end;
282  }
283  if (info.lpszProxyBypass && !(session->proxy_bypass = strdupW( info.lpszProxyBypass )))
284  {
285  GlobalFree( (LPWSTR)info.lpszProxy );
286  GlobalFree( (LPWSTR)info.lpszProxyBypass );
287  goto end;
288  }
289  }
291  {
292  session->access = access;
293  if (proxy && !(session->proxy_server = strdupW( proxy ))) goto end;
294  if (bypass && !(session->proxy_bypass = strdupW( bypass ))) goto end;
295  }
296 
297  if (!(handle = alloc_handle( &session->hdr ))) goto end;
298  session->hdr.handle = handle;
299 
300 end:
301  release_object( &session->hdr );
302  TRACE("returning %p\n", handle);
304  return handle;
305 }
306 
307 /***********************************************************************
308  * connect_destroy (internal)
309  */
311 {
313 
314  TRACE("%p\n", connect);
315 
316  release_object( &connect->session->hdr );
317 
318  heap_free( connect->hostname );
319  heap_free( connect->servername );
320  heap_free( connect->username );
321  heap_free( connect->password );
322  heap_free( connect );
323 }
324 
326 {
328 
329  switch (option)
330  {
332  {
333  if (!buffer || *buflen < sizeof(HINTERNET))
334  {
335  *buflen = sizeof(HINTERNET);
337  return FALSE;
338  }
339 
340  *(HINTERNET *)buffer = ((object_header_t *)connect->session)->handle;
341  *buflen = sizeof(HINTERNET);
342  return TRUE;
343  }
345  *(DWORD *)buffer = connect->session->resolve_timeout;
346  *buflen = sizeof(DWORD);
347  return TRUE;
349  *(DWORD *)buffer = connect->session->connect_timeout;
350  *buflen = sizeof(DWORD);
351  return TRUE;
353  *(DWORD *)buffer = connect->session->send_timeout;
354  *buflen = sizeof(DWORD);
355  return TRUE;
357  *(DWORD *)buffer = connect->session->recv_timeout;
358  *buflen = sizeof(DWORD);
359  return TRUE;
360  default:
361  FIXME("unimplemented option %u\n", option);
363  return FALSE;
364  }
365 }
366 
368 {
371  NULL
372 };
373 
375 {
376  static const WCHAR localW[] = { '<','l','o','c','a','l','>',0 };
377  BOOL ret = FALSE;
378 
379  if (!strcmpiW( domain, localW ) && !strchrW( server, '.' ))
380  ret = TRUE;
381  else if (*domain == '*')
382  {
383  if (domain[1] == '.')
384  {
385  LPCWSTR dot;
386 
387  /* For a hostname to match a wildcard, the last domain must match
388  * the wildcard exactly. E.g. if the wildcard is *.a.b, and the
389  * hostname is www.foo.a.b, it matches, but a.b does not.
390  */
391  dot = strchrW( server, '.' );
392  if (dot)
393  {
394  int len = strlenW( dot + 1 );
395 
396  if (len > strlenW( domain + 2 ))
397  {
398  LPCWSTR ptr;
399 
400  /* The server's domain is longer than the wildcard, so it
401  * could be a subdomain. Compare the last portion of the
402  * server's domain.
403  */
404  ptr = dot + len + 1 - strlenW( domain + 2 );
405  if (!strcmpiW( ptr, domain + 2 ))
406  {
407  /* This is only a match if the preceding character is
408  * a '.', i.e. that it is a matching domain. E.g.
409  * if domain is '*.b.c' and server is 'www.ab.c' they
410  * do not match.
411  */
412  ret = *(ptr - 1) == '.';
413  }
414  }
415  else
416  ret = !strcmpiW( dot + 1, domain + 2 );
417  }
418  }
419  }
420  else
421  ret = !strcmpiW( server, domain );
422  return ret;
423 }
424 
425 /* Matches INTERNET_MAX_HOST_NAME_LENGTH in wininet.h, also RFC 1035 */
426 #define MAX_HOST_NAME_LENGTH 256
427 
429 {
430  LPCWSTR ptr;
431  BOOL ret = FALSE;
432 
433  if (!session->proxy_bypass) return FALSE;
434  ptr = session->proxy_bypass;
435  do {
436  LPCWSTR tmp = ptr;
437 
438  ptr = strchrW( ptr, ';' );
439  if (!ptr)
440  ptr = strchrW( tmp, ' ' );
441  if (ptr)
442  {
443  if (ptr - tmp < MAX_HOST_NAME_LENGTH)
444  {
445  WCHAR domain[MAX_HOST_NAME_LENGTH];
446 
447  memcpy( domain, tmp, (ptr - tmp) * sizeof(WCHAR) );
448  domain[ptr - tmp] = 0;
449  ret = domain_matches( server, domain );
450  }
451  ptr += 1;
452  }
453  else if (*tmp)
454  ret = domain_matches( server, tmp );
455  } while (ptr && !ret);
456  return ret;
457 }
458 
460 {
461  session_t *session = connect->session;
462  BOOL ret = TRUE;
463 
464  if (session->proxy_server && !should_bypass_proxy(session, server))
465  {
466  LPCWSTR colon;
467 
468  if ((colon = strchrW( session->proxy_server, ':' )))
469  {
470  if (!connect->servername || strncmpiW( connect->servername,
471  session->proxy_server, colon - session->proxy_server - 1 ))
472  {
473  heap_free( connect->servername );
474  connect->resolved = FALSE;
475  if (!(connect->servername = heap_alloc(
476  (colon - session->proxy_server + 1) * sizeof(WCHAR) )))
477  {
478  ret = FALSE;
479  goto end;
480  }
481  memcpy( connect->servername, session->proxy_server,
482  (colon - session->proxy_server) * sizeof(WCHAR) );
483  connect->servername[colon - session->proxy_server] = 0;
484  if (*(colon + 1))
485  connect->serverport = atoiW( colon + 1 );
486  else
487  connect->serverport = INTERNET_DEFAULT_PORT;
488  }
489  }
490  else
491  {
492  if (!connect->servername || strcmpiW( connect->servername,
493  session->proxy_server ))
494  {
495  heap_free( connect->servername );
496  connect->resolved = FALSE;
497  if (!(connect->servername = strdupW( session->proxy_server )))
498  {
499  ret = FALSE;
500  goto end;
501  }
502  connect->serverport = INTERNET_DEFAULT_PORT;
503  }
504  }
505  }
506  else if (server)
507  {
508  heap_free( connect->servername );
509  connect->resolved = FALSE;
510  if (!(connect->servername = strdupW( server )))
511  {
512  ret = FALSE;
513  goto end;
514  }
515  connect->serverport = port;
516  }
517 end:
518  return ret;
519 }
520 
521 /***********************************************************************
522  * WinHttpConnect (winhttp.@)
523  */
525 {
527  session_t *session;
528  HINTERNET hconnect = NULL;
529 
530  TRACE("%p, %s, %u, %x\n", hsession, debugstr_w(server), port, reserved);
531 
532  if (!server)
533  {
535  return NULL;
536  }
537  if (!(session = (session_t *)grab_object( hsession )))
538  {
540  return NULL;
541  }
542  if (session->hdr.type != WINHTTP_HANDLE_TYPE_SESSION)
543  {
544  release_object( &session->hdr );
546  return NULL;
547  }
548  if (!(connect = heap_alloc_zero( sizeof(connect_t) )))
549  {
550  release_object( &session->hdr );
551  return NULL;
552  }
554  connect->hdr.vtbl = &connect_vtbl;
555  connect->hdr.refs = 1;
556  connect->hdr.flags = session->hdr.flags;
557  connect->hdr.callback = session->hdr.callback;
558  connect->hdr.notify_mask = session->hdr.notify_mask;
559  connect->hdr.context = session->hdr.context;
560  connect->hdr.redirect_policy = session->hdr.redirect_policy;
561  list_init( &connect->hdr.children );
562 
563  addref_object( &session->hdr );
564  connect->session = session;
565  list_add_head( &session->hdr.children, &connect->hdr.entry );
566 
567  if (!(connect->hostname = strdupW( server ))) goto end;
568  connect->hostport = port;
570 
571  if (!(hconnect = alloc_handle( &connect->hdr ))) goto end;
572  connect->hdr.handle = hconnect;
573 
574  send_callback( &session->hdr, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, &hconnect, sizeof(hconnect) );
575 
576 end:
577  release_object( &connect->hdr );
578  release_object( &session->hdr );
579  TRACE("returning %p\n", hconnect);
580  if (hconnect) set_last_error( ERROR_SUCCESS );
581  return hconnect;
582 }
583 
584 /***********************************************************************
585  * request_destroy (internal)
586  */
588 {
590  unsigned int i, j;
591 
592  TRACE("%p\n", request);
593 
594  if (request->task_thread)
595  {
596  /* Signal to the task proc to quit. It will call
597  this again when it does. */
598  HANDLE thread = request->task_thread;
599  request->task_thread = 0;
600  SetEvent( request->task_cancel );
601  CloseHandle( thread );
602  return;
603  }
604  release_object( &request->connect->hdr );
605 
606  destroy_authinfo( request->authinfo );
607  destroy_authinfo( request->proxy_authinfo );
608 
609  heap_free( request->verb );
610  heap_free( request->path );
611  heap_free( request->version );
612  heap_free( request->raw_headers );
613  heap_free( request->status_text );
614  for (i = 0; i < request->num_headers; i++)
615  {
616  heap_free( request->headers[i].field );
617  heap_free( request->headers[i].value );
618  }
619  heap_free( request->headers );
620  for (i = 0; i < TARGET_MAX; i++)
621  {
622  for (j = 0; j < SCHEME_MAX; j++)
623  {
624  heap_free( request->creds[i][j].username );
625  heap_free( request->creds[i][j].password );
626  }
627  }
628  heap_free( request );
629 }
630 
631 static void str_to_buffer( WCHAR *buffer, const WCHAR *str, LPDWORD buflen )
632 {
633  int len = 0;
634  if (str) len = strlenW( str );
635  if (buffer && *buflen > len)
636  {
637  if (str) memcpy( buffer, str, len * sizeof(WCHAR) );
638  buffer[len] = 0;
639  }
640  *buflen = len * sizeof(WCHAR);
641 }
642 
644 {
645  WCHAR *ret;
647 
649  if ((ret = LocalAlloc( 0, size * sizeof(WCHAR) )))
651 
652  return ret;
653 }
654 
655 static BOOL convert_sockaddr( const struct sockaddr *addr, SOCKADDR_STORAGE *addr_storage )
656 {
657 #if !defined(__MINGW32__) && !defined(_MSC_VER)
658  switch (addr->sa_family)
659  {
660  case AF_INET:
661  {
662  const struct sockaddr_in *addr_unix = (const struct sockaddr_in *)addr;
663  struct WS_sockaddr_in *addr_win = (struct WS_sockaddr_in *)addr_storage;
664  char *p;
665 
666  addr_win->sin_family = WS_AF_INET;
667  addr_win->sin_port = addr_unix->sin_port;
668  memcpy( &addr_win->sin_addr, &addr_unix->sin_addr, 4 );
669  p = (char *)&addr_win->sin_addr + 4;
670  memset( p, 0, sizeof(*addr_storage) - (p - (char *)addr_win) );
671  return TRUE;
672  }
673  case AF_INET6:
674  {
675  const struct sockaddr_in6 *addr_unix = (const struct sockaddr_in6 *)addr;
676  struct WS_sockaddr_in6 *addr_win = (struct WS_sockaddr_in6 *)addr_storage;
677 
678  addr_win->sin6_family = WS_AF_INET6;
679  addr_win->sin6_port = addr_unix->sin6_port;
680  addr_win->sin6_flowinfo = addr_unix->sin6_flowinfo;
681  memcpy( &addr_win->sin6_addr, &addr_unix->sin6_addr, 16 );
682 #ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
683  addr_win->sin6_scope_id = addr_unix->sin6_scope_id;
684 #else
685  addr_win->sin6_scope_id = 0;
686 #endif
687  memset( addr_win + 1, 0, sizeof(*addr_storage) - sizeof(*addr_win) );
688  return TRUE;
689  }
690  default:
691  ERR("unhandled family %u\n", addr->sa_family);
692  return FALSE;
693  }
694 #else
695  switch (addr->sa_family)
696  {
697  case AF_INET:
698  {
699  struct sockaddr_in *addr_in = (struct sockaddr_in *)addr_storage;
700 
701  memcpy( addr_in, addr, sizeof(*addr_in) );
702  memset( addr_in + 1, 0, sizeof(*addr_storage) - sizeof(*addr_in) );
703  return TRUE;
704  }
705  case AF_INET6:
706  {
707  struct sockaddr_in6 *addr_in6 = (struct sockaddr_in6 *)addr_storage;
708 
709  memcpy( addr_in6, addr, sizeof(*addr_in6) );
710  memset( addr_in6 + 1, 0, sizeof(*addr_storage) - sizeof(*addr_in6) );
711  return TRUE;
712  }
713  default:
714  ERR("unhandled family %u\n", addr->sa_family);
715  return FALSE;
716  }
717 #endif
718 }
719 
721 {
723 
724  switch (option)
725  {
727  {
728  DWORD flags = 0;
729  int bits;
730 
731  if (!buffer || *buflen < sizeof(flags))
732  {
733  *buflen = sizeof(flags);
735  return FALSE;
736  }
737 
738  flags = 0;
740  flags |= request->security_flags;
741  if (request->netconn)
742  {
744  if (bits >= 128)
746  else if (bits >= 56)
748  else
750  }
751  *(DWORD *)buffer = flags;
752  *buflen = sizeof(flags);
753  return TRUE;
754  }
756  {
757  const CERT_CONTEXT *cert;
758 
759  if (!buffer || *buflen < sizeof(cert))
760  {
761  *buflen = sizeof(cert);
763  return FALSE;
764  }
765 
766  if (!request->netconn || !(cert = netconn_get_certificate( request->netconn ))) return FALSE;
768  *buflen = sizeof(cert);
769  return TRUE;
770  }
772  {
773  const CERT_CONTEXT *cert;
774  const CRYPT_OID_INFO *oidInfo;
776 
777  FIXME("partial stub\n");
778 
779  if (!buffer || *buflen < sizeof(*ci))
780  {
781  *buflen = sizeof(*ci);
783  return FALSE;
784  }
785  if (!request->netconn || !(cert = netconn_get_certificate( request->netconn ))) return FALSE;
786 
787  ci->ftExpiry = cert->pCertInfo->NotAfter;
788  ci->ftStart = cert->pCertInfo->NotBefore;
789  ci->lpszSubjectInfo = blob_to_str( cert->dwCertEncodingType, &cert->pCertInfo->Subject );
790  ci->lpszIssuerInfo = blob_to_str( cert->dwCertEncodingType, &cert->pCertInfo->Issuer );
791  ci->lpszProtocolName = NULL;
793  cert->pCertInfo->SignatureAlgorithm.pszObjId,
794  0 );
795  if (oidInfo)
796  ci->lpszSignatureAlgName = (LPWSTR)oidInfo->pwszName;
797  else
800  ci->dwKeySize = request->netconn ? netconn_get_cipher_strength( request->netconn ) : 0;
801 
803  *buflen = sizeof(*ci);
804  return TRUE;
805  }
807  {
808  if (!buffer || *buflen < sizeof(DWORD))
809  {
810  *buflen = sizeof(DWORD);
812  return FALSE;
813  }
814 
815  *(DWORD *)buffer = request->netconn ? netconn_get_cipher_strength( request->netconn ) : 0;
816  *buflen = sizeof(DWORD);
817  return TRUE;
818  }
820  {
821  WINHTTP_CONNECTION_INFO *info = buffer;
822  struct sockaddr local;
823  socklen_t len = sizeof(local);
824  const struct sockaddr *remote = (const struct sockaddr *)&request->connect->sockaddr;
825 
826  if (!buffer || *buflen < sizeof(*info))
827  {
828  *buflen = sizeof(*info);
830  return FALSE;
831  }
832  if (!request->netconn)
833  {
835  return FALSE;
836  }
837  if (getsockname( request->netconn->socket, &local, &len )) return FALSE;
838  if (!convert_sockaddr( &local, &info->LocalAddress )) return FALSE;
839  if (!convert_sockaddr( remote, &info->RemoteAddress )) return FALSE;
840  info->cbSize = sizeof(*info);
841  return TRUE;
842  }
844  *(DWORD *)buffer = request->resolve_timeout;
845  *buflen = sizeof(DWORD);
846  return TRUE;
848  *(DWORD *)buffer = request->connect_timeout;
849  *buflen = sizeof(DWORD);
850  return TRUE;
852  *(DWORD *)buffer = request->send_timeout;
853  *buflen = sizeof(DWORD);
854  return TRUE;
856  *(DWORD *)buffer = request->recv_timeout;
857  *buflen = sizeof(DWORD);
858  return TRUE;
859 
861  str_to_buffer( buffer, request->connect->username, buflen );
862  return TRUE;
863 
865  str_to_buffer( buffer, request->connect->password, buflen );
866  return TRUE;
867 
869  str_to_buffer( buffer, request->connect->session->proxy_username, buflen );
870  return TRUE;
871 
873  str_to_buffer( buffer, request->connect->session->proxy_password, buflen );
874  return TRUE;
875 
876  default:
877  FIXME("unimplemented option %u\n", option);
879  return FALSE;
880  }
881 }
882 
883 static WCHAR *buffer_to_str( WCHAR *buffer, DWORD buflen )
884 {
885  WCHAR *ret;
886  if ((ret = heap_alloc( (buflen + 1) * sizeof(WCHAR))))
887  {
888  memcpy( ret, buffer, buflen * sizeof(WCHAR) );
889  ret[buflen] = 0;
890  return ret;
891  }
893  return NULL;
894 }
895 
897 {
899 
900  switch (option)
901  {
903  {
905 
906  FIXME("%u %s %s\n", pi->dwAccessType, debugstr_w(pi->lpszProxy), debugstr_w(pi->lpszProxyBypass));
907  return TRUE;
908  }
910  {
911  DWORD disable;
912 
913  if (buflen != sizeof(DWORD))
914  {
916  return FALSE;
917  }
918 
919  disable = *(DWORD *)buffer;
920  TRACE("0x%x\n", disable);
921  hdr->disable_flags |= disable;
922  return TRUE;
923  }
925  {
926  DWORD policy;
927 
928  if (buflen != sizeof(DWORD))
929  {
931  return FALSE;
932  }
933 
934  policy = *(DWORD *)buffer;
935  TRACE("0x%x\n", policy);
936  hdr->logon_policy = policy;
937  return TRUE;
938  }
940  {
941  DWORD policy;
942 
943  if (buflen != sizeof(DWORD))
944  {
946  return FALSE;
947  }
948 
949  policy = *(DWORD *)buffer;
950  TRACE("0x%x\n", policy);
951  hdr->redirect_policy = policy;
952  return TRUE;
953  }
955  {
956  DWORD flags;
957 
958  if (buflen < sizeof(DWORD))
959  {
961  return FALSE;
962  }
963  flags = *(DWORD *)buffer;
964  TRACE("0x%x\n", flags);
969  {
971  return FALSE;
972  }
973  request->security_flags = flags;
974  return TRUE;
975  }
977  request->resolve_timeout = *(DWORD *)buffer;
978  return TRUE;
980  request->connect_timeout = *(DWORD *)buffer;
981  return TRUE;
983  request->send_timeout = *(DWORD *)buffer;
984  return TRUE;
986  request->recv_timeout = *(DWORD *)buffer;
987  return TRUE;
988 
990  {
991  connect_t *connect = request->connect;
992 
993  heap_free( connect->username );
994  if (!(connect->username = buffer_to_str( buffer, buflen ))) return FALSE;
995  return TRUE;
996  }
998  {
999  connect_t *connect = request->connect;
1000 
1001  heap_free( connect->password );
1002  if (!(connect->password = buffer_to_str( buffer, buflen ))) return FALSE;
1003  return TRUE;
1004  }
1006  {
1007  session_t *session = request->connect->session;
1008 
1009  heap_free( session->proxy_username );
1010  if (!(session->proxy_username = buffer_to_str( buffer, buflen ))) return FALSE;
1011  return TRUE;
1012  }
1014  {
1015  session_t *session = request->connect->session;
1016 
1017  heap_free( session->proxy_password );
1018  if (!(session->proxy_password = buffer_to_str( buffer, buflen ))) return FALSE;
1019  return TRUE;
1020  }
1022  if (!(hdr->flags & WINHTTP_FLAG_SECURE))
1023  {
1025  return FALSE;
1026  }
1027  FIXME("WINHTTP_OPTION_CLIENT_CERT_CONTEXT\n");
1028  return TRUE;
1029  default:
1030  FIXME("unimplemented option %u\n", option);
1032  return FALSE;
1033  }
1034 }
1035 
1037 {
1041 };
1042 
1043 static BOOL store_accept_types( request_t *request, const WCHAR **accept_types )
1044 {
1045  static const WCHAR attr_accept[] = {'A','c','c','e','p','t',0};
1047  const WCHAR **types = accept_types;
1048 
1049  if (!types) return TRUE;
1050  while (*types)
1051  {
1053  types++;
1054  }
1055  return TRUE;
1056 }
1057 
1058 /***********************************************************************
1059  * WinHttpOpenRequest (winhttp.@)
1060  */
1062  LPCWSTR referrer, LPCWSTR *types, DWORD flags )
1063 {
1064  request_t *request;
1065  connect_t *connect;
1066  HINTERNET hrequest = NULL;
1067 
1068  TRACE("%p, %s, %s, %s, %s, %p, 0x%08x\n", hconnect, debugstr_w(verb), debugstr_w(object),
1069  debugstr_w(version), debugstr_w(referrer), types, flags);
1070 
1071  if(types && TRACE_ON(winhttp)) {
1072  const WCHAR **iter;
1073 
1074  TRACE("accept types:\n");
1075  for(iter = types; *iter; iter++)
1076  TRACE(" %s\n", debugstr_w(*iter));
1077  }
1078 
1079  if (!(connect = (connect_t *)grab_object( hconnect )))
1080  {
1082  return NULL;
1083  }
1084  if (connect->hdr.type != WINHTTP_HANDLE_TYPE_CONNECT)
1085  {
1086  release_object( &connect->hdr );
1088  return NULL;
1089  }
1090  if (!(request = heap_alloc_zero( sizeof(request_t) )))
1091  {
1092  release_object( &connect->hdr );
1093  return NULL;
1094  }
1096  request->hdr.vtbl = &request_vtbl;
1097  request->hdr.refs = 1;
1098  request->hdr.flags = flags;
1099  request->hdr.callback = connect->hdr.callback;
1100  request->hdr.notify_mask = connect->hdr.notify_mask;
1101  request->hdr.context = connect->hdr.context;
1102  request->hdr.redirect_policy = connect->hdr.redirect_policy;
1103  list_init( &request->hdr.children );
1104  list_init( &request->task_queue );
1105 
1106  addref_object( &connect->hdr );
1107  request->connect = connect;
1108  list_add_head( &connect->hdr.children, &request->hdr.entry );
1109 
1110  request->resolve_timeout = connect->session->resolve_timeout;
1111  request->connect_timeout = connect->session->connect_timeout;
1112  request->send_timeout = connect->session->send_timeout;
1113  request->recv_timeout = connect->session->recv_timeout;
1114 
1115  if (!verb || !verb[0]) verb = getW;
1116  if (!(request->verb = strdupW( verb ))) goto end;
1117 
1118  if (object)
1119  {
1120  WCHAR *path, *p;
1121  unsigned int len;
1122 
1123  len = strlenW( object ) + 1;
1124  if (object[0] != '/') len++;
1125  if (!(p = path = heap_alloc( len * sizeof(WCHAR) ))) goto end;
1126 
1127  if (object[0] != '/') *p++ = '/';
1128  strcpyW( p, object );
1129  request->path = path;
1130  }
1131  else if (!(request->path = strdupW( slashW ))) goto end;
1132 
1133  if (!version || !version[0]) version = http1_1;
1134  if (!(request->version = strdupW( version ))) goto end;
1135  if (!(store_accept_types( request, types ))) goto end;
1136 
1137  if (!(hrequest = alloc_handle( &request->hdr ))) goto end;
1138  request->hdr.handle = hrequest;
1139 
1140  send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, &hrequest, sizeof(hrequest) );
1141 
1142 end:
1143  release_object( &request->hdr );
1144  release_object( &connect->hdr );
1145  TRACE("returning %p\n", hrequest);
1146  if (hrequest) set_last_error( ERROR_SUCCESS );
1147  return hrequest;
1148 }
1149 
1150 /***********************************************************************
1151  * WinHttpCloseHandle (winhttp.@)
1152  */
1154 {
1156 
1157  TRACE("%p\n", handle);
1158 
1159  if (!(hdr = grab_object( handle )))
1160  {
1162  return FALSE;
1163  }
1164  release_object( hdr );
1165  free_handle( handle );
1167  return TRUE;
1168 }
1169 
1171 {
1172  BOOL ret = FALSE;
1173 
1174  if (!buflen)
1175  {
1177  return FALSE;
1178  }
1179 
1180  switch (option)
1181  {
1183  {
1184  if (!buffer || *buflen < sizeof(DWORD_PTR))
1185  {
1186  *buflen = sizeof(DWORD_PTR);
1188  return FALSE;
1189  }
1190 
1191  *(DWORD_PTR *)buffer = hdr->context;
1192  *buflen = sizeof(DWORD_PTR);
1193  return TRUE;
1194  }
1195  default:
1196  if (hdr->vtbl->query_option) ret = hdr->vtbl->query_option( hdr, option, buffer, buflen );
1197  else
1198  {
1199  FIXME("unimplemented option %u\n", option);
1201  return FALSE;
1202  }
1203  break;
1204  }
1205  return ret;
1206 }
1207 
1208 /***********************************************************************
1209  * WinHttpQueryOption (winhttp.@)
1210  */
1212 {
1213  BOOL ret = FALSE;
1215 
1216  TRACE("%p, %u, %p, %p\n", handle, option, buffer, buflen);
1217 
1218  if (!(hdr = grab_object( handle )))
1219  {
1221  return FALSE;
1222  }
1223 
1224  ret = query_option( hdr, option, buffer, buflen );
1225 
1226  release_object( hdr );
1228  return ret;
1229 }
1230 
1232 {
1233  BOOL ret = TRUE;
1234 
1235  if (!buffer && buflen)
1236  {
1238  return FALSE;
1239  }
1240 
1241  switch (option)
1242  {
1244  {
1245  if (buflen != sizeof(DWORD_PTR))
1246  {
1248  return FALSE;
1249  }
1250 
1251  hdr->context = *(DWORD_PTR *)buffer;
1252  return TRUE;
1253  }
1254  default:
1255  if (hdr->vtbl->set_option) ret = hdr->vtbl->set_option( hdr, option, buffer, buflen );
1256  else
1257  {
1258  FIXME("unimplemented option %u\n", option);
1260  return FALSE;
1261  }
1262  break;
1263  }
1264  return ret;
1265 }
1266 
1267 /***********************************************************************
1268  * WinHttpSetOption (winhttp.@)
1269  */
1271 {
1272  BOOL ret = FALSE;
1274 
1275  TRACE("%p, %u, %p, %u\n", handle, option, buffer, buflen);
1276 
1277  if (!(hdr = grab_object( handle )))
1278  {
1280  return FALSE;
1281  }
1282 
1283  ret = set_option( hdr, option, buffer, buflen );
1284 
1285  release_object( hdr );
1287  return ret;
1288 }
1289 
1290 static char *get_computer_name( COMPUTER_NAME_FORMAT format )
1291 {
1292  char *ret;
1293  DWORD size = 0;
1294 
1296  if (GetLastError() != ERROR_MORE_DATA) return NULL;
1297  if (!(ret = heap_alloc( size ))) return NULL;
1298  if (!GetComputerNameExA( format, ret, &size ))
1299  {
1300  heap_free( ret );
1301  return NULL;
1302  }
1303  return ret;
1304 }
1305 
1306 static BOOL is_domain_suffix( const char *domain, const char *suffix )
1307 {
1308  int len_domain = strlen( domain ), len_suffix = strlen( suffix );
1309 
1310  if (len_suffix > len_domain) return FALSE;
1311  if (!strcasecmp( domain + len_domain - len_suffix, suffix )) return TRUE;
1312  return FALSE;
1313 }
1314 
1315 static int reverse_lookup( const struct addrinfo *ai, char *hostname, size_t len )
1316 {
1317  int ret = -1;
1318 #ifdef HAVE_GETNAMEINFO
1319  ret = getnameinfo( ai->ai_addr, ai->ai_addrlen, hostname, len, NULL, 0, 0 );
1320 #endif
1321  return ret;
1322 }
1323 
1324 static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai )
1325 {
1326  static const WCHAR httpW[] = {'h','t','t','p',':','/','/',0};
1327  static const WCHAR wpadW[] = {'/','w','p','a','d','.','d','a','t',0};
1328  char name[NI_MAXHOST];
1329  WCHAR *ret, *p;
1330  int len;
1331 
1332  while (ai && ai->ai_family != AF_INET && ai->ai_family != AF_INET6) ai = ai->ai_next;
1333  if (!ai) return NULL;
1334 
1335  if (!reverse_lookup( ai, name, sizeof(name) )) hostname = name;
1336 
1337  len = strlenW( httpW ) + strlen( hostname ) + strlenW( wpadW );
1338  if (!(ret = p = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) return NULL;
1339  strcpyW( p, httpW );
1340  p += strlenW( httpW );
1341  while (*hostname) { *p++ = *hostname++; }
1342  strcpyW( p, wpadW );
1343  return ret;
1344 }
1345 
1347 {
1348 #if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
1349  CFDictionaryRef settings = CFNetworkCopySystemProxySettings();
1350  const void *ref;
1351  BOOL ret = FALSE;
1352 
1353  if (!settings) return FALSE;
1354 
1355  if (!(ref = CFDictionaryGetValue( settings, kCFNetworkProxiesProxyAutoConfigURLString )))
1356  {
1357  CFRelease( settings );
1358  return FALSE;
1359  }
1360  if (CFStringGetCString( ref, buf, buflen, kCFStringEncodingASCII ))
1361  {
1362  TRACE( "returning %s\n", debugstr_a(buf) );
1363  ret = TRUE;
1364  }
1365  CFRelease( settings );
1366  return ret;
1367 #else
1368  static BOOL first = TRUE;
1369  if (first)
1370  {
1371  FIXME( "no support on this platform\n" );
1372  first = FALSE;
1373  }
1374  else
1375  TRACE( "no support on this platform\n" );
1376  return FALSE;
1377 #endif
1378 }
1379 
1380 #define INTERNET_MAX_URL_LENGTH 2084
1381 
1382 /***********************************************************************
1383  * WinHttpDetectAutoProxyConfigUrl (winhttp.@)
1384  */
1386 {
1387  BOOL ret = FALSE;
1388  char system_url[INTERNET_MAX_URL_LENGTH + 1];
1389 
1390  TRACE("0x%08x, %p\n", flags, url);
1391 
1392  if (!flags || !url)
1393  {
1395  return FALSE;
1396  }
1397  if (get_system_proxy_autoconfig_url( system_url, sizeof(system_url) ))
1398  {
1399  WCHAR *urlW;
1400 
1401  if (!(urlW = strdupAW( system_url ))) return FALSE;
1402  *url = urlW;
1404  return TRUE;
1405  }
1407  {
1408  static int fixme_shown;
1409  if (!fixme_shown++) FIXME("discovery via DHCP not supported\n");
1410  }
1412  {
1413 #ifdef HAVE_GETADDRINFO
1414  char *fqdn, *domain, *p;
1415 
1416  if (!(fqdn = get_computer_name( ComputerNamePhysicalDnsFullyQualified ))) return FALSE;
1417  if (!(domain = get_computer_name( ComputerNamePhysicalDnsDomain )))
1418  {
1419  heap_free( fqdn );
1420  return FALSE;
1421  }
1422  p = fqdn;
1423  while ((p = strchr( p, '.' )) && is_domain_suffix( p + 1, domain ))
1424  {
1425  struct addrinfo *ai;
1426  char *name;
1427  int res;
1428 
1429  if (!(name = heap_alloc( sizeof("wpad") + strlen(p) )))
1430  {
1431  heap_free( fqdn );
1432  heap_free( domain );
1433  return FALSE;
1434  }
1435  strcpy( name, "wpad" );
1436  strcat( name, p );
1437  res = getaddrinfo( name, NULL, NULL, &ai );
1438  if (!res)
1439  {
1440  *url = build_wpad_url( name, ai );
1441  freeaddrinfo( ai );
1442  if (*url)
1443  {
1444  TRACE("returning %s\n", debugstr_w(*url));
1445  heap_free( name );
1446  ret = TRUE;
1447  break;
1448  }
1449  }
1450  heap_free( name );
1451  p++;
1452  }
1453  heap_free( domain );
1454  heap_free( fqdn );
1455 #else
1456  FIXME("getaddrinfo not found at build time\n");
1457 #endif
1458  }
1459  if (!ret)
1460  {
1462  *url = NULL;
1463  }
1464  else set_last_error( ERROR_SUCCESS );
1465  return ret;
1466 }
1467 
1468 static const WCHAR Connections[] = {
1469  'S','o','f','t','w','a','r','e','\\',
1470  'M','i','c','r','o','s','o','f','t','\\',
1471  'W','i','n','d','o','w','s','\\',
1472  'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
1473  'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s','\\',
1474  'C','o','n','n','e','c','t','i','o','n','s',0 };
1475 static const WCHAR WinHttpSettings[] = {
1476  'W','i','n','H','t','t','p','S','e','t','t','i','n','g','s',0 };
1477 static const DWORD WINHTTP_SETTINGS_MAGIC = 0x18;
1478 static const DWORD WININET_SETTINGS_MAGIC = 0x46;
1479 static const DWORD PROXY_TYPE_DIRECT = 1;
1480 static const DWORD PROXY_TYPE_PROXY = 2;
1481 static const DWORD PROXY_USE_PAC_SCRIPT = 4;
1483 
1485 {
1487  DWORD unknown; /* always zero? */
1488  DWORD flags; /* one or more of PROXY_* */
1489 };
1490 
1491 static inline void copy_char_to_wchar_sz(const BYTE *src, DWORD len, WCHAR *dst)
1492 {
1493  const BYTE *begin;
1494 
1495  for (begin = src; src - begin < len; src++, dst++)
1496  *dst = *src;
1497  *dst = 0;
1498 }
1499 
1500 /***********************************************************************
1501  * WinHttpGetDefaultProxyConfiguration (winhttp.@)
1502  */
1504 {
1505  LONG l;
1506  HKEY key;
1507  BOOL got_from_reg = FALSE, direct = TRUE;
1508  char *envproxy;
1509 
1510  TRACE("%p\n", info);
1511 
1513  if (!l)
1514  {
1515  DWORD type, size = 0;
1516 
1518  if (!l && type == REG_BINARY &&
1519  size >= sizeof(struct connection_settings_header) + 2 * sizeof(DWORD))
1520  {
1521  BYTE *buf = heap_alloc( size );
1522 
1523  if (buf)
1524  {
1526  (struct connection_settings_header *)buf;
1527  DWORD *len = (DWORD *)(hdr + 1);
1528 
1530  &size );
1531  if (!l && hdr->magic == WINHTTP_SETTINGS_MAGIC &&
1532  hdr->unknown == 0)
1533  {
1534  if (hdr->flags & PROXY_TYPE_PROXY)
1535  {
1536  BOOL sane = FALSE;
1537  LPWSTR proxy = NULL;
1538  LPWSTR proxy_bypass = NULL;
1539 
1540  /* Sanity-check length of proxy string */
1541  if ((BYTE *)len - buf + *len <= size)
1542  {
1543  sane = TRUE;
1544  proxy = GlobalAlloc( 0, (*len + 1) * sizeof(WCHAR) );
1545  if (proxy)
1546  copy_char_to_wchar_sz( (BYTE *)(len + 1), *len, proxy );
1547  len = (DWORD *)((BYTE *)(len + 1) + *len);
1548  }
1549  if (sane)
1550  {
1551  /* Sanity-check length of proxy bypass string */
1552  if ((BYTE *)len - buf + *len <= size)
1553  {
1554  proxy_bypass = GlobalAlloc( 0, (*len + 1) * sizeof(WCHAR) );
1555  if (proxy_bypass)
1556  copy_char_to_wchar_sz( (BYTE *)(len + 1), *len, proxy_bypass );
1557  }
1558  else
1559  {
1560  sane = FALSE;
1561  GlobalFree( proxy );
1562  proxy = NULL;
1563  }
1564  }
1565  info->lpszProxy = proxy;
1566  info->lpszProxyBypass = proxy_bypass;
1567  if (sane)
1568  {
1569  got_from_reg = TRUE;
1570  direct = FALSE;
1571  info->dwAccessType =
1573  TRACE("http proxy (from registry) = %s, bypass = %s\n",
1574  debugstr_w(info->lpszProxy),
1575  debugstr_w(info->lpszProxyBypass));
1576  }
1577  }
1578  }
1579  heap_free( buf );
1580  }
1581  }
1582  RegCloseKey( key );
1583  }
1584  if (!got_from_reg && (envproxy = getenv( "http_proxy" )))
1585  {
1586  char *colon, *http_proxy = NULL;
1587 
1588  if (!(colon = strchr( envproxy, ':' ))) http_proxy = envproxy;
1589  else
1590  {
1591  if (*(colon + 1) == '/' && *(colon + 2) == '/')
1592  {
1593  /* It's a scheme, check that it's http */
1594  if (!strncmp( envproxy, "http://", 7 )) http_proxy = envproxy + 7;
1595  else WARN("unsupported scheme in $http_proxy: %s\n", envproxy);
1596  }
1597  else http_proxy = envproxy;
1598  }
1599 
1600  if (http_proxy && http_proxy[0])
1601  {
1602  WCHAR *http_proxyW;
1603  int len;
1604 
1605  len = MultiByteToWideChar( CP_UNIXCP, 0, http_proxy, -1, NULL, 0 );
1606  if ((http_proxyW = GlobalAlloc( 0, len * sizeof(WCHAR))))
1607  {
1608  MultiByteToWideChar( CP_UNIXCP, 0, http_proxy, -1, http_proxyW, len );
1609  direct = FALSE;
1610  info->dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
1611  info->lpszProxy = http_proxyW;
1612  info->lpszProxyBypass = NULL;
1613  TRACE("http proxy (from environment) = %s\n", debugstr_w(info->lpszProxy));
1614  }
1615  }
1616  }
1617  if (direct)
1618  {
1619  info->dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY;
1620  info->lpszProxy = NULL;
1621  info->lpszProxyBypass = NULL;
1622  }
1624  return TRUE;
1625 }
1626 
1627 /***********************************************************************
1628  * WinHttpGetIEProxyConfigForCurrentUser (winhttp.@)
1629  */
1631 {
1632  static const WCHAR settingsW[] =
1633  {'D','e','f','a','u','l','t','C','o','n','n','e','c','t','i','o','n','S','e','t','t','i','n','g','s',0};
1634  HKEY hkey = NULL;
1636  DWORD type, offset, len, size = 0;
1637  BOOL ret = FALSE;
1638 
1639  TRACE("%p\n", config);
1640 
1641  if (!config)
1642  {
1644  return FALSE;
1645  }
1646  memset( config, 0, sizeof(*config) );
1647  config->fAutoDetect = TRUE;
1648 
1649  if (RegOpenKeyExW( HKEY_CURRENT_USER, Connections, 0, KEY_READ, &hkey ) ||
1650  RegQueryValueExW( hkey, settingsW, NULL, &type, NULL, &size ) ||
1651  type != REG_BINARY || size < sizeof(struct connection_settings_header))
1652  {
1653  ret = TRUE;
1654  goto done;
1655  }
1656  if (!(hdr = heap_alloc( size ))) goto done;
1657  if (RegQueryValueExW( hkey, settingsW, NULL, &type, (BYTE *)hdr, &size ) ||
1658  hdr->magic != WININET_SETTINGS_MAGIC)
1659  {
1660  ret = TRUE;
1661  goto done;
1662  }
1663 
1664  config->fAutoDetect = (hdr->flags & PROXY_AUTODETECT_SETTINGS) != 0;
1665  offset = sizeof(*hdr);
1666  if (offset + sizeof(DWORD) > size) goto done;
1667  len = *(DWORD *)((char *)hdr + offset);
1668  offset += sizeof(DWORD);
1669  if (len && hdr->flags & PROXY_TYPE_PROXY)
1670  {
1671  if (!(config->lpszProxy = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) goto done;
1672  copy_char_to_wchar_sz( (const BYTE *)hdr + offset , len, config->lpszProxy );
1673  }
1674  offset += len;
1675  if (offset + sizeof(DWORD) > size) goto done;
1676  len = *(DWORD *)((char *)hdr + offset);
1677  offset += sizeof(DWORD);
1678  if (len && (hdr->flags & PROXY_TYPE_PROXY))
1679  {
1680  if (!(config->lpszProxyBypass = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) goto done;
1681  copy_char_to_wchar_sz( (const BYTE *)hdr + offset , len, config->lpszProxyBypass );
1682  }
1683  offset += len;
1684  if (offset + sizeof(DWORD) > size) goto done;
1685  len = *(DWORD *)((char *)hdr + offset);
1686  offset += sizeof(DWORD);
1687  if (len && (hdr->flags & PROXY_USE_PAC_SCRIPT))
1688  {
1689  if (!(config->lpszAutoConfigUrl = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) goto done;
1690  copy_char_to_wchar_sz( (const BYTE *)hdr + offset , len, config->lpszAutoConfigUrl );
1691  }
1692  ret = TRUE;
1693 
1694 done:
1695  RegCloseKey( hkey );
1696  heap_free( hdr );
1697  if (!ret)
1698  {
1699  GlobalFree( config->lpszAutoConfigUrl );
1700  config->lpszAutoConfigUrl = NULL;
1701  GlobalFree( config->lpszProxy );
1702  config->lpszProxy = NULL;
1703  GlobalFree( config->lpszProxyBypass );
1704  config->lpszProxyBypass = NULL;
1705  }
1706  else set_last_error( ERROR_SUCCESS );
1707  return ret;
1708 }
1709 
1711 {
1712  const char *p;
1713  WCHAR *q;
1714  int len;
1715 
1716  info->dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY;
1717  info->lpszProxy = NULL;
1718  info->lpszProxyBypass = NULL;
1719 
1720  TRACE("%s\n", debugstr_a( result ));
1721 
1722  p = result;
1723  while (*p == ' ') p++;
1724  len = strlen( p );
1725  if (len >= 5 && !strncasecmp( p, "PROXY", sizeof("PROXY") - 1 ))
1726  {
1727  p += 5;
1728  while (*p == ' ') p++;
1729  if (!*p || *p == ';') return TRUE;
1730  if (!(info->lpszProxy = q = strdupAW( p ))) return FALSE;
1731  info->dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
1732  for (; *q; q++)
1733  {
1734  if (*q == ' ' || *q == ';')
1735  {
1736  *q = 0;
1737  break;
1738  }
1739  }
1740  }
1741  return TRUE;
1742 }
1743 
1744 static char *download_script( const WCHAR *url, DWORD *out_size )
1745 {
1746  static const WCHAR typeW[] = {'*','/','*',0};
1747  static const WCHAR *acceptW[] = {typeW, NULL};
1748  HINTERNET ses, con = NULL, req = NULL;
1749  WCHAR *hostname;
1750  URL_COMPONENTSW uc;
1751  DWORD status, size = sizeof(status), offset, to_read, bytes_read, flags = 0;
1752  char *tmp, *buffer = NULL;
1753 
1754  *out_size = 0;
1755 
1756  memset( &uc, 0, sizeof(uc) );
1757  uc.dwStructSize = sizeof(uc);
1758  uc.dwHostNameLength = -1;
1759  uc.dwUrlPathLength = -1;
1760  if (!WinHttpCrackUrl( url, 0, 0, &uc )) return NULL;
1761  if (!(hostname = heap_alloc( (uc.dwHostNameLength + 1) * sizeof(WCHAR) ))) return NULL;
1762  memcpy( hostname, uc.lpszHostName, uc.dwHostNameLength * sizeof(WCHAR) );
1763  hostname[uc.dwHostNameLength] = 0;
1764 
1765  if (!(ses = WinHttpOpen( NULL, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ))) goto done;
1766  if (!(con = WinHttpConnect( ses, hostname, uc.nPort, 0 ))) goto done;
1768  if (!(req = WinHttpOpenRequest( con, NULL, uc.lpszUrlPath, NULL, NULL, acceptW, flags ))) goto done;
1769  if (!WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 )) goto done;
1770 
1771  if (!(WinHttpReceiveResponse( req, 0 ))) goto done;
1773  &size, NULL ) || status != HTTP_STATUS_OK) goto done;
1774 
1775  size = 4096;
1776  if (!(buffer = heap_alloc( size ))) goto done;
1777  to_read = size;
1778  offset = 0;
1779  for (;;)
1780  {
1781  if (!WinHttpReadData( req, buffer + offset, to_read, &bytes_read )) goto done;
1782  if (!bytes_read) break;
1783  to_read -= bytes_read;
1784  offset += bytes_read;
1785  *out_size += bytes_read;
1786  if (!to_read)
1787  {
1788  to_read = size;
1789  size *= 2;
1790  if (!(tmp = heap_realloc( buffer, size ))) goto done;
1791  buffer = tmp;
1792  }
1793  }
1794 
1795 done:
1796  WinHttpCloseHandle( req );
1797  WinHttpCloseHandle( con );
1798  WinHttpCloseHandle( ses );
1799  heap_free( hostname );
1801  return buffer;
1802 }
1803 
1805 {
1809 };
1810 
1814 
1816 {
1817  BOOL ret;
1818  char *result, *urlA;
1819  DWORD len_result;
1821  URL_COMPONENTSW uc;
1822 
1823  buffer.dwStructSize = sizeof(buffer);
1824  buffer.lpszScriptBuffer = script;
1825  buffer.dwScriptBufferSize = size;
1826 
1827  if (!(urlA = strdupWA( url ))) return FALSE;
1829  {
1830  heap_free( urlA );
1831  return FALSE;
1832  }
1833 
1834  memset( &uc, 0, sizeof(uc) );
1835  uc.dwStructSize = sizeof(uc);
1836  uc.dwHostNameLength = -1;
1837 
1838  if (WinHttpCrackUrl( url, 0, 0, &uc ))
1839  {
1840  char *hostnameA = strdupWA_sized( uc.lpszHostName, uc.dwHostNameLength );
1841 
1842  if ((ret = InternetGetProxyInfo( urlA, strlen(urlA),
1843  hostnameA, strlen(hostnameA), &result, &len_result )))
1844  {
1846  heap_free( result );
1847  }
1848 
1849  heap_free( hostnameA );
1850  }
1851  heap_free( urlA );
1853 }
1854 
1855 /***********************************************************************
1856  * WinHttpGetProxyForUrl (winhttp.@)
1857  */
1860 {
1861  WCHAR *detected_pac_url = NULL;
1862  const WCHAR *pac_url;
1863  session_t *session;
1864  char *script;
1865  DWORD size;
1866  BOOL ret = FALSE;
1867 
1868  TRACE("%p, %s, %p, %p\n", hsession, debugstr_w(url), options, info);
1869 
1870  if (!(session = (session_t *)grab_object( hsession )))
1871  {
1873  return FALSE;
1874  }
1875  if (session->hdr.type != WINHTTP_HANDLE_TYPE_SESSION)
1876  {
1877  release_object( &session->hdr );
1879  return FALSE;
1880  }
1881  if (!url || !options || !info ||
1883  ((options->dwFlags & WINHTTP_AUTOPROXY_AUTO_DETECT) && !options->dwAutoDetectFlags) ||
1884  ((options->dwFlags & WINHTTP_AUTOPROXY_AUTO_DETECT) &&
1885  (options->dwFlags & WINHTTP_AUTOPROXY_CONFIG_URL)))
1886  {
1887  release_object( &session->hdr );
1889  return FALSE;
1890  }
1891  if (options->dwFlags & WINHTTP_AUTOPROXY_AUTO_DETECT &&
1892  !WinHttpDetectAutoProxyConfigUrl( options->dwAutoDetectFlags, &detected_pac_url ))
1893  goto done;
1894 
1895  if (options->dwFlags & WINHTTP_AUTOPROXY_CONFIG_URL) pac_url = options->lpszAutoConfigUrl;
1896  else pac_url = detected_pac_url;
1897 
1898  if ((script = download_script( pac_url, &size )))
1899  {
1900  ret = run_script( script, size, url, info );
1901  heap_free( script );
1902  }
1903 
1904 done:
1905  GlobalFree( detected_pac_url );
1906  release_object( &session->hdr );
1908  return ret;
1909 }
1910 
1911 /***********************************************************************
1912  * WinHttpSetDefaultProxyConfiguration (winhttp.@)
1913  */
1915 {
1916  LONG l;
1917  HKEY key;
1918  BOOL ret = FALSE;
1919  const WCHAR *src;
1920 
1921  TRACE("%p\n", info);
1922 
1923  if (!info)
1924  {
1926  return FALSE;
1927  }
1928  switch (info->dwAccessType)
1929  {
1931  break;
1933  if (!info->lpszProxy)
1934  {
1936  return FALSE;
1937  }
1938  /* Only ASCII characters are allowed */
1939  for (src = info->lpszProxy; *src; src++)
1940  if (*src > 0x7f)
1941  {
1943  return FALSE;
1944  }
1945  if (info->lpszProxyBypass)
1946  {
1947  for (src = info->lpszProxyBypass; *src; src++)
1948  if (*src > 0x7f)
1949  {
1951  return FALSE;
1952  }
1953  }
1954  break;
1955  default:
1957  return FALSE;
1958  }
1959 
1961  KEY_WRITE, NULL, &key, NULL );
1962  if (!l)
1963  {
1964  DWORD size = sizeof(struct connection_settings_header) + 2 * sizeof(DWORD);
1965  BYTE *buf;
1966 
1967  if (info->dwAccessType == WINHTTP_ACCESS_TYPE_NAMED_PROXY)
1968  {
1969  size += strlenW( info->lpszProxy );
1970  if (info->lpszProxyBypass)
1971  size += strlenW( info->lpszProxyBypass );
1972  }
1973  buf = heap_alloc( size );
1974  if (buf)
1975  {
1977  (struct connection_settings_header *)buf;
1978  DWORD *len = (DWORD *)(hdr + 1);
1979 
1980  hdr->magic = WINHTTP_SETTINGS_MAGIC;
1981  hdr->unknown = 0;
1982  if (info->dwAccessType == WINHTTP_ACCESS_TYPE_NAMED_PROXY)
1983  {
1984  BYTE *dst;
1985 
1986  hdr->flags = PROXY_TYPE_PROXY;
1987  *len++ = strlenW( info->lpszProxy );
1988  for (dst = (BYTE *)len, src = info->lpszProxy; *src;
1989  src++, dst++)
1990  *dst = *src;
1991  len = (DWORD *)dst;
1992  if (info->lpszProxyBypass)
1993  {
1994  *len++ = strlenW( info->lpszProxyBypass );
1995  for (dst = (BYTE *)len, src = info->lpszProxyBypass; *src;
1996  src++, dst++)
1997  *dst = *src;
1998  }
1999  else
2000  *len++ = 0;
2001  }
2002  else
2003  {
2004  hdr->flags = PROXY_TYPE_DIRECT;
2005  *len++ = 0;
2006  *len++ = 0;
2007  }
2009  if (!l)
2010  ret = TRUE;
2011  heap_free( buf );
2012  }
2013  RegCloseKey( key );
2014  }
2016  return ret;
2017 }
2018 
2019 /***********************************************************************
2020  * WinHttpSetStatusCallback (winhttp.@)
2021  */
2024 {
2027 
2028  TRACE("%p, %p, 0x%08x, 0x%lx\n", handle, callback, flags, reserved);
2029 
2030  if (!(hdr = grab_object( handle )))
2031  {
2034  }
2035  ret = hdr->callback;
2036  hdr->callback = callback;
2037  hdr->notify_mask = flags;
2038 
2039  release_object( hdr );
2041  return ret;
2042 }
2043 
2044 /***********************************************************************
2045  * WinHttpSetTimeouts (winhttp.@)
2046  */
2047 BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int send, int receive )
2048 {
2049  BOOL ret = TRUE;
2051  request_t *request;
2052  session_t *session;
2053 
2054  TRACE("%p, %d, %d, %d, %d\n", handle, resolve, connect, send, receive);
2055 
2056  if (resolve < -1 || connect < -1 || send < -1 || receive < -1)
2057  {
2059  return FALSE;
2060  }
2061 
2062  if (!(hdr = grab_object( handle )))
2063  {
2065  return FALSE;
2066  }
2067 
2068  switch(hdr->type)
2069  {
2071  request = (request_t *)hdr;
2072  request->connect_timeout = connect;
2073 
2074  if (resolve < 0) resolve = 0;
2075  request->resolve_timeout = resolve;
2076 
2077  if (send < 0) send = 0;
2078  request->send_timeout = send;
2079 
2080  if (receive < 0) receive = 0;
2081  request->recv_timeout = receive;
2082 
2083  if (request->netconn)
2084  {
2085  if (netconn_set_timeout( request->netconn, TRUE, send )) ret = FALSE;
2086  if (netconn_set_timeout( request->netconn, FALSE, receive )) ret = FALSE;
2087  }
2088  break;
2089 
2091  session = (session_t *)hdr;
2092  session->connect_timeout = connect;
2093 
2094  if (resolve < 0) resolve = 0;
2095  session->resolve_timeout = resolve;
2096 
2097  if (send < 0) send = 0;
2098  session->send_timeout = send;
2099 
2100  if (receive < 0) receive = 0;
2101  session->recv_timeout = receive;
2102  break;
2103 
2104  default:
2106  ret = FALSE;
2107  }
2108  release_object( hdr );
2110  return ret;
2111 }
2112 
2113 static const WCHAR wkday[7][4] =
2114  {{'S','u','n', 0}, {'M','o','n', 0}, {'T','u','e', 0}, {'W','e','d', 0},
2115  {'T','h','u', 0}, {'F','r','i', 0}, {'S','a','t', 0}};
2116 static const WCHAR month[12][4] =
2117  {{'J','a','n', 0}, {'F','e','b', 0}, {'M','a','r', 0}, {'A','p','r', 0},
2118  {'M','a','y', 0}, {'J','u','n', 0}, {'J','u','l', 0}, {'A','u','g', 0},
2119  {'S','e','p', 0}, {'O','c','t', 0}, {'N','o','v', 0}, {'D','e','c', 0}};
2120 
2121 /***********************************************************************
2122  * WinHttpTimeFromSystemTime (WININET.@)
2123  */
2125 {
2126  static const WCHAR format[] =
2127  {'%','s',',',' ','%','0','2','d',' ','%','s',' ','%','4','d',' ','%','0',
2128  '2','d',':','%','0','2','d',':','%','0','2','d',' ','G','M','T', 0};
2129 
2130  TRACE("%p, %p\n", time, string);
2131 
2132  if (!time || !string)
2133  {
2135  return FALSE;
2136  }
2137 
2138  sprintfW( string, format,
2139  wkday[time->wDayOfWeek],
2140  time->wDay,
2141  month[time->wMonth - 1],
2142  time->wYear,
2143  time->wHour,
2144  time->wMinute,
2145  time->wSecond );
2146 
2148  return TRUE;
2149 }
2150 
2151 /***********************************************************************
2152  * WinHttpTimeToSystemTime (WININET.@)
2153  */
2155 {
2156  unsigned int i;
2157  const WCHAR *s = string;
2158  WCHAR *end;
2159 
2160  TRACE("%s, %p\n", debugstr_w(string), time);
2161 
2162  if (!string || !time)
2163  {
2165  return FALSE;
2166  }
2167 
2168  /* Windows does this too */
2169  GetSystemTime( time );
2170 
2171  /* Convert an RFC1123 time such as 'Fri, 07 Jan 2005 12:06:35 GMT' into
2172  * a SYSTEMTIME structure.
2173  */
2174 
2176 
2177  while (*s && !isalphaW( *s )) s++;
2178  if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE;
2179  time->wDayOfWeek = 7;
2180 
2181  for (i = 0; i < 7; i++)
2182  {
2183  if (toupperW( wkday[i][0] ) == toupperW( s[0] ) &&
2184  toupperW( wkday[i][1] ) == toupperW( s[1] ) &&
2185  toupperW( wkday[i][2] ) == toupperW( s[2] ) )
2186  {
2187  time->wDayOfWeek = i;
2188  break;
2189  }
2190  }
2191 
2192  if (time->wDayOfWeek > 6) return TRUE;
2193  while (*s && !isdigitW( *s )) s++;
2194  time->wDay = strtolW( s, &end, 10 );
2195  s = end;
2196 
2197  while (*s && !isalphaW( *s )) s++;
2198  if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE;
2199  time->wMonth = 0;
2200 
2201  for (i = 0; i < 12; i++)
2202  {
2203  if (toupperW( month[i][0]) == toupperW( s[0] ) &&
2204  toupperW( month[i][1]) == toupperW( s[1] ) &&
2205  toupperW( month[i][2]) == toupperW( s[2] ) )
2206  {
2207  time->wMonth = i + 1;
2208  break;
2209  }
2210  }
2211  if (time->wMonth == 0) return TRUE;
2212 
2213  while (*s && !isdigitW( *s )) s++;
2214  if (*s == '\0') return TRUE;
2215  time->wYear = strtolW( s, &end, 10 );
2216  s = end;
2217 
2218  while (*s && !isdigitW( *s )) s++;
2219  if (*s == '\0') return TRUE;
2220  time->wHour = strtolW( s, &end, 10 );
2221  s = end;
2222 
2223  while (*s && !isdigitW( *s )) s++;
2224  if (*s == '\0') return TRUE;
2225  time->wMinute = strtolW( s, &end, 10 );
2226  s = end;
2227 
2228  while (*s && !isdigitW( *s )) s++;
2229  if (*s == '\0') return TRUE;
2230  time->wSecond = strtolW( s, &end, 10 );
2231 
2232  time->wMilliseconds = 0;
2233  return TRUE;
2234 }
HINTERNET WINAPI WinHttpConnect(HINTERNET hsession, LPCWSTR server, INTERNET_PORT port, DWORD reserved)
Definition: session.c:524
VOID(CALLBACK * WINHTTP_STATUS_CALLBACK)(_In_ HINTERNET, _In_ DWORD_PTR, _In_ DWORD, _In_ LPVOID, _In_ DWORD)
Definition: winhttp.h:520
#define WINHTTP_ACCESS_TYPE_NAMED_PROXY
Definition: winhttp.h:64
#define WINHTTP_INVALID_STATUS_CALLBACK
Definition: winhttp.h:422
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
struct mke2fs_defaults settings[]
#define WINHTTP_HANDLE_TYPE_REQUEST
Definition: winhttp.h:432
#define WINHTTP_OPTION_PROXY_PASSWORD
Definition: winhttp.h:148
#define WINHTTP_OPTION_CLIENT_CERT_CONTEXT
Definition: winhttp.h:113
BOOL WINAPI WinHttpQueryOption(HINTERNET handle, DWORD option, LPVOID buffer, LPDWORD buflen)
Definition: session.c:1211
#define WINHTTP_OPTION_RECEIVE_TIMEOUT
Definition: winhttp.h:99
#define SECURITY_FLAG_STRENGTH_MEDIUM
Definition: winhttp.h:287
LPVOID HINTERNET
Definition: winhttp.h:32
#define WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP
Definition: winhttp.h:158
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
Definition: list.h:192
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
int proxy
Definition: main.c:67
#define TRUE
Definition: types.h:120
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID ULONG out_size
Definition: file.c:100
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define CloseHandle
Definition: compat.h:398
#define SECURITY_FLAG_IGNORE_UNKNOWN_CA
Definition: winhttp.h:281
char hdr[14]
Definition: iptest.cpp:33
#define SECURITY_FLAG_STRENGTH_STRONG
Definition: winhttp.h:288
BOOL WINAPI WinHttpCloseHandle(HINTERNET handle)
Definition: session.c:1153
Definition: dir.h:83
ULONG sin6_flowinfo
Definition: ws2ipdef.h:181
static BOOL alloc_handle(struct handle_table *lpTable, OBJECTHDR *lpObject, HCRYPTKEY *lpHandle)
Definition: handle.c:183
static rfbScreenInfoPtr server
Definition: vnc.c:74
u_short sin_port
Definition: winsock.h:511
#define freeaddrinfo
Definition: wspiapi.h:46
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
#define DWORD_PTR
Definition: treelist.c:76
ADDRESS_FAMILY sin6_family
Definition: ws2ipdef.h:179
#define WINHTTP_OPTION_PASSWORD
Definition: winhttp.h:146
static void request_destroy(object_header_t *hdr)
Definition: session.c:587
#define error(str)
Definition: mkdosfs.c:1605
#define WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT
Definition: winhttp.h:107
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define strcasecmp
Definition: fake.h:9
Definition: image.c:133
#define WINHTTP_ACCESS_TYPE_NO_PROXY
Definition: winhttp.h:63
DWORD dwStructSize
Definition: wininet.h:211
USHORT sin6_port
Definition: ws2ipdef.h:180
#define WINHTTP_ADDREQ_FLAG_ADD
Definition: winhttp.h:84
#define WINHTTP_OPTION_SEND_TIMEOUT
Definition: winhttp.h:98
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define REG_BINARY
Definition: nt_native.h:1496
#define KEY_READ
Definition: nt_native.h:1023
GLsizei const GLchar ** path
Definition: glext.h:7234
DWORD WINAPI CertNameToStrW(DWORD dwCertEncodingType, PCERT_NAME_BLOB pName, DWORD dwStrType, LPWSTR psz, DWORD csz)
Definition: str.c:702
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define WINHTTP_OPTION_SECURE_PROTOCOLS
Definition: winhttp.h:127
#define WINHTTP_OPTION_PROXY
Definition: winhttp.h:110
static const WCHAR Connections[]
Definition: session.c:1468
#define HKEY_CURRENT_USER
Definition: winreg.h:11
BOOL WINAPI CertFreeCertificateContext(PCCERT_CONTEXT pCertContext)
Definition: cert.c:371
#define WINHTTP_AUTO_DETECT_TYPE_DHCP
Definition: winhttp.h:527
const GLint * first
Definition: glext.h:5794
#define WARN(fmt,...)
Definition: debug.h:111
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define strtolW(s, e, b)
Definition: unicode.h:33
GLintptr offset
Definition: glext.h:5920
static WCHAR * strdupAW(const char *src, int len)
Definition: main.c:96
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
BOOL cred_handle_initialized
struct list children
static WCHAR * buffer_to_str(WCHAR *buffer, DWORD buflen)
Definition: session.c:883
static const WCHAR typeW[]
Definition: name.c:49
WINE_DEFAULT_DEBUG_CHANNEL(urlmon)
#define WINHTTP_QUERY_STATUS_CODE
Definition: winhttp.h:317
static BOOL store_accept_types(request_t *request, const WCHAR **accept_types)
Definition: session.c:1043
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential)
Definition: wrapper.c:151
#define WINHTTP_OPTION_PROXY_USERNAME
Definition: winhttp.h:147
#define ERROR_WINHTTP_AUTODETECTION_FAILED
Definition: winhttp.h:228
WINHTTP_STATUS_CALLBACK callback
#define WINHTTP_OPTION_USERNAME
Definition: winhttp.h:145
GLuint GLuint end
Definition: gl.h:1545
BOOL WINAPI GetComputerNameExA(COMPUTER_NAME_FORMAT, LPSTR, LPDWORD)
Definition: compname.c:370
#define SECURITY_FLAG_IGNORE_CERT_CN_INVALID
Definition: winhttp.h:283
__u16 time
Definition: mkdosfs.c:366
static const WCHAR wkday[7][4]
Definition: session.c:2113
static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
Definition: session.c:374
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
#define WINHTTP_OPTION_PARENT_HANDLE
Definition: winhttp.h:104
#define WINHTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA
Definition: winhttp.h:85
char * LPSTR
Definition: xmlstorage.h:182
static WCHAR * build_wpad_url(const char *hostname, const struct addrinfo *ai)
Definition: session.c:1324
LPWSTR lpszHostName
Definition: wininet.h:215
#define WINHTTP_OPTION_SERVER_CERT_CONTEXT
Definition: winhttp.h:121
ULONG sin6_scope_id
Definition: ws2ipdef.h:184
static const DWORD WININET_SETTINGS_MAGIC
Definition: session.c:1478
INT WSAAPI connect(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: sockctrl.c:23
static BOOL query_option(object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen)
Definition: session.c:1170
#define DWORD
Definition: nt_native.h:44
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
Definition: send.c:47
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define WINHTTP_AUTOPROXY_AUTO_DETECT
Definition: winhttp.h:530
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
#define WINHTTP_OPTION_MAX_CONNS_PER_SERVER
Definition: winhttp.h:118
DWORD secure_protocols
struct _test_info info[]
Definition: SetCursorPos.c:19
char * hostname
Definition: ftp.c:88
WORD INTERNET_PORT
Definition: winhttp.h:38
void send_callback(object_header_t *hdr, DWORD status, LPVOID info, DWORD buflen)
Definition: session.c:71
static struct list oidInfo
Definition: oid.c:1206
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LPWSTR proxy_password
BOOL WINAPI WinHttpQueryHeaders(HINTERNET hrequest, DWORD level, LPCWSTR name, LPVOID buffer, LPDWORD buflen, LPDWORD index)
Definition: request.c:831
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
object_header_t hdr
BOOL WINAPI WinHttpTimeToSystemTime(LPCWSTR string, SYSTEMTIME *time)
Definition: session.c:2154
#define WINHTTP_ACCESS_TYPE_DEFAULT_PROXY
Definition: winhttp.h:62
BOOL WINAPI InternetDeInitializeAutoProxyDll(LPSTR, DWORD)
Definition: main.c:131
INTERNET_PORT nPort
Definition: wininet.h:217
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static WCHAR * blob_to_str(DWORD encoding, CERT_NAME_BLOB *blob)
Definition: session.c:643
BOOL set_server_for_hostname(connect_t *connect, LPCWSTR server, INTERNET_PORT port)
Definition: session.c:459
#define debugstr_w
Definition: kernel32.h:32
BOOL WINAPI WinHttpReceiveResponse(HINTERNET hrequest, LPVOID reserved)
Definition: request.c:2692
GLenum GLint ref
Definition: glext.h:6028
const void * netconn_get_certificate(netconn_t *conn)
Definition: net.c:928
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
r reserved
Definition: btrfs.c:2893
const WCHAR * str
char path[256]
Definition: tftpd.h:94
#define strncasecmp
Definition: fake.h:10
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:64
Definition: getopt.h:108
#define AF_INET6
Definition: winsock.h:369
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1380
#define WINHTTP_OPTION_REDIRECT_POLICY
Definition: winhttp.h:131
script
Definition: msipriv.h:374
#define ERROR_WINHTTP_INCORRECT_HANDLE_TYPE
Definition: winhttp.h:199
static BYTE cert[]
Definition: msg.c:1437
int netconn_get_cipher_strength(netconn_t *conn)
Definition: net.c:938
BOOL WINAPI WinHttpDetectAutoProxyConfigUrl(DWORD flags, LPWSTR *url)
Definition: session.c:1385
#define CERT_NAME_STR_CRLF_FLAG
Definition: wincrypt.h:3490
const char * LPCSTR
Definition: xmlstorage.h:183
struct list cookie_cache
static clock_t begin
Definition: xmllint.c:466
LPWSTR lpszEncryptionAlgName
Definition: winhttp.h:498
#define WINHTTP_FLAG_SECURE
Definition: winhttp.h:60
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define WINHTTP_AUTO_DETECT_TYPE_DNS_A
Definition: winhttp.h:528
#define WINHTTP_HANDLE_TYPE_SESSION
Definition: winhttp.h:430
r l[0]
Definition: byte_order.h:167
BOOL WINAPI WinHttpCrackUrl(LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONENTSW uc)
Definition: url.c:183
WINE_UNICODE_INLINE WCHAR toupperW(WCHAR ch)
Definition: unicode.h:141
static const object_vtbl_t connect_vtbl
Definition: session.c:367
#define KEY_WRITE
Definition: nt_native.h:1031
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define WINHTTP_OPTION_AUTOLOGON_POLICY
Definition: winhttp.h:120
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
VOID WINAPI GetSystemTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:317
BOOL WINAPI WinHttpGetProxyForUrl(HINTERNET hsession, LPCWSTR url, WINHTTP_AUTOPROXY_OPTIONS *options, WINHTTP_PROXY_INFO *info)
Definition: session.c:1858
#define TRACE(s)
Definition: solgame.cpp:4
IN6_ADDR sin6_addr
Definition: ws2ipdef.h:182
GLsizeiptr size
Definition: glext.h:5919
static void str_to_buffer(WCHAR *buffer, const WCHAR *str, LPDWORD buflen)
Definition: session.c:631
static char * strdupWA_sized(const WCHAR *src, DWORD size)
LPWSTR proxy_server
BOOL WINAPI InternetInitializeAutoProxyDll(DWORD, LPSTR, LPSTR, void *, struct AUTO_PROXY_SCRIPT_BUFFER *)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
#define CP_UNIXCP
Definition: compat.h:69
if(!(yy_init))
Definition: macro.lex.yy.c:714
Definition: cmds.c:130
HANDLE unload_event
#define WINHTTP_OPTION_MAX_CONNS_PER_1_0_SERVER
Definition: winhttp.h:119
BOOL WINAPI WinHttpSetTimeouts(HINTERNET handle, int resolve, int connect, int send, int receive)
Definition: session.c:2047
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WINHTTP_CALLBACK_STATUS_HANDLE_CREATED
Definition: winhttp.h:390
static const DWORD PROXY_USE_PAC_SCRIPT
Definition: session.c:1481
#define debugstr_a
Definition: kernel32.h:31
#define WINHTTP_QUERY_FLAG_NUMBER
Definition: winhttp.h:377
static BOOL session_set_option(object_header_t *hdr, DWORD option, LPVOID buffer, DWORD buflen)
Definition: session.c:159
static BOOL request_set_option(object_header_t *hdr, DWORD option, LPVOID buffer, DWORD buflen)
Definition: session.c:896
static const WCHAR url[]
Definition: encode.c:1432
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
Definition: send.c:23
CredHandle cred_handle
INTERNET_SCHEME nScheme
Definition: wininet.h:214
ULONG to_read
Definition: btrfs.c:4161
#define WINAPI
Definition: msvc.h:8
static BOOL connect_query_option(object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen)
Definition: session.c:325
DWORD get_last_error(void)
Definition: session.c:65
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
static void connect_destroy(object_header_t *hdr)
Definition: session.c:310
BOOL WINAPI WinHttpGetIEProxyConfigForCurrentUser(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG *config)
Definition: session.c:1630
#define WINHTTP_HANDLE_TYPE_CONNECT
Definition: winhttp.h:431
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WINHTTP_OPTION_CONTEXT_VALUE
Definition: winhttp.h:112
#define HTTP_STATUS_OK
Definition: winhttp.h:240
#define SECURITY_FLAG_IGNORE_CERT_WRONG_USAGE
Definition: winhttp.h:284
int socklen_t
Definition: tcp.c:35
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define SetLastError(x)
Definition: compat.h:409
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
static const DWORD PROXY_AUTODETECT_SETTINGS
Definition: session.c:1482
GLbitfield flags
Definition: glext.h:7161
#define NI_MAXHOST
Definition: ws2def.h:359
static BOOL is_domain_suffix(const char *domain, const char *suffix)
Definition: session.c:1306
DWORD dwHostNameLength
Definition: wininet.h:216
static void copy_char_to_wchar_sz(const BYTE *src, DWORD len, WCHAR *dst)
Definition: session.c:1491
const object_vtbl_t * vtbl
WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback(HINTERNET handle, WINHTTP_STATUS_CALLBACK callback, DWORD flags, DWORD_PTR reserved)
Definition: session.c:2022
static DWORD pi
Definition: protocol.c:150
object_header_t * grab_object(HINTERNET hinternet)
Definition: handle.c:57
static HANDLE thread
Definition: service.c:33
static BOOL convert_sockaddr(const struct sockaddr *addr, SOCKADDR_STORAGE *addr_storage)
Definition: session.c:655
int ret
static BOOL run_script(char *script, DWORD size, const WCHAR *url, WINHTTP_PROXY_INFO *info)
Definition: session.c:1815
GLenum const GLvoid * addr
Definition: glext.h:9621
#define DEFAULT_SEND_TIMEOUT
Definition: session.c:56
static char * download_script(const WCHAR *url, DWORD *out_size)
Definition: session.c:1744
LPWSTR lpszUrlPath
Definition: wininet.h:222
HKEY key
Definition: reg.c:42
static BOOL get_system_proxy_autoconfig_url(char *buf, DWORD buflen)
Definition: session.c:1346
uint32_t entry
Definition: isohybrid.c:63
BOOL free_handle(HINTERNET hinternet)
Definition: handle.c:124
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
GLdouble s
Definition: gl.h:2039
Definition: _list.h:228
static void destroy_authinfo(struct authinfo *info)
GLenum src
Definition: glext.h:6340
void release_object(object_header_t *hdr)
Definition: handle.c:73
#define DEFAULT_CONNECT_TIMEOUT
Definition: session.c:55
LPWSTR proxy_username
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define CRYPT_OID_INFO_OID_KEY
Definition: wincrypt.h:1702
static const object_vtbl_t session_vtbl
Definition: session.c:233
BOOL WINAPI WinHttpSetOption(HINTERNET handle, DWORD option, LPVOID buffer, DWORD buflen)
Definition: session.c:1270
#define WINHTTP_OPTION_CONNECTION_INFO
Definition: winhttp.h:136
#define ERROR_MORE_DATA
Definition: dderror.h:13
LPWSTR proxy_bypass
ed encoding
Definition: write.c:2839
char string[160]
Definition: util.h:11
static BOOL parse_script_result(const char *result, WINHTTP_PROXY_INFO *info)
Definition: session.c:1710
#define strcmpiW(s1, s2)
Definition: unicode.h:39
DWORD dwUrlPathLength
Definition: wininet.h:223
struct in_addr sin_addr
Definition: winsock.h:512
#define local
Definition: zutil.h:30
#define ERR(fmt,...)
Definition: debug.h:109
#define DEFAULT_RESOLVE_TIMEOUT
Definition: session.c:54
#define SECURITY_FLAG_IGNORE_CERT_DATE_INVALID
Definition: winhttp.h:282
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
static unsigned __int64 next
Definition: rand_nt.c:6
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
static ATOM item
Definition: dde.c:856
static char * strdupWA(const WCHAR *src)
Definition: main.c:111
BOOL WINAPI WinHttpSetDefaultProxyConfiguration(WINHTTP_PROXY_INFO *info)
Definition: session.c:1914
BOOL WINAPI WinHttpTimeFromSystemTime(const SYSTEMTIME *time, LPWSTR string)
Definition: session.c:2124
#define WINHTTP_OPTION_SECURITY_FLAGS
Definition: winhttp.h:106
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
static const object_vtbl_t request_vtbl
Definition: session.c:1036
static BOOL request_query_option(object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen)
Definition: session.c:720
Definition: services.c:325
GLenum GLenum dst
Definition: glext.h:6340
#define sprintfW
Definition: unicode.h:58
#define getnameinfo
Definition: wspiapi.h:45
static const WCHAR http1_1[]
#define ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT
Definition: winhttp.h:221
static const WCHAR WinHttpSettings[]
Definition: session.c:1475
WINE_UNICODE_INLINE int isdigitW(WCHAR wc)
Definition: unicode.h:170
#define WINHTTP_OPTION_RESOLVE_TIMEOUT
Definition: winhttp.h:95
DWORD netconn_set_timeout(netconn_t *netconn, BOOL send, int value)
Definition: net.c:768
BOOL process_header(request_t *request, LPCWSTR field, LPCWSTR value, DWORD flags, BOOL request_only)
Definition: request.c:409
#define MultiByteToWideChar
Definition: compat.h:100
Definition: tftpd.h:85
static const DWORD PROXY_TYPE_PROXY
Definition: session.c:1480
char * strchr(const char *String, int ch)
Definition: utclib.c:501
BOOL WINAPI WinHttpGetDefaultProxyConfiguration(WINHTTP_PROXY_INFO *info)
Definition: session.c:1503
static const DWORD PROXY_TYPE_DIRECT
Definition: session.c:1479
BOOL WINAPI InternetGetProxyInfo(LPCSTR, DWORD, LPSTR, DWORD, LPSTR *, LPDWORD)
struct addrinfo * ai_next
Definition: ws2def.h:672
HINTERNET WINAPI WinHttpOpen(LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWSTR bypass, DWORD flags)
Definition: session.c:246
Definition: name.c:36
object_header_t * addref_object(object_header_t *hdr)
Definition: handle.c:50
BOOL WINAPI WinHttpCheckPlatform(void)
Definition: session.c:84
GLuint res
Definition: glext.h:9613
int disable
Definition: msacm.c:1353
#define CERT_SIMPLE_NAME_STR
Definition: wincrypt.h:3484
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
uint32_t * LPDWORD
Definition: typedefs.h:57
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define WINHTTP_OPTION_SECURITY_KEY_BITNESS
Definition: winhttp.h:109
static int reverse_lookup(const struct addrinfo *ai, char *hostname, size_t len)
Definition: session.c:1315
#define AF_INET
Definition: tcpip.h:117
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
static BOOL session_query_option(object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen)
Definition: session.c:117
static char * get_computer_name(COMPUTER_NAME_FORMAT format)
Definition: session.c:1290
#define SECURITY_FLAG_SECURE
Definition: winhttp.h:285
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
size_t ai_addrlen
Definition: ws2def.h:669
static const DWORD WINHTTP_SETTINGS_MAGIC
Definition: session.c:1477
#define INTERNET_DEFAULT_PORT
Definition: winhttp.h:35
void set_last_error(DWORD error)
Definition: session.c:59
#define MAX_HOST_NAME_LENGTH
Definition: session.c:426
#define ERROR_WINHTTP_INCORRECT_HANDLE_STATE
Definition: winhttp.h:200
WINE_UNICODE_INLINE int isalphaW(WCHAR wc)
Definition: unicode.h:195
PCCRYPT_OID_INFO WINAPI CryptFindOIDInfo(DWORD dwKeyType, void *pvKey, DWORD dwGroupId)
Definition: oid.c:1799
static const WCHAR httpW[]
Definition: assoc.c:94
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define DEFAULT_RECEIVE_TIMEOUT
Definition: session.c:57
#define LIST_ENTRY(type)
Definition: queue.h:175
#define WINHTTP_OPTION_CONNECT_TIMEOUT
Definition: winhttp.h:96
static const WCHAR getW[]
Definition: lex.c:55
HINTERNET WINAPI WinHttpOpenRequest(HINTERNET hconnect, LPCWSTR verb, LPCWSTR object, LPCWSTR version, LPCWSTR referrer, LPCWSTR *types, DWORD flags)
Definition: session.c:1061
static void session_destroy(object_header_t *hdr)
Definition: session.c:93
#define WINHTTP_AUTOPROXY_CONFIG_URL
Definition: winhttp.h:531
USHORT port
Definition: uri.c:227
GLuint64EXT * result
Definition: glext.h:11304
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
#define TRACE_ON(x)
Definition: compat.h:65
BOOL WINAPI WinHttpSendRequest(HINTERNET hrequest, LPCWSTR headers, DWORD headers_len, LPVOID optional, DWORD optional_len, DWORD total_len, DWORD_PTR context)
Definition: request.c:2168
static BOOL set_option(object_header_t *hdr, DWORD option, LPVOID buffer, DWORD buflen)
Definition: session.c:1231
static BOOL should_bypass_proxy(session_t *session, LPCWSTR server)
Definition: session.c:428
void delete_domain(domain_t *domain)
Definition: cookie.c:89
INT WSAAPI getsockname(IN SOCKET s, OUT LPSOCKADDR name, IN OUT INT FAR *namelen)
Definition: sockctrl.c:213
#define ERROR_WINHTTP_INVALID_OPTION
Definition: winhttp.h:194
struct sockaddr * ai_addr
Definition: ws2def.h:671
#define SECURITY_FLAG_STRENGTH_WEAK
Definition: winhttp.h:286
static const WCHAR month[12][4]
Definition: session.c:2116
BOOL WINAPI WinHttpReadData(HINTERNET hrequest, LPVOID buffer, DWORD to_read, LPDWORD read)
Definition: request.c:2811
#define WINHTTP_OPTION_UNLOAD_NOTIFY_EVENT
Definition: winhttp.h:141
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
WINE_UNICODE_INLINE int atoiW(const WCHAR *str)
Definition: unicode.h:315
Definition: path.c:42
#define WINHTTP_OPTION_DISABLE_FEATURE
Definition: winhttp.h:116
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
static const WCHAR attr_accept[]
Definition: request.c:53
#define WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH
Definition: winhttp.h:126
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define getaddrinfo
Definition: wspiapi.h:44
Definition: ps.c:97
GLuint const GLchar * name
Definition: glext.h:6031
int ai_family
Definition: ws2def.h:666
static const WCHAR slashW[]
Definition: devenum.c:62