OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <htiframe.h> | 5 #include <htiframe.h> |
6 #include <mshtml.h> | 6 #include <mshtml.h> |
7 | 7 |
8 #include "chrome_frame/protocol_sink_wrap.h" | 8 #include "chrome_frame/protocol_sink_wrap.h" |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 return true; | 266 return true; |
267 if (LowerCaseEqualsASCII(str, "video/webm")) | 267 if (LowerCaseEqualsASCII(str, "video/webm")) |
268 return true; | 268 return true; |
269 if (LowerCaseEqualsASCII(str, "video/mp4")) | 269 if (LowerCaseEqualsASCII(str, "video/mp4")) |
270 return true; | 270 return true; |
271 | 271 |
272 return false; | 272 return false; |
273 } | 273 } |
274 | 274 |
275 // Returns: | 275 // Returns: |
276 // CHROME: if suggested mime type is a supported one and at least one of the | 276 // RENDERER_TYPE_OTHER: if suggested mime type is not text/html. |
277 // following is true: 1) X-UA-Compatible tag is in HTTP headers. | 277 // RENDERER_TYPE_UNDETERMINED: if suggested mime type is text/html. |
278 // 2) Url is listed in OptInURLs registry key. | 278 // RENDERER_TYPE_CHROME_RESPONSE_HEADER: X-UA-Compatible tag is in HTTP headers. |
279 // OTHER: if suggested mime type is not text/html. | 279 // RENDERER_TYPE_CHROME_DEFAULT_RENDERER: GCF is the default renderer and the |
280 // UNDETERMINED: if suggested mime type is text/html. | 280 // Url is not listed in the |
| 281 // RenderInHostUrls registry key. |
| 282 // RENDERER_TYPE_CHROME_OPT_IN_URL: GCF is not the default renderer and the Url |
| 283 // is listed in the RenderInGcfUrls registry |
| 284 // key. |
281 RendererType DetermineRendererTypeFromMetaData( | 285 RendererType DetermineRendererTypeFromMetaData( |
282 const wchar_t* suggested_mime_type, | 286 const wchar_t* suggested_mime_type, |
283 const std::wstring& url, | 287 const std::wstring& url, |
284 IWinInetHttpInfo* info) { | 288 IWinInetHttpInfo* info) { |
285 | 289 |
286 bool is_text_html = IsTextHtml(suggested_mime_type); | 290 bool is_text_html = IsTextHtml(suggested_mime_type); |
287 bool is_supported_content_type = is_text_html || | 291 bool is_supported_content_type = is_text_html || |
288 IsAdditionallySupportedContentType(suggested_mime_type); | 292 IsAdditionallySupportedContentType(suggested_mime_type); |
289 | 293 |
290 if (!is_supported_content_type) | 294 if (!is_supported_content_type) |
291 return OTHER; | 295 return RENDERER_TYPE_OTHER; |
292 | 296 |
293 if (!url.empty() && IsOptInUrl(url.c_str())) { | 297 if (!url.empty()) { |
294 return CHROME; | 298 RendererType renderer_type = RendererTypeForUrl(url); |
| 299 if (IsChrome(renderer_type)) { |
| 300 return renderer_type; |
| 301 } |
295 } | 302 } |
296 | 303 |
297 if (info) { | 304 if (info) { |
298 char buffer[32] = "x-ua-compatible"; | 305 char buffer[32] = "x-ua-compatible"; |
299 DWORD len = sizeof(buffer); | 306 DWORD len = sizeof(buffer); |
300 DWORD flags = 0; | 307 DWORD flags = 0; |
301 HRESULT hr = info->QueryInfo(HTTP_QUERY_CUSTOM, buffer, &len, &flags, NULL); | 308 HRESULT hr = info->QueryInfo(HTTP_QUERY_CUSTOM, buffer, &len, &flags, NULL); |
302 if (hr == S_OK && len > 0) { | 309 if (hr == S_OK && len > 0) { |
303 if (StrStrIA(buffer, "chrome=1")) { | 310 if (StrStrIA(buffer, "chrome=1")) { |
304 return CHROME; | 311 return RENDERER_TYPE_CHROME_RESPONSE_HEADER; |
305 } | 312 } |
306 } | 313 } |
307 } | 314 } |
308 | 315 |
309 // We can (and want) to sniff the content. | 316 // We can (and want) to sniff the content. |
310 if (is_text_html) { | 317 if (is_text_html) { |
311 return UNDETERMINED; | 318 return RENDERER_TYPE_UNDETERMINED; |
312 } | 319 } |
313 | 320 |
314 // We cannot sniff the content. | 321 // We cannot sniff the content. |
315 return OTHER; | 322 return RENDERER_TYPE_OTHER; |
316 } | 323 } |
317 | 324 |
318 RendererType DetermineRendererType(void* buffer, DWORD size, bool last_chance) { | 325 RendererType DetermineRendererType(void* buffer, DWORD size, bool last_chance) { |
319 RendererType type = UNDETERMINED; | 326 RendererType renderer_type = RENDERER_TYPE_UNDETERMINED; |
320 if (last_chance) | 327 if (last_chance) |
321 type = OTHER; | 328 renderer_type = RENDERER_TYPE_OTHER; |
322 | 329 |
323 std::wstring html_contents; | 330 std::wstring html_contents; |
324 // TODO(joshia): detect and handle different content encodings | 331 // TODO(joshia): detect and handle different content encodings |
325 UTF8ToWide(reinterpret_cast<char*>(buffer), size, &html_contents); | 332 UTF8ToWide(reinterpret_cast<char*>(buffer), size, &html_contents); |
326 | 333 |
327 // Note that document_contents_ may have NULL characters in it. While | 334 // Note that document_contents_ may have NULL characters in it. While |
328 // browsers may handle this properly, we don't and will stop scanning | 335 // browsers may handle this properly, we don't and will stop scanning |
329 // for the XUACompat content value if we encounter one. | 336 // for the XUACompat content value if we encounter one. |
330 std::wstring xua_compat_content; | 337 std::wstring xua_compat_content; |
331 UtilGetXUACompatContentValue(html_contents, &xua_compat_content); | 338 UtilGetXUACompatContentValue(html_contents, &xua_compat_content); |
332 if (StrStrI(xua_compat_content.c_str(), kChromeContentPrefix)) { | 339 if (StrStrI(xua_compat_content.c_str(), kChromeContentPrefix)) { |
333 type = CHROME; | 340 renderer_type = RENDERER_TYPE_CHROME_HTTP_EQUIV; |
334 } | 341 } |
335 | 342 |
336 return type; | 343 return renderer_type; |
337 } | 344 } |
338 | 345 |
339 // ProtData | 346 // ProtData |
340 ProtData::ProtData(IInternetProtocol* protocol, | 347 ProtData::ProtData(IInternetProtocol* protocol, |
341 InternetProtocol_Read_Fn read_fun, const wchar_t* url) | 348 InternetProtocol_Read_Fn read_fun, const wchar_t* url) |
342 : has_suggested_mime_type_(false), has_server_mime_type_(false), | 349 : has_suggested_mime_type_(false), has_server_mime_type_(false), |
343 buffer_size_(0), buffer_pos_(0), | 350 buffer_size_(0), buffer_pos_(0), |
344 renderer_type_(UNDETERMINED), protocol_(protocol), read_fun_(read_fun), | 351 renderer_type_(RENDERER_TYPE_UNDETERMINED), protocol_(protocol), |
345 url_(url) { | 352 read_fun_(read_fun), url_(url) { |
346 memset(buffer_, 0, arraysize(buffer_)); | 353 memset(buffer_, 0, arraysize(buffer_)); |
347 DLOG(INFO) << __FUNCTION__ << " " << this; | 354 DLOG(INFO) << __FUNCTION__ << " " << this; |
348 | 355 |
349 // Add to map. | 356 // Add to map. |
350 AutoLock lock(datamap_lock_); | 357 AutoLock lock(datamap_lock_); |
351 DCHECK(datamap_.end() == datamap_.find(protocol_)); | 358 DCHECK(datamap_.end() == datamap_.find(protocol_)); |
352 datamap_[protocol] = this; | 359 datamap_[protocol] = this; |
353 } | 360 } |
354 | 361 |
355 ProtData::~ProtData() { | 362 ProtData::~ProtData() { |
356 DLOG(INFO) << __FUNCTION__ << " " << this; | 363 DLOG(INFO) << __FUNCTION__ << " " << this; |
357 Invalidate(); | 364 Invalidate(); |
358 } | 365 } |
359 | 366 |
360 HRESULT ProtData::Read(void* buffer, ULONG size, ULONG* size_read) { | 367 HRESULT ProtData::Read(void* buffer, ULONG size, ULONG* size_read) { |
361 if (renderer_type_ == UNDETERMINED) { | 368 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { |
362 return E_PENDING; | 369 return E_PENDING; |
363 } | 370 } |
364 | 371 |
365 const ULONG bytes_available = buffer_size_ - buffer_pos_; | 372 const ULONG bytes_available = buffer_size_ - buffer_pos_; |
366 const ULONG bytes_to_copy = std::min(bytes_available, size); | 373 const ULONG bytes_to_copy = std::min(bytes_available, size); |
367 if (bytes_to_copy) { | 374 if (bytes_to_copy) { |
368 // Copy from the local buffer. | 375 // Copy from the local buffer. |
369 memcpy(buffer, buffer_ + buffer_pos_, bytes_to_copy); | 376 memcpy(buffer, buffer_ + buffer_pos_, bytes_to_copy); |
370 *size_read = bytes_to_copy; | 377 *size_read = bytes_to_copy; |
371 buffer_pos_ += bytes_to_copy; | 378 buffer_pos_ += bytes_to_copy; |
(...skipping 10 matching lines...) Expand all Loading... |
382 if (size_read) | 389 if (size_read) |
383 *size_read = bytes_to_copy + new_data; | 390 *size_read = bytes_to_copy + new_data; |
384 return hr; | 391 return hr; |
385 } | 392 } |
386 | 393 |
387 return read_fun_(protocol_, buffer, size, size_read); | 394 return read_fun_(protocol_, buffer, size, size_read); |
388 } | 395 } |
389 | 396 |
390 // Attempt to detect ChromeFrame from HTTP headers when | 397 // Attempt to detect ChromeFrame from HTTP headers when |
391 // BINDSTATUS_MIMETYPEAVAILABLE is received. | 398 // BINDSTATUS_MIMETYPEAVAILABLE is received. |
392 // There are three possible outcomes: CHROME/OTHER/UNDETERMINED. | 399 // There are three possible outcomes: CHROME_*/OTHER/UNDETERMINED. |
393 // If UNDETERMINED we are going to sniff the content later in ReportData(). | 400 // If RENDERER_TYPE_UNDETERMINED we are going to sniff the content later in |
| 401 // ReportData(). |
394 // | 402 // |
395 // With not-so-well-written software (mime filters/protocols/protocol patchers) | 403 // With not-so-well-written software (mime filters/protocols/protocol patchers) |
396 // BINDSTATUS_MIMETYPEAVAILABLE might be fired multiple times with different | 404 // BINDSTATUS_MIMETYPEAVAILABLE might be fired multiple times with different |
397 // values for the same client. | 405 // values for the same client. |
398 // If the renderer_type_ member is: | 406 // If the renderer_type_ member is: |
399 // CHROME - 2nd (and any subsequent) BINDSTATUS_MIMETYPEAVAILABLE is ignored. | 407 // RENDERER_TYPE_CHROME_* - 2nd (and any subsequent) |
400 // OTHER - 2nd (and any subsequent) BINDSTATUS_MIMETYPEAVAILABLE is | 408 // BINDSTATUS_MIMETYPEAVAILABLE is ignored. |
401 // passed through. | 409 // RENDERER_TYPE_OTHER - 2nd (and any subsequent) BINDSTATUS_MIMETYPEAVAILABLE |
402 // UNDETERMINED - Try to detect ChromeFrame from HTTP headers (acts as if this | 410 // is passed through. |
403 // is the first time BINDSTATUS_MIMETYPEAVAILABLE is received). | 411 // RENDERER_TYPE_UNDETERMINED - Try to detect ChromeFrame from HTTP headers |
| 412 // (acts as if this is the first time |
| 413 // BINDSTATUS_MIMETYPEAVAILABLE is received). |
404 HRESULT ProtData::ReportProgress(IInternetProtocolSink* delegate, | 414 HRESULT ProtData::ReportProgress(IInternetProtocolSink* delegate, |
405 ULONG status_code, LPCWSTR status_text) { | 415 ULONG status_code, LPCWSTR status_text) { |
406 switch (status_code) { | 416 switch (status_code) { |
407 case BINDSTATUS_DIRECTBIND: | 417 case BINDSTATUS_DIRECTBIND: |
408 renderer_type_ = OTHER; | 418 renderer_type_ = RENDERER_TYPE_OTHER; |
409 break; | 419 break; |
410 | 420 |
411 case BINDSTATUS_REDIRECTING: | 421 case BINDSTATUS_REDIRECTING: |
412 url_.empty(); | 422 url_.empty(); |
413 if (status_text) | 423 if (status_text) |
414 url_ = status_text; | 424 url_ = status_text; |
415 break; | 425 break; |
416 | 426 |
417 case BINDSTATUS_SERVER_MIMETYPEAVAILABLE: | 427 case BINDSTATUS_SERVER_MIMETYPEAVAILABLE: |
418 has_server_mime_type_ = true; | 428 has_server_mime_type_ = true; |
419 SaveSuggestedMimeType(status_text); | 429 SaveSuggestedMimeType(status_text); |
420 return S_OK; | 430 return S_OK; |
421 | 431 |
422 // TODO(stoyan): BINDSTATUS_RAWMIMETYPE | 432 // TODO(stoyan): BINDSTATUS_RAWMIMETYPE |
423 case BINDSTATUS_MIMETYPEAVAILABLE: | 433 case BINDSTATUS_MIMETYPEAVAILABLE: |
424 case BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE: | 434 case BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE: |
425 SaveSuggestedMimeType(status_text); | 435 SaveSuggestedMimeType(status_text); |
426 // When Transaction is attached i.e. when existing BTS it terminated | 436 // When Transaction is attached i.e. when existing BTS it terminated |
427 // and "converted" to BTO, events will be re-fired for the new sink, | 437 // and "converted" to BTO, events will be re-fired for the new sink, |
428 // but we may skip the renderer_type_ determination since it's already | 438 // but we may skip the renderer_type_ determination since it's already |
429 // done. | 439 // done. |
430 if (renderer_type_ == UNDETERMINED) { | 440 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { |
431 // This may seem awkward. CBinding's implementation of IWinInetHttpInfo | 441 // This may seem awkward. CBinding's implementation of IWinInetHttpInfo |
432 // will forward to CTransaction that will forward to the real protocol. | 442 // will forward to CTransaction that will forward to the real protocol. |
433 // We may ask CTransaction (our protocol_ member) for IWinInetHttpInfo. | 443 // We may ask CTransaction (our protocol_ member) for IWinInetHttpInfo. |
434 ScopedComPtr<IWinInetHttpInfo> info; | 444 ScopedComPtr<IWinInetHttpInfo> info; |
435 info.QueryFrom(delegate); | 445 info.QueryFrom(delegate); |
436 renderer_type_ = DetermineRendererTypeFromMetaData(suggested_mime_type_, | 446 renderer_type_ = DetermineRendererTypeFromMetaData(suggested_mime_type_, |
437 url_, info); | 447 url_, info); |
438 } | 448 } |
439 | 449 |
440 if (renderer_type_ == CHROME) { | 450 if (IsChrome(renderer_type_)) { |
441 // Suggested mime type is "text/html" and we either have OptInUrl | 451 // Suggested mime type is "text/html" and we have DEFAULT_RENDERER, |
442 // or X-UA-Compatible HTTP headers. | 452 // OPT_IN_URL, or RESPONSE_HEADER. |
443 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " | 453 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " |
444 << kChromeMimeType; | 454 << kChromeMimeType; |
445 SaveReferrer(delegate); | 455 SaveReferrer(delegate); |
446 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); | 456 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); |
447 } else if (renderer_type_ == OTHER) { | 457 } else if (renderer_type_ == RENDERER_TYPE_OTHER) { |
448 // Suggested mime type is not "text/html" - we are not interested in | 458 // Suggested mime type is not "text/html" - we are not interested in |
449 // this request anymore. | 459 // this request anymore. |
450 FireSuggestedMimeType(delegate); | 460 FireSuggestedMimeType(delegate); |
451 } else { | 461 } else { |
452 // Suggested mime type is "text/html"; We will try to sniff the | 462 // Suggested mime type is "text/html"; We will try to sniff the |
453 // HTML content in ReportData. | 463 // HTML content in ReportData. |
454 DCHECK_EQ(UNDETERMINED, renderer_type_); | 464 DCHECK_EQ(RENDERER_TYPE_UNDETERMINED, renderer_type_); |
455 } | 465 } |
456 return S_OK; | 466 return S_OK; |
457 } | 467 } |
458 | 468 |
459 // We are just pass through at this point, avoid false positive crash reports. | 469 // We are just pass through at this point, avoid false positive crash reports. |
460 ExceptionBarrierReportOnlyModule barrier; | 470 ExceptionBarrierReportOnlyModule barrier; |
461 return delegate->ReportProgress(status_code, status_text); | 471 return delegate->ReportProgress(status_code, status_text); |
462 } | 472 } |
463 | 473 |
464 HRESULT ProtData::ReportData(IInternetProtocolSink* delegate, | 474 HRESULT ProtData::ReportData(IInternetProtocolSink* delegate, |
465 DWORD flags, ULONG progress, ULONG max_progress) { | 475 DWORD flags, ULONG progress, ULONG max_progress) { |
466 if (renderer_type_ != UNDETERMINED) { | 476 if (renderer_type_ != RENDERER_TYPE_UNDETERMINED) { |
467 // We are just pass through now, avoid false positive crash reports. | 477 // We are just pass through now, avoid false positive crash reports. |
468 ExceptionBarrierReportOnlyModule barrier; | 478 ExceptionBarrierReportOnlyModule barrier; |
469 return delegate->ReportData(flags, progress, max_progress); | 479 return delegate->ReportData(flags, progress, max_progress); |
470 } | 480 } |
471 | 481 |
472 HRESULT hr = FillBuffer(); | 482 HRESULT hr = FillBuffer(); |
473 | 483 |
474 bool last_chance = false; | 484 bool last_chance = false; |
475 if (hr == S_OK || hr == S_FALSE) { | 485 if (hr == S_OK || hr == S_FALSE) { |
476 last_chance = true; | 486 last_chance = true; |
477 } | 487 } |
478 | 488 |
479 renderer_type_ = DetermineRendererType(buffer_, buffer_size_, last_chance); | 489 renderer_type_ = DetermineRendererType(buffer_, buffer_size_, last_chance); |
480 | 490 |
481 if (renderer_type_ == UNDETERMINED) { | 491 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { |
482 // do not report anything, we need more data. | 492 // do not report anything, we need more data. |
483 return S_OK; | 493 return S_OK; |
484 } | 494 } |
485 | 495 |
486 if (renderer_type_ == CHROME) { | 496 if (IsChrome(renderer_type_)) { |
487 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " | 497 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " |
488 << kChromeMimeType; | 498 << kChromeMimeType; |
489 SaveReferrer(delegate); | 499 SaveReferrer(delegate); |
490 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); | 500 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); |
491 } | 501 } |
492 | 502 |
493 if (renderer_type_ == OTHER) { | 503 if (renderer_type_ == RENDERER_TYPE_OTHER) { |
494 FireSuggestedMimeType(delegate); | 504 FireSuggestedMimeType(delegate); |
495 } | 505 } |
496 | 506 |
497 // This is the first data notification we forward, since up to now we hold | 507 // This is the first data notification we forward, since up to now we hold |
498 // the content received. | 508 // the content received. |
499 flags |= BSCF_FIRSTDATANOTIFICATION; | 509 flags |= BSCF_FIRSTDATANOTIFICATION; |
500 | 510 |
501 if (hr == S_FALSE) { | 511 if (hr == S_FALSE) { |
502 flags |= (BSCF_LASTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE); | 512 flags |= (BSCF_LASTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE); |
503 } | 513 } |
504 | 514 |
505 return delegate->ReportData(flags, progress, max_progress); | 515 return delegate->ReportData(flags, progress, max_progress); |
506 } | 516 } |
507 | 517 |
508 HRESULT ProtData::ReportResult(IInternetProtocolSink* delegate, HRESULT result, | 518 HRESULT ProtData::ReportResult(IInternetProtocolSink* delegate, HRESULT result, |
509 DWORD error, LPCWSTR result_text) { | 519 DWORD error, LPCWSTR result_text) { |
510 // We may receive ReportResult without ReportData, if the connection fails | 520 // We may receive ReportResult without ReportData, if the connection fails |
511 // for example. | 521 // for example. |
512 if (renderer_type_ == UNDETERMINED) { | 522 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { |
513 DLOG(INFO) << "ReportResult received but renderer type is yet unknown."; | 523 DLOG(INFO) << "ReportResult received but renderer type is yet unknown."; |
514 renderer_type_ = OTHER; | 524 renderer_type_ = RENDERER_TYPE_OTHER; |
515 FireSuggestedMimeType(delegate); | 525 FireSuggestedMimeType(delegate); |
516 } | 526 } |
517 | 527 |
518 HRESULT hr = S_OK; | 528 HRESULT hr = S_OK; |
519 if (delegate) | 529 if (delegate) |
520 hr = delegate->ReportResult(result, error, result_text); | 530 hr = delegate->ReportResult(result, error, result_text); |
521 return hr; | 531 return hr; |
522 } | 532 } |
523 | 533 |
524 | 534 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 | 568 |
559 if (has_suggested_mime_type_) { | 569 if (has_suggested_mime_type_) { |
560 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " | 570 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " |
561 << suggested_mime_type_; | 571 << suggested_mime_type_; |
562 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, | 572 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, |
563 suggested_mime_type_); | 573 suggested_mime_type_); |
564 } | 574 } |
565 } | 575 } |
566 | 576 |
567 void ProtData::SaveReferrer(IInternetProtocolSink* delegate) { | 577 void ProtData::SaveReferrer(IInternetProtocolSink* delegate) { |
568 DCHECK_EQ(CHROME, renderer_type_); | 578 DCHECK(IsChrome(renderer_type_)); |
569 ScopedComPtr<IWinInetHttpInfo> info; | 579 ScopedComPtr<IWinInetHttpInfo> info; |
570 info.QueryFrom(delegate); | 580 info.QueryFrom(delegate); |
571 if (info) { | 581 if (info) { |
572 char buffer[4096] = {0}; | 582 char buffer[4096] = {0}; |
573 DWORD len = sizeof(buffer); | 583 DWORD len = sizeof(buffer); |
574 DWORD flags = 0; | 584 DWORD flags = 0; |
575 HRESULT hr = info->QueryInfo( | 585 HRESULT hr = info->QueryInfo( |
576 HTTP_QUERY_REFERER | HTTP_QUERY_FLAG_REQUEST_HEADERS, | 586 HTTP_QUERY_REFERER | HTTP_QUERY_FLAG_REQUEST_HEADERS, |
577 buffer, &len, &flags, 0); | 587 buffer, &len, &flags, 0); |
578 if (hr == S_OK && len > 0) | 588 if (hr == S_OK && len > 0) |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 // Explicit release, otherwise ~CComObjectStackEx will complain about | 945 // Explicit release, otherwise ~CComObjectStackEx will complain about |
936 // outstanding reference to us, because it runs before ~FakeProtocol | 946 // outstanding reference to us, because it runs before ~FakeProtocol |
937 prot.transaction_.Release(); | 947 prot.transaction_.Release(); |
938 } | 948 } |
939 } | 949 } |
940 | 950 |
941 void TransactionHooks::RevertHooks() { | 951 void TransactionHooks::RevertHooks() { |
942 vtable_patch::UnpatchInterfaceMethods(CTransaction_PatchInfo); | 952 vtable_patch::UnpatchInterfaceMethods(CTransaction_PatchInfo); |
943 vtable_patch::UnpatchInterfaceMethods(CTransaction2_PatchInfo); | 953 vtable_patch::UnpatchInterfaceMethods(CTransaction2_PatchInfo); |
944 } | 954 } |
OLD | NEW |