ReactOS 0.4.16-dev-2207-geb15453
httprequest.c
Go to the documentation of this file.
1/*
2 * IXMLHTTPRequest implementation
3 *
4 * Copyright 2008 Alistair Leslie-Hughes
5 * Copyright 2010-2012 Nikolay Sivov for CodeWeavers
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#define COBJMACROS
23
24#include <stdarg.h>
25
26#include "windef.h"
27#include "winbase.h"
28#include "wingdi.h"
29#include "wininet.h"
30#include "winreg.h"
31#include "winuser.h"
32#include "ole2.h"
33#include "mshtml.h"
34#include "msxml6.h"
35#include "objsafe.h"
36#include "docobj.h"
37#include "shlwapi.h"
38
39#include "msxml_dispex.h"
40
41#include "wine/debug.h"
42
44
45static const WCHAR colspaceW[] = {':',' ',0};
46static const WCHAR crlfW[] = {'\r','\n',0};
48 INTERFACESAFE_FOR_UNTRUSTED_CALLER |
49 INTERFACESAFE_FOR_UNTRUSTED_DATA |
50 INTERFACE_USES_SECURITY_MANAGER;
51
53
55{
56 struct list entry;
59};
60
61typedef struct
62{
63 IXMLHTTPRequest IXMLHTTPRequest_iface;
68
69 READYSTATE state;
71
72 /* request */
73 BINDVERB verb;
78 struct list reqheaders;
79 /* cached resulting custom request headers string length in WCHARs */
81 /* use UTF-8 content type */
83
84 /* response headers */
85 struct list respheaders;
87
88 /* credentials */
91
92 /* bind callback */
96
97 /* IObjectWithSite*/
99
100 /* IObjectSafety */
103
104typedef struct
105{
108} serverhttp;
109
110static inline httprequest *impl_from_IXMLHTTPRequest( IXMLHTTPRequest *iface )
111{
112 return CONTAINING_RECORD(iface, httprequest, IXMLHTTPRequest_iface);
113}
114
116{
117 return CONTAINING_RECORD(iface, httprequest, IObjectWithSite_iface);
118}
119
121{
122 return CONTAINING_RECORD(iface, httprequest, IObjectSafety_iface);
123}
124
126{
127 return CONTAINING_RECORD(iface, httprequest, ISupportErrorInfo_iface);
128}
129
131{
132 return CONTAINING_RECORD(iface, serverhttp, IServerXMLHTTPRequest_iface);
133}
134
136{
137 READYSTATE last = This->state;
138 static const char* readystates[] = {
139 "READYSTATE_UNINITIALIZED",
140 "READYSTATE_LOADING",
141 "READYSTATE_LOADED",
142 "READYSTATE_INTERACTIVE",
143 "READYSTATE_COMPLETE"};
144
145 This->state = state;
146
147 TRACE("state %s\n", readystates[state]);
148
149 if (This->sink && last != state)
150 {
151 DISPPARAMS params;
152
153 memset(&params, 0, sizeof(params));
154 IDispatch_Invoke(This->sink, 0, &IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &params, 0, 0, 0);
155 }
156}
157
159{
160 struct httpheader *header, *header2;
161
162 LIST_FOR_EACH_ENTRY_SAFE(header, header2, &This->respheaders, struct httpheader, entry)
163 {
164 list_remove(&header->entry);
165 SysFreeString(header->header);
167 free(header);
168 }
169
170 SysFreeString(This->raw_respheaders);
171 This->raw_respheaders = NULL;
172}
173
175{
176 struct httpheader *header, *header2;
177
178 LIST_FOR_EACH_ENTRY_SAFE(header, header2, &This->reqheaders, struct httpheader, entry)
179 {
180 list_remove(&header->entry);
181 SysFreeString(header->header);
183 free(header);
184 }
185}
186
188{
192 LONG ref;
193
196
197 /* response data */
199
200 /* request body data */
202};
203
205{
206 return CONTAINING_RECORD(iface, BindStatusCallback, IBindStatusCallback_iface);
207}
208
210{
211 return CONTAINING_RECORD(iface, BindStatusCallback, IHttpNegotiate_iface);
212}
213
215{
216 return CONTAINING_RECORD(iface, BindStatusCallback, IAuthenticate_iface);
217}
218
220{
221 if (bsc)
222 {
223 if (bsc->binding) IBinding_Abort(bsc->binding);
224 bsc->request->bsc = NULL;
225 bsc->request = NULL;
226 IBindStatusCallback_Release(&bsc->IBindStatusCallback_iface);
227 }
228}
229
231 REFIID riid, void **ppv)
232{
234
235 *ppv = NULL;
236
237 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
238
240 IsEqualGUID(&IID_IBindStatusCallback, riid))
241 {
242 *ppv = &This->IBindStatusCallback_iface;
243 }
244 else if (IsEqualGUID(&IID_IHttpNegotiate, riid))
245 {
246 *ppv = &This->IHttpNegotiate_iface;
247 }
248 else if (IsEqualGUID(&IID_IAuthenticate, riid))
249 {
250 *ppv = &This->IAuthenticate_iface;
251 }
252 else if (IsEqualGUID(&IID_IServiceProvider, riid) ||
253 IsEqualGUID(&IID_IBindStatusCallbackEx, riid) ||
254 IsEqualGUID(&IID_IInternetProtocol, riid) ||
255 IsEqualGUID(&IID_IHttpNegotiate2, riid))
256 {
257 return E_NOINTERFACE;
258 }
259
260 if (*ppv)
261 {
262 IBindStatusCallback_AddRef(iface);
263 return S_OK;
264 }
265
266 FIXME("Unsupported riid = %s\n", debugstr_guid(riid));
267
268 return E_NOINTERFACE;
269}
270
272{
275
276 TRACE("%p, refcount %ld.\n", iface, ref);
277
278 return ref;
279}
280
282{
285
286 TRACE("%p, refcount %ld.\n", iface, ref);
287
288 if (!ref)
289 {
290 if (This->binding) IBinding_Release(This->binding);
291 if (This->stream) IStream_Release(This->stream);
292 if (This->body) GlobalFree(This->body);
293 free(This);
294 }
295
296 return ref;
297}
298
300 DWORD reserved, IBinding *pbind)
301{
303
304 TRACE("%p, %ld, %p.\n", iface, reserved, pbind);
305
306 if (!pbind) return E_INVALIDARG;
307
308 This->binding = pbind;
309 IBinding_AddRef(pbind);
310
311 httprequest_setreadystate(This->request, READYSTATE_LOADED);
312
313 return CreateStreamOnHGlobal(NULL, TRUE, &This->stream);
314}
315
317{
319
320 TRACE("(%p)->(%p)\n", This, pPriority);
321
322 return E_NOTIMPL;
323}
324
326{
327 TRACE("%p, %ld.\n", iface, reserved);
328
329 return E_NOTIMPL;
330}
331
333 ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
334{
335 TRACE("%p, %lu, %lu, %lu, %s.\n", iface, ulProgress, ulProgressMax, ulStatusCode,
336 debugstr_w(szStatusText));
337
338 return S_OK;
339}
340
343{
345
346 TRACE("%p, %#lx, %s.\n", iface, hr, debugstr_w(error));
347
348 if (This->binding)
349 {
350 IBinding_Release(This->binding);
351 This->binding = NULL;
352 }
353
354 if (hr == S_OK)
355 {
356 BindStatusCallback_Detach(This->request->bsc);
357 This->request->bsc = This;
358 httprequest_setreadystate(This->request, READYSTATE_COMPLETE);
359 }
360
361 return S_OK;
362}
363
365 DWORD *bind_flags, BINDINFO *pbindinfo)
366{
368
369 TRACE("(%p)->(%p %p)\n", This, bind_flags, pbindinfo);
370
371 *bind_flags = 0;
372 if (This->request->async) *bind_flags |= BINDF_ASYNCHRONOUS;
373
374 if (This->request->verb != BINDVERB_GET && This->body)
375 {
376 pbindinfo->stgmedData.tymed = TYMED_HGLOBAL;
377 pbindinfo->stgmedData.hGlobal = This->body;
378 pbindinfo->cbstgmedData = GlobalSize(This->body);
379 /* callback owns passed body pointer */
380 IBindStatusCallback_QueryInterface(iface, &IID_IUnknown, (void**)&pbindinfo->stgmedData.pUnkForRelease);
381 }
382
383 pbindinfo->dwBindVerb = This->request->verb;
384 if (This->request->verb == BINDVERB_CUSTOM)
385 {
386 pbindinfo->szCustomVerb = CoTaskMemAlloc(SysStringByteLen(This->request->custom)+sizeof(WCHAR));
387 lstrcpyW(pbindinfo->szCustomVerb, This->request->custom);
388 }
389
390 return S_OK;
391}
392
394 DWORD flags, DWORD size, FORMATETC *format, STGMEDIUM *stgmed)
395{
397 DWORD read, written;
398 BYTE buf[4096];
399 HRESULT hr;
400
401 TRACE("%p, %#lx, %lu, %p, %p.\n", iface, flags, size, format, stgmed);
402
403 do
404 {
405 hr = IStream_Read(stgmed->pstm, buf, sizeof(buf), &read);
406 if (hr != S_OK) break;
407
408 hr = IStream_Write(This->stream, buf, read, &written);
409 } while((hr == S_OK) && written != 0 && read != 0);
410
411 httprequest_setreadystate(This->request, READYSTATE_INTERACTIVE);
412
413 return S_OK;
414}
415
418{
420
421 FIXME("(%p)->(%s %p): stub\n", This, debugstr_guid(riid), punk);
422
423 return E_NOTIMPL;
424}
425
426static const IBindStatusCallbackVtbl BindStatusCallbackVtbl = {
438};
439
441 REFIID riid, void **ppv)
442{
444 return IBindStatusCallback_QueryInterface(&This->IBindStatusCallback_iface, riid, ppv);
445}
446
448{
450 return IBindStatusCallback_AddRef(&This->IBindStatusCallback_iface);
451}
452
454{
456 return IBindStatusCallback_Release(&This->IBindStatusCallback_iface);
457}
458
461{
462 static const WCHAR content_type_utf8W[] = {'C','o','n','t','e','n','t','-','T','y','p','e',':',' ',
463 't','e','x','t','/','p','l','a','i','n',';','c','h','a','r','s','e','t','=','u','t','f','-','8','\r','\n',0};
464 static const WCHAR refererW[] = {'R','e','f','e','r','e','r',':',' ',0};
465
467 const struct httpheader *entry;
468 BSTR base_uri = NULL;
469 WCHAR *buff, *ptr;
470 int size = 0;
471
472 TRACE("%p, %s, %s, %ld, %p.\n", iface, debugstr_w(url), debugstr_w(headers), reserved, add_headers);
473
474 *add_headers = NULL;
475
476 if (This->request->use_utf8_content)
477 size = sizeof(content_type_utf8W);
478
479 if (!list_empty(&This->request->reqheaders))
480 size += This->request->reqheader_size*sizeof(WCHAR);
481
482 if (This->request->base_uri)
483 {
484 IUri_GetRawUri(This->request->base_uri, &base_uri);
485 size += SysStringLen(base_uri)*sizeof(WCHAR) + sizeof(refererW) + sizeof(crlfW);
486 }
487
488 if (!size)
489 {
490 SysFreeString(base_uri);
491 return S_OK;
492 }
493
495 if (!buff)
496 {
497 SysFreeString(base_uri);
498 return E_OUTOFMEMORY;
499 }
500
501 ptr = buff;
502 if (This->request->use_utf8_content)
503 {
504 lstrcpyW(ptr, content_type_utf8W);
505 ptr += ARRAY_SIZE(content_type_utf8W) - 1;
506 }
507
508 if (base_uri)
509 {
510 lstrcpyW(ptr, refererW);
511 lstrcatW(ptr, base_uri);
513 ptr += lstrlenW(refererW) + SysStringLen(base_uri) + lstrlenW(crlfW);
514 SysFreeString(base_uri);
515 }
516
517 /* user headers */
518 LIST_FOR_EACH_ENTRY(entry, &This->request->reqheaders, struct httpheader, entry)
519 {
520 lstrcpyW(ptr, entry->header);
521 ptr += SysStringLen(entry->header);
522
524 ptr += ARRAY_SIZE(colspaceW) - 1;
525
526 lstrcpyW(ptr, entry->value);
527 ptr += SysStringLen(entry->value);
528
530 ptr += ARRAY_SIZE(crlfW) - 1;
531 }
532
533 *add_headers = buff;
534
535 return S_OK;
536}
537
539{
540 struct httpheader *entry;
541 const WCHAR *ptr = data;
543
544 while (*ptr)
545 {
546 if (*ptr == ':')
547 {
549 /* skip leading spaces for a value */
550 while (*++ptr == ' ')
551 ;
553 break;
554 }
555 ptr++;
556 }
557
558 if (!*ptr) return;
559
560 /* new header */
561 TRACE("got header %s:%s\n", debugstr_w(header), debugstr_w(value));
562
563 entry = malloc(sizeof(*entry));
564 entry->header = header;
565 entry->value = value;
566 list_add_head(&This->respheaders, &entry->entry);
567}
568
570 LPCWSTR resp_headers, LPCWSTR req_headers, LPWSTR *add_reqheaders)
571{
573
574 TRACE("%p, %ld, %s, %s, %p.\n", iface, code, debugstr_w(resp_headers),
575 debugstr_w(req_headers), add_reqheaders);
576
577 This->request->status = code;
578 /* store headers and status text */
579 free_response_headers(This->request);
580 SysFreeString(This->request->status_text);
581 This->request->status_text = NULL;
582 if (resp_headers)
583 {
584 const WCHAR *ptr, *line, *status_text;
585
586 ptr = line = resp_headers;
587
588 /* skip HTTP-Version */
589 ptr = wcschr(ptr, ' ');
590 if (ptr)
591 {
592 /* skip Status-Code */
593 ptr = wcschr(++ptr, ' ');
594 if (ptr)
595 {
596 status_text = ++ptr;
597 /* now it supposed to end with CRLF */
598 while (*ptr)
599 {
600 if (*ptr == '\r' && *(ptr+1) == '\n')
601 {
602 line = ptr + 2;
603 This->request->status_text = SysAllocStringLen(status_text, ptr-status_text);
604 TRACE("status text %s\n", debugstr_w(This->request->status_text));
605 break;
606 }
607 ptr++;
608 }
609 }
610 }
611
612 /* store as unparsed string for now */
613 This->request->raw_respheaders = SysAllocString(line);
614 }
615
616 return S_OK;
617}
618
619static const IHttpNegotiateVtbl BSCHttpNegotiateVtbl = {
625};
626
628 REFIID riid, void **ppv)
629{
631 return IBindStatusCallback_QueryInterface(&This->IBindStatusCallback_iface, riid, ppv);
632}
633
635{
637 return IBindStatusCallback_AddRef(&This->IBindStatusCallback_iface);
638}
639
641{
643 return IBindStatusCallback_Release(&This->IBindStatusCallback_iface);
644}
645
648{
650 httprequest *request = This->request;
651
652 TRACE("(%p)->(%p %p %p)\n", This, hwnd, username, password);
653
654 if (request->user && *request->user)
655 {
656 if (hwnd) *hwnd = NULL;
659 if (!*username || !*password)
660 {
663 return E_OUTOFMEMORY;
664 }
665
666 memcpy(*username, request->user, SysStringByteLen(request->user)+sizeof(WCHAR));
668 }
669
670 return S_OK;
671}
672
673static const IAuthenticateVtbl AuthenticateVtbl = {
678};
679
681{
683 IBindCtx *pbc = NULL;
684 HRESULT hr;
685 LONG size;
686
687 if (!(bsc = malloc(sizeof(*bsc))))
688 return E_OUTOFMEMORY;
689
691 bsc->IHttpNegotiate_iface.lpVtbl = &BSCHttpNegotiateVtbl;
692 bsc->IAuthenticate_iface.lpVtbl = &AuthenticateVtbl;
693 bsc->ref = 1;
694 bsc->request = This;
695 bsc->binding = NULL;
696 bsc->stream = NULL;
697 bsc->body = NULL;
698
699 TRACE("(%p)->(%p)\n", This, bsc);
700
701 This->use_utf8_content = FALSE;
702
703 if (This->verb != BINDVERB_GET)
704 {
705 void *send_data, *ptr;
706 SAFEARRAY *sa = NULL;
707
708 if (V_VT(body) == (VT_VARIANT|VT_BYREF))
710
711 switch (V_VT(body))
712 {
713 case VT_BSTR:
714 {
715 int len = SysStringLen(V_BSTR(body));
716 const WCHAR *str = V_BSTR(body);
717 UINT i, cp = CP_ACP;
718
719 for (i = 0; i < len; i++)
720 {
721 if (str[i] > 127)
722 {
723 cp = CP_UTF8;
724 break;
725 }
726 }
727
729 if (!(ptr = malloc(size)))
730 {
731 free(bsc);
732 return E_OUTOFMEMORY;
733 }
735 if (cp == CP_UTF8) This->use_utf8_content = TRUE;
736 break;
737 }
738 case VT_ARRAY|VT_UI1:
739 {
740 sa = V_ARRAY(body);
741 if ((hr = SafeArrayAccessData(sa, &ptr)) != S_OK)
742 {
743 free(bsc);
744 return hr;
745 }
746 if ((hr = SafeArrayGetUBound(sa, 1, &size)) != S_OK)
747 {
749 free(bsc);
750 return hr;
751 }
752 size++;
753 break;
754 }
755 default:
756 FIXME("unsupported body data type %d\n", V_VT(body));
757 /* fall through */
758 case VT_EMPTY:
759 case VT_ERROR:
760 case VT_NULL:
761 ptr = NULL;
762 size = 0;
763 break;
764 }
765
766 if (size)
767 {
768 bsc->body = GlobalAlloc(GMEM_FIXED, size);
769 if (!bsc->body)
770 {
771 if (V_VT(body) == VT_BSTR)
772 free(ptr);
773 else if (V_VT(body) == (VT_ARRAY|VT_UI1))
775
776 free(bsc);
777 return E_OUTOFMEMORY;
778 }
779
780 send_data = GlobalLock(bsc->body);
781 memcpy(send_data, ptr, size);
782 GlobalUnlock(bsc->body);
783 }
784
785 if (V_VT(body) == VT_BSTR)
786 free(ptr);
787 else if (V_VT(body) == (VT_ARRAY|VT_UI1))
789 }
790
791 hr = CreateBindCtx(0, &pbc);
792 if (hr == S_OK)
794 if (hr == S_OK)
795 {
797
798 hr = CreateURLMonikerEx2(NULL, This->uri, &moniker, URL_MK_UNIFORM);
799 if (hr == S_OK)
800 {
802
803 hr = IMoniker_BindToStorage(moniker, pbc, NULL, &IID_IStream, (void**)&stream);
804 IMoniker_Release(moniker);
805 if (stream) IStream_Release(stream);
806 }
807 }
808
809 if (pbc)
810 IBindCtx_Release(pbc);
811
812 if (FAILED(hr))
813 {
814 IBindStatusCallback_Release(&bsc->IBindStatusCallback_iface);
815 bsc = NULL;
816 }
817
818 *obj = bsc;
819 return hr;
820}
821
823{
824 DWORD scheme, base_scheme;
825 BSTR host, base_host;
826 HRESULT hr;
827
828 if(!(This->safeopt & INTERFACESAFE_FOR_UNTRUSTED_DATA))
829 return S_OK;
830
831 if(!This->base_uri)
832 return E_ACCESSDENIED;
833
834 hr = IUri_GetScheme(uri, &scheme);
835 if(FAILED(hr))
836 return hr;
837
838 hr = IUri_GetScheme(This->base_uri, &base_scheme);
839 if(FAILED(hr))
840 return hr;
841
842 if(scheme != base_scheme) {
843 WARN("Schemes don't match\n");
844 return E_ACCESSDENIED;
845 }
846
848 FIXME("Unknown scheme\n");
849 return E_ACCESSDENIED;
850 }
851
852 hr = IUri_GetHost(uri, &host);
853 if(FAILED(hr))
854 return hr;
855
856 hr = IUri_GetHost(This->base_uri, &base_host);
857 if(SUCCEEDED(hr)) {
858 if(wcsicmp(host, base_host)) {
859 WARN("Hosts don't match\n");
861 }
862 SysFreeString(base_host);
863 }
864
866 return hr;
867}
868
871{
872 static const WCHAR MethodHeadW[] = {'H','E','A','D',0};
873 static const WCHAR MethodGetW[] = {'G','E','T',0};
874 static const WCHAR MethodPutW[] = {'P','U','T',0};
875 static const WCHAR MethodPostW[] = {'P','O','S','T',0};
876 static const WCHAR MethodDeleteW[] = {'D','E','L','E','T','E',0};
877 static const WCHAR MethodPropFindW[] = {'P','R','O','P','F','I','N','D',0};
878 VARIANT str, is_async;
879 IUri *uri;
880 HRESULT hr;
881
882 if (!method || !url) return E_INVALIDARG;
883
884 /* free previously set data */
885 if(This->uri) {
886 IUri_Release(This->uri);
887 This->uri = NULL;
888 }
889
890 SysFreeString(This->user);
891 SysFreeString(This->password);
892 This->user = This->password = NULL;
894
895 if (!wcsicmp(method, MethodGetW))
896 {
897 This->verb = BINDVERB_GET;
898 }
899 else if (!wcsicmp(method, MethodPutW))
900 {
901 This->verb = BINDVERB_PUT;
902 }
903 else if (!wcsicmp(method, MethodPostW))
904 {
905 This->verb = BINDVERB_POST;
906 }
907 else if (!wcsicmp(method, MethodDeleteW) ||
908 !wcsicmp(method, MethodHeadW) ||
909 !wcsicmp(method, MethodPropFindW))
910 {
911 This->verb = BINDVERB_CUSTOM;
912 SysReAllocString(&This->custom, method);
913 }
914 else
915 {
916 FIXME("unsupported request type %s\n", debugstr_w(method));
917 This->verb = -1;
918 return E_FAIL;
919 }
920
921 if(This->base_uri)
922 hr = CoInternetCombineUrlEx(This->base_uri, url, 0, &uri, 0);
923 else
924 hr = CreateUri(url, 0, 0, &uri);
925 if(FAILED(hr)) {
926 WARN("Could not create IUri object, hr %#lx.\n", hr);
927 return hr;
928 }
929
930 hr = verify_uri(This, uri);
931 if(FAILED(hr)) {
932 IUri_Release(uri);
933 return hr;
934 }
935
938 if (hr == S_OK)
939 This->user = V_BSTR(&str);
940
943 if (hr == S_OK)
944 This->password = V_BSTR(&str);
945
946 /* add authentication info */
947 if (This->user && *This->user)
948 {
949 IUriBuilder *builder;
950
951 hr = CreateIUriBuilder(uri, 0, 0, &builder);
952 if (hr == S_OK)
953 {
954 IUri *full_uri;
955
956 IUriBuilder_SetUserName(builder, This->user);
957 IUriBuilder_SetPassword(builder, This->password);
958 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &full_uri);
959 if (hr == S_OK)
960 {
961 IUri_Release(uri);
962 uri = full_uri;
963 }
964 else
965 WARN("failed to create modified uri, hr %#lx.\n", hr);
966 IUriBuilder_Release(builder);
967 }
968 else
969 WARN("IUriBuilder creation failed, hr %#lx.\n", hr);
970 }
971
972 This->uri = uri;
973
974 VariantInit(&is_async);
975 hr = VariantChangeType(&is_async, &async, 0, VT_BOOL);
976 This->async = hr == S_OK && V_BOOL(&is_async);
977
978 httprequest_setreadystate(This, READYSTATE_LOADING);
979
980 return S_OK;
981}
982
984{
985 struct httpheader *entry;
986
987 if (!header || !*header) return E_INVALIDARG;
988 if (This->state != READYSTATE_LOADING) return E_FAIL;
989 if (!value) return E_INVALIDARG;
990
991 /* replace existing header value if already added */
992 LIST_FOR_EACH_ENTRY(entry, &This->reqheaders, struct httpheader, entry)
993 {
994 if (wcscmp(entry->header, header) == 0)
995 {
996 LONG length = SysStringLen(entry->value);
997 HRESULT hr;
998
1000
1001 if (hr == S_OK)
1002 This->reqheader_size += (SysStringLen(entry->value) - length);
1003
1004 return hr;
1005 }
1006 }
1007
1008 entry = malloc(sizeof(*entry));
1009 if (!entry) return E_OUTOFMEMORY;
1010
1011 /* new header */
1012 entry->header = SysAllocString(header);
1013 entry->value = SysAllocString(value);
1014
1015 /* header length including null terminator */
1016 This->reqheader_size += SysStringLen(entry->header) + ARRAY_SIZE(colspaceW) +
1017 SysStringLen(entry->value) + ARRAY_SIZE(crlfW) - 1;
1018
1019 list_add_head(&This->reqheaders, &entry->entry);
1020
1021 return S_OK;
1022}
1023
1025{
1026 struct httpheader *entry;
1027
1028 if (!header) return E_INVALIDARG;
1029 if (!value) return E_POINTER;
1030
1031 if (This->raw_respheaders && list_empty(&This->respheaders))
1032 {
1033 WCHAR *ptr, *line;
1034
1035 ptr = line = This->raw_respheaders;
1036 while (*ptr)
1037 {
1038 if (*ptr == '\r' && *(ptr+1) == '\n')
1039 {
1041 ptr++; line = ++ptr;
1042 continue;
1043 }
1044 ptr++;
1045 }
1046 }
1047
1048 LIST_FOR_EACH_ENTRY(entry, &This->respheaders, struct httpheader, entry)
1049 {
1050 if (!wcsicmp(entry->header, header))
1051 {
1052 *value = SysAllocString(entry->value);
1053 TRACE("header value %s\n", debugstr_w(*value));
1054 return S_OK;
1055 }
1056 }
1057
1058 return S_FALSE;
1059}
1060
1062{
1063 if (!respheaders) return E_POINTER;
1064
1065 *respheaders = SysAllocString(This->raw_respheaders);
1066
1067 return S_OK;
1068}
1069
1071{
1073 HRESULT hr;
1074
1075 if (This->state != READYSTATE_LOADING) return E_FAIL;
1076
1078 if (FAILED(hr))
1079 /* success path to detach it is OnStopBinding call */
1081
1082 return hr;
1083}
1084
1086{
1088
1089 httprequest_setreadystate(This, READYSTATE_UNINITIALIZED);
1090
1091 return S_OK;
1092}
1093
1095{
1096 if (!status) return E_POINTER;
1097
1098 *status = This->status;
1099
1100 return This->state == READYSTATE_COMPLETE ? S_OK : E_FAIL;
1101}
1102
1104{
1105 if (!status) return E_POINTER;
1106 if (This->state != READYSTATE_COMPLETE) return E_FAIL;
1107
1108 *status = SysAllocString(This->status_text);
1109
1110 return S_OK;
1111}
1112
1114{
1124};
1125
1126static unsigned int detect_response_encoding(const BYTE *in, unsigned int len)
1127{
1128 if (len >= 4)
1129 {
1130 if (in[0] == 0 && in[1] == 0 && in[2] == 0 && in[3] == 0x3c)
1132 if (in[0] == 0x3c && in[1] == 0 && in[2] == 0 && in[3] == 0)
1134 if (in[0] == 0 && in[1] == 0 && in[2] == 0x3c && in[3] == 0)
1136 if (in[0] == 0 && in[1] == 0x3c && in[2] == 0 && in[3] == 0)
1138 if (in[0] == 0x4c && in[1] == 0x6f && in[2] == 0xa7 && in[3] == 0x94)
1140 if (in[0] == 0x3c && in[1] == 0x3f && in[2] == 0x78 && in[3] == 0x6d)
1142 if (in[0] == 0x3c && in[1] == 0 && in[2] == 0x3f && in[3] == 0)
1144 if (in[0] == 0 && in[1] == 0x3c && in[2] == 0 && in[3] == 0x3f)
1146 }
1147
1148 if (len >= 3)
1149 {
1150 if (in[0] == 0xef && in[1] == 0xbb && in[2] == 0xbf)
1152 }
1153
1154 if (len >= 2)
1155 {
1156 if (in[0] == 0xfe && in[1] == 0xff)
1158 if (in[0] == 0xff && in[1] == 0xfe)
1160 }
1161
1163}
1164
1166{
1167 HGLOBAL hglobal;
1168 HRESULT hr;
1169
1170 if (!body) return E_POINTER;
1171 if (This->state != READYSTATE_COMPLETE) return E_FAIL;
1172
1173 hr = GetHGlobalFromStream(This->bsc->stream, &hglobal);
1174 if (hr == S_OK)
1175 {
1176 const char *ptr = GlobalLock(hglobal);
1177 DWORD size = GlobalSize(hglobal);
1178 unsigned int encoding = RESPONSE_ENCODING_NONE;
1179
1180 /* try to determine data encoding */
1181 if (size >= 4)
1182 {
1183 encoding = detect_response_encoding((const BYTE *)ptr, 4);
1184 TRACE("detected encoding: %u.\n", encoding);
1185
1186 if (encoding != RESPONSE_ENCODING_UTF8 &&
1187 encoding != RESPONSE_ENCODING_UTF16LE &&
1188 encoding != RESPONSE_ENCODING_NONE )
1189 {
1190 FIXME("unsupported response encoding: %u.\n", encoding);
1191 GlobalUnlock(hglobal);
1192 return E_FAIL;
1193 }
1194 }
1195
1196 /* without BOM assume UTF-8 */
1197 if (encoding == RESPONSE_ENCODING_UTF8 || encoding == RESPONSE_ENCODING_NONE)
1198 {
1200
1202 if (*body)
1204 }
1205 else
1207
1208 if (!*body) hr = E_OUTOFMEMORY;
1209 GlobalUnlock(hglobal);
1210 }
1211
1212 return hr;
1213}
1214
1216{
1217 IXMLDOMDocument3 *doc;
1218 HRESULT hr;
1219 BSTR str;
1220
1221 if (!body) return E_INVALIDARG;
1222 if (This->state != READYSTATE_COMPLETE) return E_FAIL;
1223
1224 hr = dom_document_create(MSXML_DEFAULT, (void**)&doc);
1225 if (hr != S_OK) return hr;
1226
1228 if (hr == S_OK)
1229 {
1231
1232 hr = IXMLDOMDocument3_loadXML(doc, str, &ok);
1234 }
1235
1236 IXMLDOMDocument3_QueryInterface(doc, &IID_IDispatch, (void**)body);
1237 IXMLDOMDocument3_Release(doc);
1238
1239 return hr;
1240}
1241
1243{
1244 HGLOBAL hglobal;
1245 HRESULT hr;
1246
1247 if (!body) return E_INVALIDARG;
1248 V_VT(body) = VT_EMPTY;
1249
1250 if (This->state != READYSTATE_COMPLETE) return E_PENDING;
1251
1252 hr = GetHGlobalFromStream(This->bsc->stream, &hglobal);
1253 if (hr == S_OK)
1254 {
1255 void *ptr = GlobalLock(hglobal);
1256 DWORD size = GlobalSize(hglobal);
1257
1258 SAFEARRAYBOUND bound;
1260
1261 bound.lLbound = 0;
1262 bound.cElements = size;
1263 array = SafeArrayCreate(VT_UI1, 1, &bound);
1264
1265 if (array)
1266 {
1267 void *dest;
1268
1269 V_VT(body) = VT_ARRAY | VT_UI1;
1270 V_ARRAY(body) = array;
1271
1273 if (hr == S_OK)
1274 {
1275 memcpy(dest, ptr, size);
1277 }
1278 else
1279 {
1281 }
1282 }
1283 else
1284 hr = E_FAIL;
1285
1286 GlobalUnlock(hglobal);
1287 }
1288
1289 return hr;
1290}
1291
1293{
1294 LARGE_INTEGER move;
1295 IStream *stream;
1296 HRESULT hr;
1297
1298 if (!body) return E_INVALIDARG;
1299 V_VT(body) = VT_EMPTY;
1300
1301 if (This->state != READYSTATE_COMPLETE) return E_PENDING;
1302
1303 hr = IStream_Clone(This->bsc->stream, &stream);
1304
1305 move.QuadPart = 0;
1306 IStream_Seek(stream, move, STREAM_SEEK_SET, NULL);
1307
1308 V_VT(body) = VT_UNKNOWN;
1310
1311 return hr;
1312}
1313
1315{
1316 if (!state) return E_POINTER;
1317
1318 *state = This->state;
1319 return S_OK;
1320}
1321
1323{
1324 if (This->sink) IDispatch_Release(This->sink);
1325 if ((This->sink = sink)) IDispatch_AddRef(This->sink);
1326
1327 return S_OK;
1328}
1329
1331{
1332 if (This->site)
1333 IUnknown_Release( This->site );
1334 if (This->uri)
1335 IUri_Release(This->uri);
1336 if (This->base_uri)
1337 IUri_Release(This->base_uri);
1338
1339 SysFreeString(This->custom);
1340 SysFreeString(This->user);
1341 SysFreeString(This->password);
1342
1343 /* cleanup headers lists */
1346 SysFreeString(This->status_text);
1347
1348 /* detach callback object */
1350
1351 if (This->sink) IDispatch_Release(This->sink);
1352}
1353
1354static HRESULT WINAPI XMLHTTPRequest_QueryInterface(IXMLHTTPRequest *iface, REFIID riid, void **ppvObject)
1355{
1357 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
1358
1359 if ( IsEqualGUID( riid, &IID_IXMLHTTPRequest) ||
1362 {
1363 *ppvObject = iface;
1364 }
1366 {
1367 *ppvObject = &This->IObjectWithSite_iface;
1368 }
1369 else if (IsEqualGUID(&IID_IObjectSafety, riid))
1370 {
1371 *ppvObject = &This->IObjectSafety_iface;
1372 }
1373 else if (IsEqualGUID(&IID_ISupportErrorInfo, riid))
1374 {
1375 *ppvObject = &This->ISupportErrorInfo_iface;
1376 }
1377 else
1378 {
1379 TRACE("Unsupported interface %s\n", debugstr_guid(riid));
1380 *ppvObject = NULL;
1381 return E_NOINTERFACE;
1382 }
1383
1384 IUnknown_AddRef((IUnknown *)*ppvObject);
1385
1386 return S_OK;
1387}
1388
1389static ULONG WINAPI XMLHTTPRequest_AddRef(IXMLHTTPRequest *iface)
1390{
1393 TRACE("%p, refcount %lu.\n", iface, ref);
1394 return ref;
1395}
1396
1397static ULONG WINAPI XMLHTTPRequest_Release(IXMLHTTPRequest *iface)
1398{
1401
1402 TRACE("%p, refcount %lu.\n", iface, ref);
1403
1404 if (!ref)
1405 {
1407 free(request);
1408 }
1409
1410 return ref;
1411}
1412
1413static HRESULT WINAPI XMLHTTPRequest_GetTypeInfoCount(IXMLHTTPRequest *iface, UINT *pctinfo)
1414{
1415 TRACE("%p, %p.\n", iface, pctinfo);
1416
1417 *pctinfo = 1;
1418
1419 return S_OK;
1420}
1421
1422static HRESULT WINAPI XMLHTTPRequest_GetTypeInfo(IXMLHTTPRequest *iface, UINT iTInfo,
1423 LCID lcid, ITypeInfo **ppTInfo)
1424{
1425 TRACE("%p, %u, %lx,%p.\n", iface, iTInfo, lcid, ppTInfo);
1426
1427 return get_typeinfo(IXMLHTTPRequest_tid, ppTInfo);
1428}
1429
1431 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1432{
1434 HRESULT hr;
1435
1436 TRACE("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames,
1437 lcid, rgDispId);
1438
1439 if(!rgszNames || cNames == 0 || !rgDispId)
1440 return E_INVALIDARG;
1441
1443 if(SUCCEEDED(hr))
1444 {
1445 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
1446 ITypeInfo_Release(typeinfo);
1447 }
1448
1449 return hr;
1450}
1451
1452static HRESULT WINAPI XMLHTTPRequest_Invoke(IXMLHTTPRequest *iface, DISPID dispIdMember, REFIID riid,
1453 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
1454 EXCEPINFO *pExcepInfo, UINT *puArgErr)
1455{
1457 HRESULT hr;
1458
1459 TRACE("%p, %ld, %s, %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid),
1460 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1461
1463 if(SUCCEEDED(hr))
1464 {
1465 hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1466 ITypeInfo_Release(typeinfo);
1467 }
1468
1469 return hr;
1470}
1471
1472static HRESULT WINAPI XMLHTTPRequest_open(IXMLHTTPRequest *iface, BSTR method, BSTR url,
1474{
1476 TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(method), debugstr_w(url),
1477 debugstr_variant(&async));
1478 return httprequest_open(This, method, url, async, user, password);
1479}
1480
1482{
1484 TRACE("(%p)->(%s %s)\n", This, debugstr_w(header), debugstr_w(value));
1486}
1487
1489{
1491 TRACE("(%p)->(%s %p)\n", This, debugstr_w(header), value);
1493}
1494
1495static HRESULT WINAPI XMLHTTPRequest_getAllResponseHeaders(IXMLHTTPRequest *iface, BSTR *respheaders)
1496{
1498 TRACE("(%p)->(%p)\n", This, respheaders);
1499 return httprequest_getAllResponseHeaders(This, respheaders);
1500}
1501
1502static HRESULT WINAPI XMLHTTPRequest_send(IXMLHTTPRequest *iface, VARIANT body)
1503{
1505 TRACE("(%p)->(%s)\n", This, debugstr_variant(&body));
1506 return httprequest_send(This, body);
1507}
1508
1509static HRESULT WINAPI XMLHTTPRequest_abort(IXMLHTTPRequest *iface)
1510{
1512 TRACE("(%p)\n", This);
1513 return httprequest_abort(This);
1514}
1515
1516static HRESULT WINAPI XMLHTTPRequest_get_status(IXMLHTTPRequest *iface, LONG *status)
1517{
1519 TRACE("(%p)->(%p)\n", This, status);
1521}
1522
1524{
1526 TRACE("(%p)->(%p)\n", This, status);
1528}
1529
1531{
1533 TRACE("(%p)->(%p)\n", This, body);
1535}
1536
1538{
1540 TRACE("(%p)->(%p)\n", This, body);
1542}
1543
1545{
1547 TRACE("(%p)->(%p)\n", This, body);
1549}
1550
1552{
1554 TRACE("(%p)->(%p)\n", This, body);
1556}
1557
1559{
1561 TRACE("(%p)->(%p)\n", This, state);
1563}
1564
1566{
1568 TRACE("(%p)->(%p)\n", This, sink);
1570}
1571
1572static const struct IXMLHTTPRequestVtbl XMLHTTPRequestVtbl =
1573{
1595};
1596
1597/* IObjectWithSite */
1598static HRESULT WINAPI
1600{
1602 return IXMLHTTPRequest_QueryInterface(&This->IXMLHTTPRequest_iface, riid, ppvObject);
1603}
1604
1606{
1608 return IXMLHTTPRequest_AddRef(&This->IXMLHTTPRequest_iface);
1609}
1610
1612{
1614 return IXMLHTTPRequest_Release(&This->IXMLHTTPRequest_iface);
1615}
1616
1618{
1620
1621 TRACE("(%p)->(%s %p)\n", This, debugstr_guid( iid ), ppvSite );
1622
1623 if ( !This->site )
1624 return E_FAIL;
1625
1626 return IUnknown_QueryInterface( This->site, iid, ppvSite );
1627}
1628
1630{
1631 IServiceProvider *provider;
1632 IHTMLDocument2 *doc;
1633 IUri *uri;
1634 BSTR url;
1635 HRESULT hr;
1636
1637 hr = IUnknown_QueryInterface(site, &IID_IServiceProvider, (void**)&provider);
1638 if(FAILED(hr))
1639 return NULL;
1640
1641 hr = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument2, (void**)&doc);
1642 if(FAILED(hr))
1643 hr = IServiceProvider_QueryService(provider, &SID_SInternetHostSecurityManager, &IID_IHTMLDocument2, (void**)&doc);
1644 IServiceProvider_Release(provider);
1645 if(FAILED(hr))
1646 return NULL;
1647
1648 hr = IHTMLDocument2_get_URL(doc, &url);
1649 IHTMLDocument2_Release(doc);
1650 if(FAILED(hr) || !url || !*url)
1651 return NULL;
1652
1653 TRACE("host url %s\n", debugstr_w(url));
1654
1655 hr = CreateUri(url, 0, 0, &uri);
1657 if(FAILED(hr))
1658 return NULL;
1659
1660 return uri;
1661}
1662
1664{
1666
1667 TRACE("(%p)->(%p)\n", This, punk);
1668
1669 if(This->site)
1670 IUnknown_Release( This->site );
1671 if(This->base_uri)
1672 IUri_Release(This->base_uri);
1673
1674 This->site = punk;
1675
1676 if (punk)
1677 {
1678 IUnknown_AddRef( punk );
1679 This->base_uri = get_base_uri(This->site);
1680 }
1681
1682 return S_OK;
1683}
1684
1685static const IObjectWithSiteVtbl ObjectWithSiteVtbl =
1686{
1692};
1693
1694/* IObjectSafety */
1696{
1698 return IXMLHTTPRequest_QueryInterface(&This->IXMLHTTPRequest_iface, riid, ppv);
1699}
1700
1702{
1704 return IXMLHTTPRequest_AddRef(&This->IXMLHTTPRequest_iface);
1705}
1706
1708{
1710 return IXMLHTTPRequest_Release(&This->IXMLHTTPRequest_iface);
1711}
1712
1714 DWORD *supported, DWORD *enabled)
1715{
1717
1718 TRACE("(%p)->(%s %p %p)\n", This, debugstr_guid(riid), supported, enabled);
1719
1720 if(!supported || !enabled) return E_POINTER;
1721
1722 *supported = safety_supported_options;
1723 *enabled = This->safeopt;
1724
1725 return S_OK;
1726}
1727
1730{
1732
1733 TRACE("%p, %s, %lx, %lx.\n", iface, debugstr_guid(riid), mask, enabled);
1734
1736 return E_FAIL;
1737
1738 request->safeopt = (request->safeopt & ~mask) | (mask & enabled);
1739
1740 return S_OK;
1741}
1742
1743static const IObjectSafetyVtbl ObjectSafetyVtbl = {
1749};
1750
1752{
1754 return IXMLHTTPRequest_QueryInterface(&This->IXMLHTTPRequest_iface, riid, obj);
1755}
1756
1758{
1760 return IXMLHTTPRequest_AddRef(&This->IXMLHTTPRequest_iface);
1761}
1762
1764{
1766 return IXMLHTTPRequest_Release(&This->IXMLHTTPRequest_iface);
1767}
1768
1770{
1772
1773 FIXME("(%p)->(%s)\n", This, debugstr_guid(riid));
1774
1775 return E_NOTIMPL;
1776}
1777
1778static const ISupportErrorInfoVtbl SupportErrorInfoVtbl =
1779{
1784};
1785
1786/* IServerXMLHTTPRequest */
1788{
1790
1791 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
1792
1793 if ( IsEqualGUID( riid, &IID_IServerXMLHTTPRequest) ||
1794 IsEqualGUID( riid, &IID_IXMLHTTPRequest) ||
1797 {
1798 *obj = iface;
1799 }
1800 else if ( IsEqualGUID( riid, &IID_ISupportErrorInfo ))
1801 {
1802 *obj = &This->req.ISupportErrorInfo_iface;
1803 }
1804 else
1805 {
1806 TRACE("Unsupported interface %s\n", debugstr_guid(riid));
1807 *obj = NULL;
1808 return E_NOINTERFACE;
1809 }
1810
1811 IUnknown_AddRef( (IUnknown *)*obj );
1812
1813 return S_OK;
1814}
1815
1817{
1820 TRACE("%p, refcount %lu.\n", iface, ref );
1821 return ref;
1822}
1823
1825{
1828
1829 TRACE("%p, refcount %lu.\n", iface, ref );
1830
1831 if (!ref)
1832 {
1834 free(request);
1835 }
1836
1837 return ref;
1838}
1839
1841{
1843
1844 TRACE("(%p)->(%p)\n", This, pctinfo);
1845 *pctinfo = 1;
1846
1847 return S_OK;
1848}
1849
1851 LCID lcid, ITypeInfo **ppTInfo)
1852{
1853 TRACE("%p, %u, %lx, %p.\n", iface, iTInfo, lcid, ppTInfo);
1854
1855 return get_typeinfo(IServerXMLHTTPRequest_tid, ppTInfo);
1856}
1857
1859 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
1860{
1862 HRESULT hr;
1863
1864 TRACE("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames,
1865 lcid, rgDispId);
1866
1867 if(!rgszNames || cNames == 0 || !rgDispId)
1868 return E_INVALIDARG;
1869
1871 if(SUCCEEDED(hr))
1872 {
1873 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
1874 ITypeInfo_Release(typeinfo);
1875 }
1876
1877 return hr;
1878}
1879
1881 LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
1882 EXCEPINFO *pExcepInfo, UINT *puArgErr)
1883{
1885 HRESULT hr;
1886
1887 TRACE("%p, %ld, %s %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid),
1888 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1889
1891 if(SUCCEEDED(hr))
1892 {
1893 hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1894 ITypeInfo_Release(typeinfo);
1895 }
1896
1897 return hr;
1898}
1899
1902{
1904 TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(method), debugstr_w(url),
1905 debugstr_variant(&async));
1906 return httprequest_open(&This->req, method, url, async, user, password);
1907}
1908
1910{
1912 TRACE("(%p)->(%s %s)\n", This, debugstr_w(header), debugstr_w(value));
1914}
1915
1917{
1919 TRACE("(%p)->(%s %p)\n", This, debugstr_w(header), value);
1921}
1922
1924{
1926 TRACE("(%p)->(%p)\n", This, respheaders);
1927 return httprequest_getAllResponseHeaders(&This->req, respheaders);
1928}
1929
1931{
1933 TRACE("(%p)->(%s)\n", This, debugstr_variant(&body));
1934 return httprequest_send(&This->req, body);
1935}
1936
1938{
1940 TRACE("(%p)\n", This);
1941 return httprequest_abort(&This->req);
1942}
1943
1945{
1947 TRACE("(%p)->(%p)\n", This, status);
1948 return httprequest_get_status(&This->req, status);
1949}
1950
1952{
1954 TRACE("(%p)->(%p)\n", This, status);
1955 return httprequest_get_statusText(&This->req, status);
1956}
1957
1959{
1961 TRACE("(%p)->(%p)\n", This, body);
1962 return httprequest_get_responseXML(&This->req, body);
1963}
1964
1966{
1968 TRACE("(%p)->(%p)\n", This, body);
1969 return httprequest_get_responseText(&This->req, body);
1970}
1971
1973{
1975 TRACE("(%p)->(%p)\n", This, body);
1976 return httprequest_get_responseBody(&This->req, body);
1977}
1978
1980{
1982 TRACE("(%p)->(%p)\n", This, body);
1984}
1985
1987{
1989 TRACE("(%p)->(%p)\n", This, state);
1990 return httprequest_get_readyState(&This->req, state);
1991}
1992
1994{
1996 TRACE("(%p)->(%p)\n", This, sink);
1998}
1999
2001 LONG sendTimeout, LONG receiveTimeout)
2002{
2003 FIXME("%p, %ld, %ld, %ld, %ld: stub\n", iface, resolveTimeout, connectTimeout, sendTimeout, receiveTimeout);
2004 return S_OK;
2005}
2006
2008{
2010 FIXME("(%p)->(%s %p): stub\n", This, debugstr_variant(&timeout), isSuccessful);
2011 return E_NOTIMPL;
2012}
2013
2015{
2017 FIXME("(%p)->(%d %p): stub\n", This, option, value);
2018 return E_NOTIMPL;
2019}
2020
2022{
2024 FIXME("(%p)->(%d %s): stub\n", This, option, debugstr_variant(&value));
2025 return E_NOTIMPL;
2026}
2027
2028static const struct IServerXMLHTTPRequestVtbl ServerXMLHTTPRequestVtbl =
2029{
2055};
2056
2058{
2063 req->ref = 1;
2064
2065 req->async = FALSE;
2066 req->verb = -1;
2067 req->custom = NULL;
2068 req->uri = req->base_uri = NULL;
2069 req->user = req->password = NULL;
2070
2071 req->state = READYSTATE_UNINITIALIZED;
2072 req->sink = NULL;
2073
2074 req->bsc = NULL;
2075 req->status = 0;
2076 req->status_text = NULL;
2077 req->reqheader_size = 0;
2078 req->raw_respheaders = NULL;
2079 req->use_utf8_content = FALSE;
2080
2081 list_init(&req->reqheaders);
2082 list_init(&req->respheaders);
2083
2084 req->site = NULL;
2085 req->safeopt = 0;
2086}
2087
2089{
2090 httprequest *req;
2091
2092 TRACE("(%p)\n", obj);
2093
2094 req = malloc(sizeof(*req));
2095 if( !req )
2096 return E_OUTOFMEMORY;
2097
2098 init_httprequest(req);
2099 *obj = &req->IXMLHTTPRequest_iface;
2100
2101 TRACE("returning iface %p\n", *obj);
2102
2103 return S_OK;
2104}
2105
2107{
2108 serverhttp *req;
2109
2110 TRACE("(%p)\n", obj);
2111
2112 req = malloc(sizeof(*req));
2113 if( !req )
2114 return E_OUTOFMEMORY;
2115
2116 init_httprequest(&req->req);
2118
2120
2121 TRACE("returning iface %p\n", *obj);
2122
2123 return S_OK;
2124}
#define read
Definition: acwin.h:96
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
static int state
Definition: maze.c:121
HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret)
Definition: apps.c:124
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define ok(value,...)
Definition: atltest.h:57
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
void user(int argc, const char *argv[])
Definition: cmds.c:1350
#define ARRAY_SIZE(A)
Definition: main.h:20
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static int list_empty(struct list_entry *head)
Definition: list.h:58
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
static void list_init(struct list_entry *head)
Definition: list.h:51
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
Definition: list.h:37
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define E_PENDING
Definition: dinput.h:172
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define wcschr
Definition: compat.h:17
#define CP_ACP
Definition: compat.h:109
OLECHAR * BSTR
Definition: compat.h:2293
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
short VARIANT_BOOL
Definition: compat.h:2290
#define MultiByteToWideChar
Definition: compat.h:110
@ VT_BSTR
Definition: compat.h:2303
@ VT_NULL
Definition: compat.h:2296
@ VT_UNKNOWN
Definition: compat.h:2308
@ VT_BYREF
Definition: compat.h:2342
@ VT_ERROR
Definition: compat.h:2305
@ VT_ARRAY
Definition: compat.h:2341
@ VT_VARIANT
Definition: compat.h:2307
@ VT_BOOL
Definition: compat.h:2306
@ VT_EMPTY
Definition: compat.h:2295
@ VT_UI1
Definition: compat.h:2311
#define wcsicmp
Definition: compat.h:15
#define lstrlenW
Definition: compat.h:750
LCID lcid
Definition: locale.c:5656
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
HRESULT dom_document_create(MSXML_VERSION version, void **ppObj)
Definition: domdoc.c:3788
HRESULT WINAPI GetHGlobalFromStream(IStream *pstm, HGLOBAL *phglobal)
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
Definition: safearray.c:1033
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1137
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1168
SAFEARRAY *WINAPI SafeArrayCreate(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsabound)
Definition: safearray.c:600
HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IUri **ppURI)
Definition: uri.c:5700
HRESULT WINAPI CoInternetCombineUrlEx(IUri *pBaseUri, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, IUri **ppCombinedUri, DWORD_PTR dwReserved)
Definition: uri.c:6762
HRESULT WINAPI CreateIUriBuilder(IUri *pIUri, DWORD dwFlags, DWORD_PTR dwReserved, IUriBuilder **ppIUriBuilder)
Definition: uri.c:6353
method
Definition: dragdrop.c:54
r reserved
Definition: btrfs.c:3006
static unsigned char buff[32768]
Definition: fatten.c:17
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLuint mask
Definition: glext.h:6028
GLenum const GLfloat * params
Definition: glext.h:5645
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint in
Definition: glext.h:9616
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
GLenum GLsizei len
Definition: glext.h:6722
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
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
static void httprequest_release(httprequest *This)
Definition: httprequest.c:1330
static const WCHAR colspaceW[]
Definition: httprequest.c:45
static HRESULT httprequest_getResponseHeader(httprequest *This, BSTR header, BSTR *value)
Definition: httprequest.c:1024
static HRESULT WINAPI XMLHTTPRequest_GetTypeInfo(IXMLHTTPRequest *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: httprequest.c:1422
static ULONG WINAPI httprequest_Safety_AddRef(IObjectSafety *iface)
Definition: httprequest.c:1701
static HRESULT WINAPI BSCHttpNegotiate_OnResponse(IHttpNegotiate *iface, DWORD code, LPCWSTR resp_headers, LPCWSTR req_headers, LPWSTR *add_reqheaders)
Definition: httprequest.c:569
static HRESULT WINAPI Authenticate_QueryInterface(IAuthenticate *iface, REFIID riid, void **ppv)
Definition: httprequest.c:627
static HRESULT WINAPI XMLHTTPRequest_get_status(IXMLHTTPRequest *iface, LONG *status)
Definition: httprequest.c:1516
static httprequest * impl_from_IXMLHTTPRequest(IXMLHTTPRequest *iface)
Definition: httprequest.c:110
static HRESULT WINAPI ServerXMLHTTPRequest_getOption(IServerXMLHTTPRequest *iface, SERVERXMLHTTP_OPTION option, VARIANT *value)
Definition: httprequest.c:2014
static HRESULT WINAPI ServerXMLHTTPRequest_get_responseStream(IServerXMLHTTPRequest *iface, VARIANT *body)
Definition: httprequest.c:1979
static HRESULT WINAPI XMLHTTPRequest_open(IXMLHTTPRequest *iface, BSTR method, BSTR url, VARIANT async, VARIANT user, VARIANT password)
Definition: httprequest.c:1472
static HRESULT WINAPI httprequest_Safety_QueryInterface(IObjectSafety *iface, REFIID riid, void **ppv)
Definition: httprequest.c:1695
static const DWORD safety_supported_options
Definition: httprequest.c:47
static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallback *iface)
Definition: httprequest.c:271
static httprequest * impl_from_IObjectSafety(IObjectSafety *iface)
Definition: httprequest.c:120
static HRESULT WINAPI SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo *iface, REFIID riid)
Definition: httprequest.c:1769
static void BindStatusCallback_Detach(BindStatusCallback *bsc)
Definition: httprequest.c:219
static HRESULT WINAPI ServerXMLHTTPRequest_send(IServerXMLHTTPRequest *iface, VARIANT body)
Definition: httprequest.c:1930
IUri * get_base_uri(IUnknown *site)
Definition: httprequest.c:1629
static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
Definition: httprequest.c:416
static const IObjectWithSiteVtbl ObjectWithSiteVtbl
Definition: httprequest.c:1685
static HRESULT WINAPI ServerXMLHTTPRequest_getAllResponseHeaders(IServerXMLHTTPRequest *iface, BSTR *respheaders)
Definition: httprequest.c:1923
static HRESULT WINAPI Authenticate_Authenticate(IAuthenticate *iface, HWND *hwnd, LPWSTR *username, LPWSTR *password)
Definition: httprequest.c:646
static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *iface, DWORD reserved)
Definition: httprequest.c:325
static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallback *iface, LONG *pPriority)
Definition: httprequest.c:316
static void free_request_headers(httprequest *This)
Definition: httprequest.c:174
static HRESULT WINAPI httprequest_Safety_GetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD *supported, DWORD *enabled)
Definition: httprequest.c:1713
static HRESULT httprequest_abort(httprequest *This)
Definition: httprequest.c:1085
static HRESULT httprequest_getAllResponseHeaders(httprequest *This, BSTR *respheaders)
Definition: httprequest.c:1061
static httprequest * impl_from_IObjectWithSite(IObjectWithSite *iface)
Definition: httprequest.c:115
HRESULT ServerXMLHTTP_create(void **obj)
Definition: httprequest.c:2106
static HRESULT WINAPI XMLHTTPRequest_put_onreadystatechange(IXMLHTTPRequest *iface, IDispatch *sink)
Definition: httprequest.c:1565
static HRESULT WINAPI XMLHTTPRequest_getAllResponseHeaders(IXMLHTTPRequest *iface, BSTR *respheaders)
Definition: httprequest.c:1495
static ULONG WINAPI XMLHTTPRequest_Release(IXMLHTTPRequest *iface)
Definition: httprequest.c:1397
static HRESULT WINAPI ServerXMLHTTPRequest_abort(IServerXMLHTTPRequest *iface)
Definition: httprequest.c:1937
static HRESULT httprequest_open(httprequest *This, BSTR method, BSTR url, VARIANT async, VARIANT user, VARIANT password)
Definition: httprequest.c:869
static void add_response_header(httprequest *This, const WCHAR *data, int len)
Definition: httprequest.c:538
static HRESULT WINAPI ServerXMLHTTPRequest_setTimeouts(IServerXMLHTTPRequest *iface, LONG resolveTimeout, LONG connectTimeout, LONG sendTimeout, LONG receiveTimeout)
Definition: httprequest.c:2000
static HRESULT WINAPI ServerXMLHTTPRequest_put_onreadystatechange(IServerXMLHTTPRequest *iface, IDispatch *sink)
Definition: httprequest.c:1993
static HRESULT httprequest_get_responseBody(httprequest *This, VARIANT *body)
Definition: httprequest.c:1242
static HRESULT WINAPI ServerXMLHTTPRequest_setOption(IServerXMLHTTPRequest *iface, SERVERXMLHTTP_OPTION option, VARIANT value)
Definition: httprequest.c:2021
static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
Definition: httprequest.c:281
static ULONG WINAPI XMLHTTPRequest_AddRef(IXMLHTTPRequest *iface)
Definition: httprequest.c:1389
static HRESULT httprequest_setRequestHeader(httprequest *This, BSTR header, BSTR value)
Definition: httprequest.c:983
static HRESULT WINAPI XMLHTTPRequest_get_responseXML(IXMLHTTPRequest *iface, IDispatch **body)
Definition: httprequest.c:1530
static HRESULT WINAPI ServerXMLHTTPRequest_open(IServerXMLHTTPRequest *iface, BSTR method, BSTR url, VARIANT async, VARIANT user, VARIANT password)
Definition: httprequest.c:1900
static HRESULT WINAPI XMLHTTPRequest_setRequestHeader(IXMLHTTPRequest *iface, BSTR header, BSTR value)
Definition: httprequest.c:1481
static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *iface, DWORD reserved, IBinding *pbind)
Definition: httprequest.c:299
static HRESULT httprequest_put_onreadystatechange(httprequest *This, IDispatch *sink)
Definition: httprequest.c:1322
static unsigned int detect_response_encoding(const BYTE *in, unsigned int len)
Definition: httprequest.c:1126
static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate *iface, LPCWSTR url, LPCWSTR headers, DWORD reserved, LPWSTR *add_headers)
Definition: httprequest.c:459
static HRESULT WINAPI ServerXMLHTTPRequest_setRequestHeader(IServerXMLHTTPRequest *iface, BSTR header, BSTR value)
Definition: httprequest.c:1909
static ULONG WINAPI SupportErrorInfo_AddRef(ISupportErrorInfo *iface)
Definition: httprequest.c:1757
static const WCHAR crlfW[]
Definition: httprequest.c:46
static const IBindStatusCallbackVtbl BindStatusCallbackVtbl
Definition: httprequest.c:426
static HRESULT WINAPI XMLHTTPRequest_get_responseText(IXMLHTTPRequest *iface, BSTR *body)
Definition: httprequest.c:1537
static HRESULT WINAPI httprequest_ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *punk)
Definition: httprequest.c:1663
static const IObjectSafetyVtbl ObjectSafetyVtbl
Definition: httprequest.c:1743
static HRESULT WINAPI ServerXMLHTTPRequest_waitForResponse(IServerXMLHTTPRequest *iface, VARIANT timeout, VARIANT_BOOL *isSuccessful)
Definition: httprequest.c:2007
static HRESULT httprequest_get_responseXML(httprequest *This, IDispatch **body)
Definition: httprequest.c:1215
static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallback *iface, DWORD *bind_flags, BINDINFO *pbindinfo)
Definition: httprequest.c:364
static HRESULT WINAPI ServerXMLHTTPRequest_GetTypeInfoCount(IServerXMLHTTPRequest *iface, UINT *pctinfo)
Definition: httprequest.c:1840
static HRESULT WINAPI ServerXMLHTTPRequest_get_responseBody(IServerXMLHTTPRequest *iface, VARIANT *body)
Definition: httprequest.c:1972
static HRESULT WINAPI ServerXMLHTTPRequest_QueryInterface(IServerXMLHTTPRequest *iface, REFIID riid, void **obj)
Definition: httprequest.c:1787
static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *iface, HRESULT hr, LPCWSTR error)
Definition: httprequest.c:341
static HRESULT WINAPI ServerXMLHTTPRequest_GetIDsOfNames(IServerXMLHTTPRequest *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: httprequest.c:1858
static ULONG WINAPI BSCHttpNegotiate_Release(IHttpNegotiate *iface)
Definition: httprequest.c:453
static HRESULT WINAPI ServerXMLHTTPRequest_GetTypeInfo(IServerXMLHTTPRequest *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: httprequest.c:1850
static BindStatusCallback * impl_from_IAuthenticate(IAuthenticate *iface)
Definition: httprequest.c:214
static ULONG WINAPI Authenticate_AddRef(IAuthenticate *iface)
Definition: httprequest.c:634
static ULONG WINAPI ServerXMLHTTPRequest_AddRef(IServerXMLHTTPRequest *iface)
Definition: httprequest.c:1816
static HRESULT WINAPI httprequest_Safety_SetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD mask, DWORD enabled)
Definition: httprequest.c:1728
static HRESULT WINAPI httprequest_ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID riid, void **ppvObject)
Definition: httprequest.c:1599
static HRESULT WINAPI ServerXMLHTTPRequest_getResponseHeader(IServerXMLHTTPRequest *iface, BSTR header, BSTR *value)
Definition: httprequest.c:1916
static HRESULT WINAPI XMLHTTPRequest_QueryInterface(IXMLHTTPRequest *iface, REFIID riid, void **ppvObject)
Definition: httprequest.c:1354
static HRESULT BindStatusCallback_create(httprequest *This, BindStatusCallback **obj, const VARIANT *body)
Definition: httprequest.c:680
static HRESULT WINAPI XMLHTTPRequest_get_readyState(IXMLHTTPRequest *iface, LONG *state)
Definition: httprequest.c:1558
static HRESULT WINAPI SupportErrorInfo_QueryInterface(ISupportErrorInfo *iface, REFIID riid, void **obj)
Definition: httprequest.c:1751
static HRESULT WINAPI ServerXMLHTTPRequest_Invoke(IServerXMLHTTPRequest *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: httprequest.c:1880
static HRESULT httprequest_get_status(httprequest *This, LONG *status)
Definition: httprequest.c:1094
static ULONG WINAPI SupportErrorInfo_Release(ISupportErrorInfo *iface)
Definition: httprequest.c:1763
static HRESULT WINAPI XMLHTTPRequest_get_responseBody(IXMLHTTPRequest *iface, VARIANT *body)
Definition: httprequest.c:1544
static HRESULT WINAPI XMLHTTPRequest_getResponseHeader(IXMLHTTPRequest *iface, BSTR header, BSTR *value)
Definition: httprequest.c:1488
static HRESULT WINAPI XMLHTTPRequest_get_statusText(IXMLHTTPRequest *iface, BSTR *status)
Definition: httprequest.c:1523
static HRESULT WINAPI ServerXMLHTTPRequest_get_status(IServerXMLHTTPRequest *iface, LONG *status)
Definition: httprequest.c:1944
static void init_httprequest(httprequest *req)
Definition: httprequest.c:2057
static HRESULT WINAPI ServerXMLHTTPRequest_get_responseXML(IServerXMLHTTPRequest *iface, IDispatch **body)
Definition: httprequest.c:1958
response_encoding
Definition: httprequest.c:1114
@ RESPONSE_ENCODING_UCS4_3412
Definition: httprequest.c:1119
@ RESPONSE_ENCODING_UTF8
Definition: httprequest.c:1121
@ RESPONSE_ENCODING_UCS4_2143
Definition: httprequest.c:1118
@ RESPONSE_ENCODING_UTF16LE
Definition: httprequest.c:1122
@ RESPONSE_ENCODING_UCS4LE
Definition: httprequest.c:1117
@ RESPONSE_ENCODING_UTF16BE
Definition: httprequest.c:1123
@ RESPONSE_ENCODING_UCS4BE
Definition: httprequest.c:1116
@ RESPONSE_ENCODING_NONE
Definition: httprequest.c:1115
@ RESPONSE_ENCODING_EBCDIC
Definition: httprequest.c:1120
static HRESULT WINAPI XMLHTTPRequest_abort(IXMLHTTPRequest *iface)
Definition: httprequest.c:1509
static HRESULT WINAPI XMLHTTPRequest_get_responseStream(IXMLHTTPRequest *iface, VARIANT *body)
Definition: httprequest.c:1551
HRESULT XMLHTTPRequest_create(void **obj)
Definition: httprequest.c:2088
static ULONG WINAPI BSCHttpNegotiate_AddRef(IHttpNegotiate *iface)
Definition: httprequest.c:447
static ULONG WINAPI httprequest_ObjectWithSite_AddRef(IObjectWithSite *iface)
Definition: httprequest.c:1605
static HRESULT WINAPI BSCHttpNegotiate_QueryInterface(IHttpNegotiate *iface, REFIID riid, void **ppv)
Definition: httprequest.c:440
static HRESULT httprequest_send(httprequest *This, VARIANT body)
Definition: httprequest.c:1070
static void free_response_headers(httprequest *This)
Definition: httprequest.c:158
static ULONG WINAPI ServerXMLHTTPRequest_Release(IServerXMLHTTPRequest *iface)
Definition: httprequest.c:1824
static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: httprequest.c:332
static HRESULT WINAPI XMLHTTPRequest_GetIDsOfNames(IXMLHTTPRequest *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: httprequest.c:1430
static const IHttpNegotiateVtbl BSCHttpNegotiateVtbl
Definition: httprequest.c:619
static BindStatusCallback * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: httprequest.c:204
static const IAuthenticateVtbl AuthenticateVtbl
Definition: httprequest.c:673
static void httprequest_setreadystate(httprequest *This, READYSTATE state)
Definition: httprequest.c:135
static const struct IXMLHTTPRequestVtbl XMLHTTPRequestVtbl
Definition: httprequest.c:1572
static BindStatusCallback * impl_from_IHttpNegotiate(IHttpNegotiate *iface)
Definition: httprequest.c:209
static const struct IServerXMLHTTPRequestVtbl ServerXMLHTTPRequestVtbl
Definition: httprequest.c:2028
static HRESULT WINAPI XMLHTTPRequest_send(IXMLHTTPRequest *iface, VARIANT body)
Definition: httprequest.c:1502
static httprequest * impl_from_ISupportErrorInfo(ISupportErrorInfo *iface)
Definition: httprequest.c:125
static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *iface, DWORD flags, DWORD size, FORMATETC *format, STGMEDIUM *stgmed)
Definition: httprequest.c:393
static HRESULT WINAPI ServerXMLHTTPRequest_get_readyState(IServerXMLHTTPRequest *iface, LONG *state)
Definition: httprequest.c:1986
static ULONG WINAPI httprequest_Safety_Release(IObjectSafety *iface)
Definition: httprequest.c:1707
static ULONG WINAPI httprequest_ObjectWithSite_Release(IObjectWithSite *iface)
Definition: httprequest.c:1611
static HRESULT WINAPI XMLHTTPRequest_Invoke(IXMLHTTPRequest *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: httprequest.c:1452
static ULONG WINAPI Authenticate_Release(IAuthenticate *iface)
Definition: httprequest.c:640
static HRESULT WINAPI ServerXMLHTTPRequest_get_responseText(IServerXMLHTTPRequest *iface, BSTR *body)
Definition: httprequest.c:1965
static HRESULT httprequest_get_responseText(httprequest *This, BSTR *body)
Definition: httprequest.c:1165
static HRESULT WINAPI httprequest_ObjectWithSite_GetSite(IObjectWithSite *iface, REFIID iid, void **ppvSite)
Definition: httprequest.c:1617
static HRESULT WINAPI ServerXMLHTTPRequest_get_statusText(IServerXMLHTTPRequest *iface, BSTR *status)
Definition: httprequest.c:1951
static HRESULT verify_uri(httprequest *This, IUri *uri)
Definition: httprequest.c:822
static const ISupportErrorInfoVtbl SupportErrorInfoVtbl
Definition: httprequest.c:1778
static HRESULT WINAPI XMLHTTPRequest_GetTypeInfoCount(IXMLHTTPRequest *iface, UINT *pctinfo)
Definition: httprequest.c:1413
static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface, REFIID riid, void **ppv)
Definition: httprequest.c:230
static serverhttp * impl_from_IServerXMLHTTPRequest(IServerXMLHTTPRequest *iface)
Definition: httprequest.c:130
static HRESULT httprequest_get_readyState(httprequest *This, LONG *state)
Definition: httprequest.c:1314
static HRESULT httprequest_get_responseStream(httprequest *This, VARIANT *body)
Definition: httprequest.c:1292
static HRESULT httprequest_get_statusText(httprequest *This, BSTR *status)
Definition: httprequest.c:1103
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
POINT cp
Definition: magnifier.c:59
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
const IID IID_IObjectWithSite
static const WCHAR url[]
Definition: encode.c:1384
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
static UINT UINT last
Definition: font.c:45
static IActiveScriptSite * site
Definition: script.c:149
static char * dest
Definition: rtl.c:135
static LPOLESTR
Definition: stg_prop.c:27
static VARIANTARG static DISPID
Definition: ordinal.c:49
const char * uri
Definition: sec_mgr.c:1588
static WCHAR password[]
Definition: url.c:33
static WCHAR username[]
Definition: url.c:32
@ MSXML_DEFAULT
Definition: msxml_dispex.h:28
@ IServerXMLHTTPRequest_tid
Definition: msxml_dispex.h:78
@ IXMLHTTPRequest_tid
Definition: msxml_dispex.h:61
unsigned int UINT
Definition: ndis.h:50
#define LOCALE_SYSTEM_DEFAULT
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556
UINT WINAPI SysStringByteLen(BSTR str)
Definition: oleaut.c:215
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
INT WINAPI SysReAllocString(LPBSTR old, LPCOLESTR str)
Definition: oleaut.c:467
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
BSTR WINAPI DECLSPEC_HOTPATCH SysAllocStringByteLen(LPCSTR str, UINT len)
Definition: oleaut.c:428
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
#define V_BOOL(A)
Definition: oleauto.h:224
#define V_ARRAY(A)
Definition: oleauto.h:222
#define V_UNKNOWN(A)
Definition: oleauto.h:281
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define V_VARIANTREF(A)
Definition: oleauto.h:283
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
const GUID IID_IDispatch
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define IID_NULL
Definition: guiddef.h:98
_In_opt_ IUnknown * punk
Definition: shlwapi.h:158
const WCHAR * str
DWORD scheme
DWORD LCID
Definition: nls.h:13
#define CP_UTF8
Definition: nls.h:20
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
Definition: md5.c:100
#define memset(x, y, z)
Definition: compat.h:39
vector< Header * > headers
Definition: sdkparse.cpp:39
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
IBinding * binding
Definition: navigate.c:50
IBindStatusCallback IBindStatusCallback_iface
Definition: navigate.c:43
IHttpNegotiate IHttpNegotiate_iface
Definition: navigate.c:44
httprequest * request
Definition: httprequest.c:195
IAuthenticate IAuthenticate_iface
Definition: httprequest.c:191
Definition: undname.c:54
Definition: xmldoc.c:231
IBindStatusCallback IBindStatusCallback_iface
Definition: xmldoc.c:232
Definition: inflate.c:139
Definition: format.c:58
WCHAR * value
Definition: txthost.c:37
BSTR header
Definition: httprequest.c:57
struct list entry
Definition: httprequest.c:56
BSTR value
Definition: httprequest.c:58
DWORD safeopt
Definition: httprequest.c:101
ISupportErrorInfo ISupportErrorInfo_iface
Definition: httprequest.c:66
BSTR password
Definition: httprequest.c:90
BSTR raw_respheaders
Definition: httprequest.c:86
IUri * base_uri
Definition: httprequest.c:76
struct list reqheaders
Definition: httprequest.c:78
IObjectWithSite IObjectWithSite_iface
Definition: httprequest.c:64
LONG reqheader_size
Definition: httprequest.c:80
BindStatusCallback * bsc
Definition: httprequest.c:93
IXMLHTTPRequest IXMLHTTPRequest_iface
Definition: httprequest.c:63
struct list respheaders
Definition: httprequest.c:85
BINDVERB verb
Definition: httprequest.c:73
IObjectSafety IObjectSafety_iface
Definition: httprequest.c:65
BOOL use_utf8_content
Definition: httprequest.c:82
IUnknown * site
Definition: httprequest.c:98
IUri * uri
Definition: httprequest.c:75
BSTR status_text
Definition: httprequest.c:95
IDispatch * sink
Definition: httprequest.c:70
READYSTATE state
Definition: httprequest.c:69
Definition: parser.c:49
Definition: main.c:40
Definition: getopt.h:109
Definition: send.c:48
Definition: tftpd.h:86
WCHAR * password
IServerXMLHTTPRequest IServerXMLHTTPRequest_iface
Definition: httprequest.c:107
httprequest req
Definition: httprequest.c:106
Definition: ps.c:97
Definition: parse.h:23
Definition: dhcpd.h:248
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
HRESULT WINAPI CreateURLMonikerEx2(IMoniker *pmkContext, IUri *pUri, IMoniker **ppmk, DWORD dwFlags)
Definition: umon.c:668
LONGLONG QuadPart
Definition: typedefs.h:114
Definition: pdh_main.c:96
HRESULT WINAPI RegisterBindStatusCallback(IBindCtx *pbc, IBindStatusCallback *pbsc, IBindStatusCallback **ppbscPrevious, DWORD dwReserved)
Definition: bindctx.c:615
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
#define GMEM_FIXED
Definition: winbase.h:317
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon_undoc.h:337
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:3451
#define E_NOINTERFACE
Definition: winerror.h:3479
#define E_ACCESSDENIED
Definition: winerror.h:4116
#define E_POINTER
Definition: winerror.h:3480
@ INTERNET_SCHEME_UNKNOWN
Definition: wininet.h:137
const char * LPCSTR
Definition: xmlstorage.h:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
unsigned char BYTE
Definition: xxhash.c:193