Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1001 lines
26 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: cnetftp.cxx
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 2-06-96 JohannP (Johann Posch) Created
  15. //
  16. //----------------------------------------------------------------------------
  17. #include <iapp.h>
  18. #ifdef unix
  19. #include <unistd.h>
  20. #endif /* unix */
  21. #include <shlwapip.h>
  22. static DWORD dwLstError;
  23. PerfDbgTag(tagCINetFile, "Urlmon", "Log CINetFile", DEB_PROT);
  24. DbgTag(tagCINetFileErr, "Urlmon", "Log CINetFile Errors", DEB_PROT|DEB_ERROR);
  25. PerfDbgTag(tagCINetSimple, "Urlmon", "Log CINetSimple", DEB_PROT);
  26. #ifdef unix
  27. extern "C" void unixForceAutoProxSync();
  28. #endif /* unix */
  29. LPWSTR FindFileExtensionW(LPWSTR pwzFileName)
  30. {
  31. DEBUG_ENTER((DBG_APP,
  32. Pointer,
  33. "FindFileExtensionW",
  34. "%.80wq",
  35. pwzFileName
  36. ));
  37. LPWSTR pStr = NULL;
  38. LPWSTR lpF = pwzFileName + wcslen(pwzFileName); //Point to null
  39. if (lpF)
  40. {
  41. //Strip all trailing dots.
  42. for (lpF--; lpF >= pwzFileName && (*lpF == L'.' || *lpF == L' '); lpF --)
  43. *lpF = 0;
  44. for (; lpF >= pwzFileName && *lpF != L'.'; lpF --)
  45. if (*lpF == L'\\')
  46. return NULL;
  47. }
  48. if (lpF > pwzFileName)
  49. {
  50. pStr = lpF;
  51. }
  52. DEBUG_LEAVE(pStr);
  53. return pStr;
  54. }
  55. //+---------------------------------------------------------------------------
  56. //
  57. // Method: CINetFile::CINetFile
  58. //
  59. // Synopsis:
  60. //
  61. // Arguments: (none)
  62. //
  63. // Returns:
  64. //
  65. // History: 2-06-96 JohannP (Johann Posch) Created
  66. //
  67. // Notes:
  68. //
  69. //----------------------------------------------------------------------------
  70. CINetFile::CINetFile(REFCLSID rclsid, IUnknown *pUnkOuter) : CINet(rclsid,pUnkOuter)
  71. {
  72. DEBUG_ENTER((DBG_APP,
  73. None,
  74. "CINetFile::CINetFile",
  75. "this=%#x, %#x, %#x",
  76. this, &rclsid, pUnkOuter
  77. ));
  78. PerfDbgLog(tagCINetFile, this, "+CINetFile::CINetFile");
  79. _dwIsA = DLD_PROTOCOL_FILE;
  80. _wzFileName[0] = '\0';
  81. PerfDbgLog(tagCINetFile, this, "-CINetFile::CINetFile");
  82. DEBUG_LEAVE(0);
  83. }
  84. //+---------------------------------------------------------------------------
  85. //
  86. // Method: CINetFile::~CINetFile
  87. //
  88. // Synopsis:
  89. //
  90. // Arguments: (none)
  91. //
  92. // Returns:
  93. //
  94. // History: 2-06-96 JohannP (Johann Posch) Created
  95. //
  96. // Notes:
  97. //
  98. //----------------------------------------------------------------------------
  99. CINetFile::~CINetFile()
  100. {
  101. DEBUG_ENTER((DBG_APP,
  102. None,
  103. "CINetFile::~CINetFile",
  104. "this=%#x",
  105. this
  106. ));
  107. PerfDbgLog(tagCINetFile, this, "+CINetFile::~CINetFile");
  108. if (_hFile && (_hFile != INVALID_HANDLE_VALUE))
  109. {
  110. CloseHandle(_hFile);
  111. }
  112. _wzFileName[0] = '\0';
  113. PerfDbgLog(tagCINetFile, this, "-CINetFile::~CINetFile");
  114. DEBUG_LEAVE(0);
  115. }
  116. //+---------------------------------------------------------------------------
  117. //
  118. // Method: CINetFile::INetAsyncOpen
  119. //
  120. // Synopsis:
  121. //
  122. // Arguments: (none)
  123. //
  124. // Returns:
  125. //
  126. // History: 2-06-96 JohannP (Johann Posch) Created
  127. //
  128. // Notes:
  129. //
  130. //----------------------------------------------------------------------------
  131. HRESULT CINetFile::INetAsyncOpen()
  132. {
  133. DEBUG_ENTER((DBG_APP,
  134. Hresult,
  135. "CINetFile::INetAsyncOpen",
  136. "this=%#x",
  137. this
  138. ));
  139. HRESULT hr = NOERROR;
  140. DWORD dwAttr;
  141. PerfDbgLog1(tagCINetFile, this, "+CINetFile::INetAsyncOpen(szObject:%ws)", GetObjectNameW());
  142. ReportNotification(BINDSTATUS_SENDINGREQUEST, GetServerName());
  143. // nothing to do - just call
  144. dwAttr = GetFileAttributesWrapW(GetObjectNameW());
  145. #ifdef unix
  146. unixForceAutoProxSync();
  147. if(access(GetObjectName(),R_OK) == -1)
  148. {
  149. SetLastError(ERROR_ACCESS_DENIED);
  150. dwAttr = 0xffffffff;
  151. }
  152. #endif /* unix */
  153. if ( (dwAttr != 0xffffffff)
  154. && !(dwAttr & FILE_ATTRIBUTE_DIRECTORY)
  155. )
  156. {
  157. HANDLE htemp = 0;
  158. DWORD dwSize = 0;
  159. {
  160. WIN32_FIND_DATAW finddata;
  161. htemp = FindFirstFileWrapW(GetObjectNameW(), &finddata);
  162. dwSize = finddata.nFileSizeLow;
  163. }
  164. _cbTotalBytesRead = dwSize;
  165. _cbDataSize = dwSize;
  166. if (htemp && (htemp != INVALID_HANDLE_VALUE))
  167. {
  168. ReportNotificationW(BINDSTATUS_CACHEFILENAMEAVAILABLE, GetObjectNameW());
  169. // if the file has a file extension, try to
  170. // determine the MIME type that way...
  171. //
  172. LPWSTR pwsz = GetObjectNameW();
  173. pwsz = FindFileExtensionW(pwsz);
  174. if (pwsz)
  175. {
  176. char psz[MAX_PATH];
  177. psz[0] = '\0';
  178. W2A(pwsz, psz, MAX_PATH);
  179. char szMime[MAX_PATH];
  180. DWORD cb = MAX_PATH;
  181. if (SUCCEEDED(GetMimeFromExt(psz,szMime,&cb)))
  182. {
  183. if( _grfBindF & BINDF_FROMURLMON )
  184. {
  185. ReportNotification(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, szMime);
  186. }
  187. else
  188. {
  189. ReportNotification(BINDSTATUS_MIMETYPEAVAILABLE, szMime);
  190. }
  191. }
  192. }
  193. if (_pCTrans)
  194. {
  195. _bscf |= BSCF_LASTDATANOTIFICATION;
  196. _pCTrans->ReportData(_bscf, _cbTotalBytesRead, _cbDataSize);
  197. ReportResultAndStop(NOERROR, _cbTotalBytesRead, _cbDataSize );
  198. }
  199. _hrError = INET_E_DONE;
  200. hr = NOERROR;
  201. FindClose(htemp);
  202. }
  203. else
  204. {
  205. SetCNetBindResult(GetLastError());
  206. hr = _hrError = INET_E_DATA_NOT_AVAILABLE;
  207. }
  208. }
  209. else if( (dwAttr != 0xffffffff)
  210. && (dwAttr & FILE_ATTRIBUTE_DIRECTORY) )
  211. {
  212. hr = _hrError = INET_E_REDIRECT_TO_DIR;
  213. }
  214. else
  215. {
  216. // BUGBUG do authentication if this call failed due to
  217. // net permission being denied
  218. DbgLog2(tagCINetFileErr, this, "-CINetFile::INetAsyncOpen failed (dwAttr:%ld,filename:%ws)",dwAttr,GetObjectNameW());
  219. // If you pass \\servername to GetFileAttributesWrap, on NT4 it will return ERROR_FILE_NOT_FOUND
  220. // but ERROR_INVALID_NAME on all other platforms.
  221. // We remap this error so that iframes can navigate to \\servername on NT4
  222. // Reference: IE5/102590
  223. DWORD dwError = GetLastError();
  224. if ((dwError==ERROR_FILE_NOT_FOUND)
  225. && PathIsUNCServer(GetObjectName()))
  226. {
  227. dwError = ERROR_INVALID_NAME;
  228. }
  229. // set the exact error for GetBindResult
  230. SetCNetBindResult(dwError);
  231. hr = _hrError = INET_E_RESOURCE_NOT_FOUND;
  232. }
  233. PerfDbgLog1(tagCINetFile, this, "-CINetFile::INetAsyncOpen (hr:%lx)", hr);
  234. DEBUG_LEAVE(hr);
  235. return hr;
  236. }
  237. //+---------------------------------------------------------------------------
  238. //
  239. // Method: CINetFile::Read
  240. //
  241. // Synopsis:
  242. //
  243. // Arguments: [pBuffer] --
  244. // [cbBytes] --
  245. // [pcbBytes] --
  246. //
  247. // Returns:
  248. //
  249. // History: 2-13-96 JohannP (Johann Posch) Created
  250. //
  251. // Notes:
  252. //
  253. //----------------------------------------------------------------------------
  254. STDMETHODIMP CINetFile::Read(void *pBuffer, DWORD cbBytes, DWORD *pcbBytes)
  255. {
  256. DEBUG_ENTER((DBG_APP,
  257. Hresult,
  258. "CINetFile::IInternetProtocol::Read",
  259. "this=%#x, %#x, %#x, %#x",
  260. this, pBuffer, cbBytes, pcbBytes
  261. ));
  262. PerfDbgLog(tagCINetFile, this, "+CINetFile::Read");
  263. HRESULT hr = NOERROR;
  264. PProtAssert((cbBytes && pcbBytes));
  265. if (!_hFile)
  266. {
  267. LPWSTR wszFile = GetObjectNameW();
  268. PProtAssert((wszFile));
  269. if (wszFile)
  270. {
  271. // fill the internal buffer for data sniffing
  272. _hFile = CreateFileWrapW(wszFile, GENERIC_READ,
  273. FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,OPEN_EXISTING,
  274. FILE_ATTRIBUTE_NORMAL, NULL);
  275. }
  276. }
  277. if (_hFile != INVALID_HANDLE_VALUE)
  278. {
  279. DWORD dwRead;
  280. if (ReadFile(_hFile, pBuffer, cbBytes, &dwRead, NULL))
  281. {
  282. *pcbBytes = dwRead;
  283. if (cbBytes != dwRead)
  284. {
  285. hr = S_FALSE;
  286. }
  287. }
  288. else
  289. {
  290. DbgLog2(tagCINetFileErr, this, " -CINetFile::Read could not read file (sniffing:%ld) (hr:%lx)", dwRead, hr);
  291. SetCNetBindResult(GetLastError());
  292. hr = _hrError = INET_E_DATA_NOT_AVAILABLE;
  293. ReportResultAndStop(hr);
  294. }
  295. }
  296. else
  297. {
  298. SetCNetBindResult(GetLastError());
  299. hr = _hrError = INET_E_DATA_NOT_AVAILABLE;
  300. ReportResultAndStop(hr);
  301. DbgLog2(tagCINetFileErr, this, "-CINetFile::Read could not open (file:%ws, hr:%lx)", GetObjectNameW(), hr);
  302. }
  303. PerfDbgLog4(tagCINetFile, this, "-CINetFile::Read (_hrError:%lx, [hr:%lx,cbBytesAsked:%ld,cbBytesReturned:%ld])",
  304. _hrError, hr, cbBytes, *pcbBytes);
  305. DEBUG_LEAVE(hr);
  306. return hr;
  307. }
  308. //+---------------------------------------------------------------------------
  309. //
  310. // Method: CINetFile::LockFile
  311. //
  312. // Synopsis:
  313. //
  314. // Arguments:
  315. //
  316. // Returns:
  317. //
  318. // History: 8-13-96 JohannP (Johann Posch) Created
  319. //
  320. // Notes:
  321. //
  322. //----------------------------------------------------------------------------
  323. HRESULT CINetFile::LockFile(BOOL fRetrieve)
  324. {
  325. DEBUG_ENTER((DBG_APP,
  326. Hresult,
  327. "CINetFile::LockFile",
  328. "this=%#x, %B",
  329. this, fRetrieve
  330. ));
  331. PerfDbgLog(tagCINetFile, this, "+CINetFile::LockFile");
  332. HRESULT hr = NOERROR;
  333. if (!_hFile )
  334. {
  335. _hFile = CreateFileWrapW( GetObjectNameW(), GENERIC_READ,
  336. FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,OPEN_EXISTING,
  337. FILE_ATTRIBUTE_NORMAL, NULL);
  338. }
  339. if (_hFile != INVALID_HANDLE_VALUE)
  340. {
  341. _fLocked = TRUE;
  342. }
  343. PerfDbgLog1(tagCINetFile, this, "-CINetFile::LockFile (hr:%lx,)", hr);
  344. DEBUG_LEAVE(hr);
  345. return hr;
  346. }
  347. //+---------------------------------------------------------------------------
  348. //
  349. // Method: CINetFile::UnlockFile
  350. //
  351. // Synopsis:
  352. //
  353. // Arguments: (none)
  354. //
  355. // Returns:
  356. //
  357. // History: 8-13-96 JohannP (Johann Posch) Created
  358. //
  359. // Notes:
  360. //
  361. //----------------------------------------------------------------------------
  362. HRESULT CINetFile::UnlockFile()
  363. {
  364. DEBUG_ENTER((DBG_APP,
  365. Hresult,
  366. "CINetFile::UnlockFile",
  367. "this=%#x",
  368. this
  369. ));
  370. PerfDbgLog(tagCINetFile, this, "IN CINetFile::UnlockFile");
  371. HRESULT hr = NOERROR;
  372. if (_fLocked)
  373. {
  374. PProtAssert((_hFile));
  375. CloseHandle(_hFile);
  376. _hFile = NULL;
  377. _fLocked = FALSE;
  378. }
  379. PerfDbgLog1(tagCINetFile, this, "-CINetFile::UnlockFile (hr:%lx)", hr);
  380. DEBUG_LEAVE(hr);
  381. return hr;
  382. }
  383. //+---------------------------------------------------------------------------
  384. //
  385. // Method: CINetSimple::CINetSimple
  386. //
  387. // Synopsis:
  388. //
  389. // Arguments: (none)
  390. //
  391. // Returns:
  392. //
  393. // History: 2-06-96 JohannP (Johann Posch) Created
  394. //
  395. // Notes:
  396. //
  397. //----------------------------------------------------------------------------
  398. CINetSimple::CINetSimple(REFCLSID rclsid, IUnknown *pUnkOuter) : CINet(rclsid,pUnkOuter)
  399. {
  400. DEBUG_ENTER((DBG_APP,
  401. None,
  402. "CINetSimple::CINetSimple",
  403. "this=%#x, %#x, %#x",
  404. this, &rclsid, pUnkOuter
  405. ));
  406. PerfDbgLog(tagCINetSimple, this, "+CINetSimple::CINetSimple");
  407. _dwState = INetState_START;
  408. _dwIsA = DLD_PROTOCOL_NONE;
  409. PerfDbgLog(tagCINetSimple, this, "-CINetSimple::CINetSimple");
  410. DEBUG_LEAVE(0);
  411. }
  412. //+---------------------------------------------------------------------------
  413. //
  414. // Method: CINetSimple::~CINetSimple
  415. //
  416. // Synopsis:
  417. //
  418. // Arguments: (none)
  419. //
  420. // Returns:
  421. //
  422. // History: 2-06-96 JohannP (Johann Posch) Created
  423. //
  424. // Notes:
  425. //
  426. //----------------------------------------------------------------------------
  427. CINetSimple::~CINetSimple()
  428. {
  429. DEBUG_ENTER((DBG_APP,
  430. None,
  431. "CINetSimple::~CINetSimple",
  432. "this=%#x",
  433. this
  434. ));
  435. DEBUG_LEAVE(0);
  436. }
  437. //+---------------------------------------------------------------------------
  438. //
  439. // Method: CINetSimple::INetAsyncOpenRequest
  440. //
  441. // Synopsis:
  442. //
  443. // Arguments: (none)
  444. //
  445. // Returns:
  446. //
  447. // History: 1-27-96 JohannP (Johann Posch) Created
  448. //
  449. // Notes:
  450. //
  451. //----------------------------------------------------------------------------
  452. HRESULT CINetSimple::INetAsyncOpenRequest()
  453. {
  454. DEBUG_ENTER((DBG_APP,
  455. Hresult,
  456. "CINetSimple::INetAsyncOpenRequest",
  457. "this=%#x",
  458. this
  459. ));
  460. PerfDbgLog(tagCINetSimple, this, "+CINetSimple::INetAsyncOpenRequest");
  461. HRESULT hr = NOERROR;
  462. DWORD dwBindF = 0;
  463. SetINetState(INetState_PROTOPEN_REQUEST);
  464. PProtAssert((g_hSession != NULL));
  465. if (_hRequest && _fDoSimpleRetry)
  466. {
  467. // Abort the previous request if needed.
  468. // Note: This is CINetSimple, so the behavior of closing the previous
  469. // handle and retrying only applies to FTP and gopher requests.
  470. _fDoSimpleRetry = FALSE;
  471. _fHandlesRecycled = TRUE;
  472. TerminateRequest();
  473. }
  474. // get the open flags
  475. dwBindF = GetBindFlags();
  476. if (dwBindF & BINDF_GETNEWESTVERSION)
  477. {
  478. _dwOpenFlags |= INTERNET_FLAG_RELOAD;
  479. }
  480. if ( (dwBindF & BINDF_NOWRITECACHE)
  481. //BUG-WORK
  482. //&& !_pCTransData->IsFileRequired()
  483. )
  484. {
  485. _dwOpenFlags |= INTERNET_FLAG_DONT_CACHE ;
  486. }
  487. // BUGBUG OFFLINE, RELOAD, RESYNCHRONIZE and HYPERLINK are mutually
  488. // exclusive. But inside wininet there is priority, so
  489. // the priority is OFFLINE, RELOAD, RESYNCHRONIZE, HYPERLINK in that order
  490. if (dwBindF & BINDF_RESYNCHRONIZE)
  491. {
  492. // caller asking to do if-modified-since
  493. _dwOpenFlags |= INTERNET_FLAG_RESYNCHRONIZE;
  494. }
  495. if (dwBindF & BINDF_HYPERLINK)
  496. {
  497. // caller syas this is a hyperlink access
  498. _dwOpenFlags |= INTERNET_FLAG_HYPERLINK;
  499. }
  500. PrivAddRef();
  501. _HandleStateRequest = HandleState_Pending;
  502. // we always request keep-alive, use an existing connection (FTP) and
  503. // passive mode transfers (also FTP)
  504. _dwOpenFlags |= INTERNET_FLAG_KEEP_CONNECTION
  505. | INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_PASSIVE;
  506. HINTERNET hRequestTmp = InternetOpenUrl(g_hSession, _pszFullURL, NULL, 0, _dwOpenFlags, (DWORD_PTR) this);
  507. if ( hRequestTmp == 0)
  508. {
  509. dwLstError = GetLastError();
  510. if (dwLstError == ERROR_IO_PENDING)
  511. {
  512. // wait async for the handle
  513. hr = E_PENDING;
  514. SetStatePending(E_PENDING);
  515. }
  516. else
  517. {
  518. _hrError = INET_E_CANNOT_CONNECT;
  519. hr = E_FAIL;
  520. }
  521. }
  522. else
  523. {
  524. _hRequest = hRequestTmp;
  525. _HandleStateRequest = HandleState_Initialized;
  526. hr = INetAsyncSendRequest();
  527. }
  528. if (_hrError != INET_E_OK)
  529. {
  530. // we need to terminate here
  531. ReportResultAndStop(NOERROR);
  532. }
  533. PerfDbgLog1(tagCINetSimple, this, "-CINetSimple::INetAsyncOpenRequest (hr:%lx)", hr);
  534. DEBUG_LEAVE(hr);
  535. return hr;
  536. }
  537. //+---------------------------------------------------------------------------
  538. //
  539. // Method: CINetSimple::INetAsyncSendRequest
  540. //
  541. // Synopsis:
  542. //
  543. // Arguments: (none)
  544. //
  545. // Returns:
  546. //
  547. // History: 1-27-96 JohannP (Johann Posch) Created
  548. //
  549. // Notes:
  550. //
  551. //----------------------------------------------------------------------------
  552. HRESULT CINetSimple::INetAsyncSendRequest()
  553. {
  554. DEBUG_ENTER((DBG_APP,
  555. Hresult,
  556. "CINetSimple::INetAsyncSendRequest",
  557. "this=%#x",
  558. this
  559. ));
  560. PerfDbgLog(tagCINetSimple, this, "+CINetSimple::INetAsyncSendRequest");
  561. HRESULT hr = NOERROR;
  562. hr = QueryStatusOnResponse();
  563. if (! _fDoSimpleRetry && hr == NOERROR)
  564. {
  565. SetINetState(INetState_SEND_REQUEST);
  566. if (OperationOnAparmentThread(INetState_SEND_REQUEST))
  567. {
  568. TransitState(INetState_READ);
  569. }
  570. else
  571. {
  572. hr = INetRead();
  573. }
  574. }
  575. if (_hrError != INET_E_OK)
  576. {
  577. // we need to terminate here
  578. ReportResultAndStop(NOERROR);
  579. }
  580. PerfDbgLog1(tagCINetSimple, this, "-CINetSimple::INetAsyncSendRequest (hr:%lx)", hr);
  581. DEBUG_LEAVE(hr);
  582. return hr;
  583. }
  584. //+---------------------------------------------------------------------------
  585. //
  586. // Method: CINetSimple::INetAsyncConnect
  587. //
  588. // Synopsis:
  589. //
  590. // Arguments: (none)
  591. //
  592. // Returns:
  593. //
  594. // History: 1-27-96 JohannP (Johann Posch) Created
  595. //
  596. // Notes:
  597. //
  598. //----------------------------------------------------------------------------
  599. HRESULT CINetSimple::INetAsyncConnect()
  600. {
  601. DEBUG_ENTER((DBG_APP,
  602. Hresult,
  603. "CINetSimple::INetAsyncConnect",
  604. "this=%#x",
  605. this
  606. ));
  607. PerfDbgLog(tagCINetSimple, this, "+CINetSimple::INetAsyncConnect");
  608. HRESULT hr = NOERROR;
  609. //just go into OpenRequest state
  610. hr = INetAsyncOpenRequest();
  611. PerfDbgLog1(tagCINetSimple, this, "-CINetSimple::INetAsyncConnect (hr:%lx)", hr);
  612. DEBUG_LEAVE(hr);
  613. return hr;
  614. }
  615. //+---------------------------------------------------------------------------
  616. //
  617. // Method: CINetSimple::QueryStatusOnResponse
  618. //
  619. // Synopsis:
  620. //
  621. // Arguments: (none)
  622. //
  623. // Returns:
  624. //
  625. // History: 11-14-97 OliverW (Oliver Wallace) Created
  626. // 09-18-98 MeadH (Mead Himelstein) copy over to shipping code
  627. //
  628. // Notes:
  629. //
  630. //----------------------------------------------------------------------------
  631. HRESULT CINetSimple::QueryStatusOnResponse()
  632. {
  633. DEBUG_ENTER((DBG_APP,
  634. Hresult,
  635. "CINetSimple::QueryStatusOnResponse",
  636. "this=%#x",
  637. this
  638. ));
  639. PerfDbgLog(tagCINetSimple, this, "+CINetSimple::QueryStatusOnResponse");
  640. HRESULT hr = NOERROR;
  641. DWORD dwStatus = 0;
  642. DWORD cbLen = sizeof(DWORD);
  643. if (HttpQueryInfo(
  644. _hRequest,
  645. HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER,
  646. (LPVOID) &dwStatus,
  647. &cbLen,
  648. NULL
  649. ))
  650. {
  651. if (dwStatus == HTTP_STATUS_PROXY_AUTH_REQ)
  652. {
  653. _hrINet = INET_E_AUTHENTICATION_REQUIRED;
  654. TransitState(INetState_AUTHENTICATE, TRUE);
  655. hr = E_PENDING;
  656. }
  657. }
  658. PerfDbgLog1(tagCINetSimple, this, "-CINetSimple::QueryStatusOnResponse (hr:%lx)", hr);
  659. DEBUG_LEAVE(hr);
  660. return hr;
  661. }
  662. //+---------------------------------------------------------------------------
  663. //
  664. // Method: CINetSimple::QueryStatusOnResponseDefault
  665. //
  666. // Synopsis:
  667. //
  668. // Arguments: (none)
  669. //
  670. // Returns:
  671. //
  672. // History: 2-02-98 OliverW Created
  673. // 09-18-98 MeadH (Mead Himelstein) copy over to shipping code
  674. //
  675. // Notes:
  676. //
  677. //----------------------------------------------------------------------------
  678. HRESULT CINetSimple::QueryStatusOnResponseDefault(DWORD dwStat)
  679. {
  680. DEBUG_ENTER((DBG_APP,
  681. Hresult,
  682. "CINetSimple::QueryStatusOnResponseDefault",
  683. "this=%#x, %#x",
  684. this, dwStat
  685. ));
  686. PerfDbgLog(tagCINetSimple, this, "+CINetSimple::QueryStatusOnResponseDefault");
  687. PerfDbgLog1(tagCINetSimple, this, "-CINetSimple::QueryStatusOnResponseDefault (hr:%lx)", NOERROR);
  688. DEBUG_LEAVE(NOERROR);
  689. return NOERROR;
  690. }
  691. //+---------------------------------------------------------------------------
  692. //
  693. // Method: CINetSimple::QueryHeaderOnResponse
  694. //
  695. // Synopsis:
  696. //
  697. // Arguments: (none)
  698. //
  699. // Returns:
  700. //
  701. // History: 2-02-98 OliverW Created
  702. // 09-18-98 MeadH (Mead Himelstein) copy over to shipping code
  703. //
  704. // Notes:
  705. //
  706. //----------------------------------------------------------------------------
  707. HRESULT CINetSimple::QueryHeaderOnResponse()
  708. {
  709. DEBUG_ENTER((DBG_APP,
  710. Hresult,
  711. "CINetSimple::QueryHeaderOnResponse",
  712. "this=%#x",
  713. this
  714. ));
  715. PerfDbgLog(tagCINetSimple, this, "+CINetSimple::QueryHeaderOnResponse");
  716. PerfDbgLog1(tagCINetSimple, this, "-CINetSimple::QueryHeaderOnResponse (hr:%lx)", NOERROR);
  717. DEBUG_LEAVE(NOERROR);
  718. return NOERROR;
  719. }
  720. //+---------------------------------------------------------------------------
  721. //
  722. // Method: CINetFtp::CINetFtp
  723. //
  724. // Synopsis:
  725. //
  726. // Arguments: (none)
  727. //
  728. // Returns:
  729. //
  730. // History: 2-06-96 JohannP (Johann Posch) Created
  731. //
  732. // Notes:
  733. //
  734. //----------------------------------------------------------------------------
  735. CINetFtp::CINetFtp(REFCLSID rclsid, IUnknown *pUnkOuter) : CINetSimple(rclsid, pUnkOuter)
  736. {
  737. DEBUG_ENTER((DBG_APP,
  738. None,
  739. "CINetFtp::CINetFtp",
  740. "this=%#x, %#x, %#x",
  741. this, &rclsid, pUnkOuter
  742. ));
  743. PerfDbgLog(tagCINetSimple, this, "+CINetFtp::CINetFtp");
  744. _dwIsA = DLD_PROTOCOL_FTP;
  745. PerfDbgLog(tagCINetSimple, this, "-CINetFtp::CINetFtp");
  746. DEBUG_LEAVE(0);
  747. }
  748. //+---------------------------------------------------------------------------
  749. //
  750. // Method: CINetFtp::INetAsyncSendRequest
  751. //
  752. // Synopsis:
  753. //
  754. // Arguments: (none)
  755. //
  756. // Returns:
  757. //
  758. // History: 3-13-98 VincentR Created
  759. //
  760. // Notes:
  761. //
  762. //----------------------------------------------------------------------------
  763. HRESULT CINetFtp::INetAsyncSendRequest()
  764. {
  765. DEBUG_ENTER((DBG_APP,
  766. Hresult,
  767. "CINetFtp::INetAsyncSendRequest",
  768. "this=%#x",
  769. this
  770. ));
  771. HRESULT hr = NOERROR;
  772. DWORD dwLowSize = 0;
  773. DWORD dwHighSize = 0;
  774. dwLowSize = FtpGetFileSize(_hRequest, &dwHighSize);
  775. if(dwLowSize != 0xffffffff)
  776. _cbDataSize = dwLowSize;
  777. hr = CINetSimple::INetAsyncSendRequest();
  778. DEBUG_LEAVE(hr);
  779. return(hr);
  780. }
  781. //+---------------------------------------------------------------------------
  782. //
  783. // Method: CINetFtp::~CINetFtp
  784. //
  785. // Synopsis:
  786. //
  787. // Arguments: (none)
  788. //
  789. // Returns:
  790. //
  791. // History: 2-06-96 JohannP (Johann Posch) Created
  792. //
  793. // Notes:
  794. //
  795. //----------------------------------------------------------------------------
  796. CINetFtp::~CINetFtp()
  797. {
  798. DEBUG_ENTER((DBG_APP,
  799. None,
  800. "CINetFtp::~CINetFtp",
  801. "this=%#x",
  802. this
  803. ));
  804. DEBUG_LEAVE(0);
  805. }
  806. //+---------------------------------------------------------------------------
  807. //
  808. // Method: CINetGopher::CINetGopher
  809. //
  810. // Synopsis:
  811. //
  812. // Arguments: (none)
  813. //
  814. // Returns:
  815. //
  816. // History: 2-06-96 JohannP (Johann Posch) Created
  817. //
  818. // Notes:
  819. //
  820. //----------------------------------------------------------------------------
  821. CINetGopher::CINetGopher(REFCLSID rclsid, IUnknown *pUnkOuter) : CINetSimple(rclsid,pUnkOuter)
  822. {
  823. DEBUG_ENTER((DBG_APP,
  824. None,
  825. "CINetGopher::CINetGopher",
  826. "this=%#x, %#x, %#x",
  827. this, &rclsid, pUnkOuter
  828. ));
  829. PerfDbgLog(tagCINetSimple, this, "+CINetGopher::CINetGopher");
  830. _dwIsA = DLD_PROTOCOL_GOPHER;
  831. PerfDbgLog(tagCINetSimple, this, "-CINetGopher::CINetGopher");
  832. DEBUG_LEAVE(0);
  833. }
  834. //+---------------------------------------------------------------------------
  835. //
  836. // Method: CINetGopher::~CINetGopher
  837. //
  838. // Synopsis:
  839. //
  840. // Arguments: (none)
  841. //
  842. // Returns:
  843. //
  844. // History: 2-06-96 JohannP (Johann Posch) Created
  845. //
  846. // Notes:
  847. //
  848. //----------------------------------------------------------------------------
  849. CINetGopher::~CINetGopher()
  850. {
  851. DEBUG_ENTER((DBG_APP,
  852. None,
  853. "CINetGopher::~CINetGopher",
  854. "this=%#x",
  855. this
  856. ));
  857. DEBUG_LEAVE(0);
  858. }