`
famoushz
  • 浏览: 2865175 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

HTTP 上传的报头格式

阅读更多

最近做的程序需要用到HTTP上传文件和表单提交的功能,在各大网站这方面的资料实在是少的可怜。找了好久,最后在国外的一家网站找到了相关的文档。做完工程后总结,开始的主要问题出在报头的格式上。现将报头的写法和相关的函数摘出来。程序的实现是用CHTTP类。

//报头格式,类似于这样--------------------------------------

cpp 代码
 
  1. LPCSTR szDefUsrAgent = "Ryeol HTTP Client Class" ;  
  2. LPCSTR szGET = "GET" ;  
  3. LPCSTR szPost = "POST" ;  
  4. LPCSTR szHTTP = "HTTP://" ;  
  5. LPCSTR szHTTPS = "HTTPS://" ;  
  6. LPCSTR szSlash = "/" ;  
  7. LPCSTR szCacheControl = "Cache-Control" ;  
  8. LPCSTR szNoCache = "no-cache" ;  
  9. LPCSTR szContentType = "Content-Type" ;  
  10. LPCSTR szMultipartFormDataBoundary = "multipart/form-data; boundary=" ;  
  11. LPCSTR szFormUrlEncoded = "application/x-www-form-urlencoded" ;  
  12. LPCSTR szDefBoundary = "----FB3B405B7EAE495aB0C0295C54D4E096-" ;    //这行分隔符很重要的,开始的程序就是没加这个,一直不行。  
  13. LPCSTR szDefUploadContType = "multipart/form-data; boundary=" "----FB3B405B7EAE495aB0C0295C54D4E096-" ;  
  14. LPCSTR szNULL = "NULL" ;  
  15. LPCSTR szEmptyString = "" ;  
  16. LPCSTR szColonSlashSlash = "://" ;  
  17.   
  18.    
  19.   
  20. 下面是提出来的一段函数代码:  
  21.   
  22.    
  23.   
  24. void CHttpToolA::AddHeader (HINTERNET hRequest, LPCSTR szName, LPCSTR szValue, UINT /* CodePage */)  
  25. throw (Exception &)  
  26. {  
  27.  HTTPTOOL_ASSERT (hRequest != NULL, "CHttpToolA::AddHeader: hRequest can not be NULL.") ;  
  28.  HTTPTOOL_ASSERT (szName != NULL, "CHttpToolA::AddHeader: szName can not be NULL.") ;  
  29.   
  30.  ::SafeInt<size_t>  cbHeader ;  
  31.  ::SafeInt<DWORD>  cchHeader ;  
  32.   
  33.  try {  
  34.   cbHeader = ::strlen (szName) ;  
  35.   cbHeader += szValue ? ::strlen (szValue) : 0 ;  
  36.   cbHeader += (4 + 1) ; // for ": ", "\r\n", '\0'  
  37.   cchHeader = cbHeader - 1 ;  
  38.  } catch (::SafeIntException & e) {  
  39.   ThrowException (e) ;  
  40.  }  
  41.   
  42.  PSTR  szHeader = (PSTR) ::malloc (sizeof (CHAR) * (cbHeader.Value ())) ;  
  43.  if ( szHeader == NULL )  
  44.   ThrowException (HTTPCLIENT_ERR_OUT_OF_MEMORY) ;  
  45.   
  46.  ::strcpy (szHeader, szName) ;  
  47.  ::strcat (szHeader, ": ") ;  
  48.  ::strcat (szHeader, szValue ? szValue : "") ;  
  49.  ::strcat (szHeader, "\r\n") ;  
  50.   
  51.  // Adds a header  
  52.  if ( !::HttpAddRequestHeadersA (  
  53.   hRequest  
  54.   , szHeader        // headers to append to the request.  
  55.   , cchHeader.Value ()     // header length  
  56.   , HTTP_ADDREQ_FLAG_ADD     // flags  
  57.   )  
  58.   ) {  
  59.    SAFEFREE (szHeader) ;  
  60.    ThrowException (HTTPCLIENT_ERR_HTTPADDREQUESTHEADERS_FAILED, ::GetLastError ()) ;  
  61.   }  
  62.   
  63.   SAFEFREE (szHeader) ;  
  64. }  
  65.   
  66. void CHttpToolA::SendRequest (HINTERNET hRequest, LPCSTR szPosted, UINT /* CodePage */)  
  67. throw (Exception &)  
  68. {  
  69.  HTTPTOOL_ASSERT (hRequest != NULL, "CHttpToolA::SendRequest: hRequest can not be NULL.") ;  
  70.   
  71.  ::SafeInt<DWORD> cchPosted ;  
  72.   
  73.  try {  
  74.   cchPosted = szPosted ? ::strlen (szPosted) : 0 ;  
  75.  } catch (::SafeIntException & e) {  
  76.   ThrowException (e) ;  
  77.  }  
  78.   
  79.  if ( !::HttpSendRequestA (  
  80.   hRequest  
  81.   , NULL      // Additional header  
  82.   , 0       // The length of the additional header  
  83.   , (void *) szPosted   // A posted data  
  84.   , cchPosted.Value ()  // The length of the posted data  
  85.   ) )  
  86.   ThrowException (HTTPCLIENT_ERR_HTTPSENDREQUEST_FAILED, ::GetLastError ()) ;  
  87. }  
  88.   
  89. void CHttpToolA::SendRequestEx (HINTERNET hRequest, DWORD dwPostedSize)  
  90. throw (Exception &)  
  91. {  
  92.  HTTPTOOL_ASSERT (hRequest != NULL, "CHttpToolA::SendRequestEx: hRequest can not be NULL.") ;  
  93.   
  94.  INTERNET_BUFFERSA BufferIn;  
  95.   
  96.  BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS ); // Must be set or error will occur  
  97.  BufferIn.Next = NULL;   
  98.  BufferIn.lpcszHeader = NULL;  
  99.  BufferIn.dwHeadersLength = 0;  
  100.  BufferIn.dwHeadersTotal = 0;  
  101.  BufferIn.lpvBuffer = NULL;                  
  102.  BufferIn.dwBufferLength = 0;  
  103.  BufferIn.dwBufferTotal = dwPostedSize; // This is the only member used other than dwStructSize  
  104.  BufferIn.dwOffsetLow = 0;  
  105.  BufferIn.dwOffsetHigh = 0;  
  106.   
  107.  if ( !::HttpSendRequestExA (  
  108.   hRequest  
  109.   , &BufferIn  
  110.   , NULL  
  111.   , 0  
  112.   , 0  
  113.   ) )  
  114.   ThrowException (HTTPCLIENT_ERR_HTTPSENDREQUESTEX_FAILED, ::GetLastError ()) ;  
  115. }  
  116.   
  117.    
  118.   
  119. // The returned string must be freed by using the ::free () function.  
  120. LPSTR CHttpToolA::CreateUploadBoundary (void)  
  121. throw ()  
  122. {  
  123.  GUID   guid ;  
  124.   
  125.  if ( FAILED ( ::CoCreateGuid (&guid)) )  
  126.   return NULL ;  
  127.   
  128.  PSTR  szBoundary = (PSTR) ::malloc (sizeof (CHAR) * 44) ;  
  129.   
  130.  if ( szBoundary == NULL )  
  131.   return NULL ;  
  132.   
  133.  ::sprintf (szBoundary, "----LYOUL-%.08x%.04x%.04x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x-"  
  134.   , guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1]  
  135.   , guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);  
  136.   
  137.   return szBoundary ;  
  138. }  
  139.   
  140. void CHttpClientT<HttpTool, HttpEncoder>::_StartUploadContext (HINTERNET hInternet, HINTERNET hConnection, PCSZ szUrl  
  141.                   , DWORD dwFlags, PCSZ szReferer, PCSZ szUsrName, PCSZ szUsrPwd)  
  142.                   throw (Exception &)  
  143. {  
  144.  // Closes any existing Post Context  
  145.  _EndPostContext () ;  
  146.   
  147.  BOOL    bBorrowedInternet = TRUE ;  
  148.  BOOL    bBorrowedConnection = TRUE ;  
  149.  HINTERNET   hRequest = NULL ;  
  150.   
  151.  HANDLE *   ahFileHandles = NULL ;  
  152.  LPSTR *    aszMimeTypes = NULL ;  
  153.  ::SafeInt<DWORD> nPostedFileCount = 0 ;  
  154.   
  155.  try {  
  156.   // Calculates the nubmer of bytes to upload  
  157.   ::SafeInt<size_t> nTotalByte = 0 ;  
  158.   ::SafeInt<size_t> nValuesTotalByte = 0 ;  
  159.   size_t    cchBoundary = HttpTool::StringLen (_GetUploadBoundary ()) ;  
  160.   
  161.   PCSZ    szFirstParamName = NULL ;  
  162.   PCSZ    szFirstParamFileName = NULL ;  
  163.   size_t    cbFirstParamValue = 0 ;  
  164.   BOOL    bFirstParamIsFile = FALSE ;  
  165.   
  166.   if ( !m_mapParam.Empty () ) {  
  167.    try {  
  168.     ConstMapIter  iter ;  
  169.   
  170.     // Get the number of files  
  171.     for (iter = m_mapParam.Begin (); iter != m_mapParam.End (); ++iter) {  
  172.      if ( (iter->second).dwFlag & ParamFile )  
  173.       nPostedFileCount++ ;  
  174.     }  
  175.   
  176.     if ( nPostedFileCount.Value () ) {  
  177.      // Allocates memory for handles and MimeTypes of the uploaded files  
  178.      ahFileHandles = (HANDLE *) ::calloc (nPostedFileCount.Value (), sizeof (HANDLE)) ;  
  179.      if ( ahFileHandles == NULL )  
  180.       HttpTool::ThrowException (HTTPCLIENT_ERR_OUT_OF_MEMORY) ;  
  181.   
  182.      // Initializes the file handles  
  183.      for (DWORD i = 0; i < nPostedFileCount; i++)  
  184.       ahFileHandles[i] = INVALID_HANDLE_VALUE ;  
  185.   
  186.      aszMimeTypes = (LPSTR *) ::calloc (nPostedFileCount.Value (), sizeof (LPSTR)) ;  
  187.      if ( aszMimeTypes == NULL )  
  188.       HttpTool::ThrowException (HTTPCLIENT_ERR_OUT_OF_MEMORY) ;  
  189.     }  
  190.   
  191.     /* 
  192.     Calculates the total upload size 
  193.  
  194.     <1> The number of bytes to upload If the parameter is not a file 
  195.     = strlen ("--") + strlen (Boundary) + strlen ("\r\n")  
  196.     + strlen ("Content-Disposition: form-data; name=\"\"\r\n\r\n") 
  197.     + strlen (The name of the parameter) + strlen (The value of the parameter) + strlen ("\r\n") ; 
  198.  
  199.     <2> The number of bytes to upload If the parameter is a file 
  200.     = strlen ("--") + strlen (Boundary) + strlen ("\r\n")  
  201.     + strlen ("Content-Disposition: form-data; name=\"\"; filename=\"\"\r\n") 
  202.     + strlen (The name of the parameter) + strlen (The value of the parameter) 
  203.     + strlen ("Content-Type: \r\n\r\n") + strlen (The Mime Type of the file) 
  204.     + The length of the file + strlen ("\r\n") 
  205.  
  206.     The last boundary 
  207.     = strlen ("--") + strlen (Boundary) + strlen ("--\r\n")  
  208.  
  209.     The total upload size 
  210.     = ( <1> * The number of normal parameters) 
  211.     + ( <2> * The number of file parameters) 
  212.     + The last boundary 
  213.     */  
  214.   
  215.     ::SafeInt<size_t> cbValue ;  
  216.     DWORD    nFileIdx = 0 ;  
  217.   
  218.     nTotalByte = 0 ;  
  219.     nValuesTotalByte = 0 ;  
  220.     for (iter = m_mapParam.Begin (); iter != m_mapParam.End (); ++iter) {  
  221.      if ( !((iter->second).dwFlag & ParamFile) ) {  
  222.       // If the parameter is not a file  
  223.       // = strlen ("--") + strlen (Boundary) + strlen ("\r\n")   
  224.       //  + strlen ("Content-Disposition: form-data; name=\"\"\r\n\r\n")  
  225.       //  + strlen (The name of the parameter) + strlen (The value of the parameter) + strlen ("\r\n") ;  
  226.       nTotalByte += (cchBoundary + 4) ;  
  227.       nTotalByte += 43 ;  
  228.   
  229.       if ( m_bUseUtf8 ) {  
  230.        nTotalByte += _Utf8EncodeLen (iter->first) ;  
  231.        cbValue = _Utf8EncodeLen ((iter->second).szValue) ;  
  232.       } else {  
  233.        nTotalByte += _String2AnsiLen (iter->first) ;  
  234.        cbValue = _String2AnsiLen ((iter->second).szValue) ;  
  235.       }  
  236.   
  237.       nTotalByte += cbValue ;  
  238.       nValuesTotalByte += cbValue ;  
  239.   
  240.       nTotalByte += 2 ;  
  241.   
  242.       // Saves the state of the first parameter  
  243.       if ( iter == m_mapParam.Begin () ) {  
  244.        szFirstParamName = iter->first ;  
  245.        cbFirstParamValue = cbValue.Value () ;  
  246.        bFirstParamIsFile = FALSE ;  
  247.        szFirstParamFileName = NULL ;  
  248.       }  
  249.      } else {  
  250.       // If the parameter is a file  
  251.       // = strlen ("--") + strlen (Boundary) + strlen ("\r\n")   
  252.       //  + strlen ("Content-Disposition: form-data; name=\"\"; filename=\"\"\r\n")  
  253.       //  + strlen (The name of the parameter) + strlen (The value of the parameter)  
  254.       //  + strlen ("Content-Type: \r\n\r\n") + strlen (The Mime Type of the file)  
  255.       //  + The length of the file + strlen ("\r\n")  
  256.       nTotalByte += (cchBoundary + 4) ;  
  257.       nTotalByte += 54 ;  
  258.   
  259.       if ( m_bUseUtf8 ) {  
  260.        nTotalByte += _Utf8EncodeLen (iter->first) ;  
  261.        nTotalByte += _Utf8EncodeLen ((iter->second).szValue) ;  
  262.       } else {  
  263.        nTotalByte += _String2AnsiLen (iter->first) ;  
  264.        nTotalByte += _String2AnsiLen ((iter->second).szValue) ;  
  265.       }  
  266.   
  267.       nTotalByte += 18 ;  
  268.   
  269.       // Get the file size and MimeType  
  270.       cbValue = 0 ;  
  271.       if ( (iter->second).szValue ) {  
  272.        // Open the file  
  273.        ahFileHandles[nFileIdx] = HttpTool::OpenFile ((iter->second).szValue) ;  
  274.   
  275.        // Get the file size  
  276.        if ( ahFileHandles[nFileIdx] != INVALID_HANDLE_VALUE )  
  277.         cbValue = HttpTool::GetFileSize (ahFileHandles[nFileIdx], (iter->second).szValue) ;  
  278.       }  
  279.   
  280.       // Throws an exception  
  281.       if ( m_bStrictFileCheck && (ahFileHandles[nFileIdx] == INVALID_HANDLE_VALUE) )  
  282.        HttpTool::ThrowException (HTTPCLIENT_ERR_OPENFILE_FAILED, ::GetLastError (), (iter->second).szValue) ;  
  283.   
  284.       // Get the MimeType of the file  
  285.       aszMimeTypes[nFileIdx] = HttpTool::GetMimeType (ahFileHandles[nFileIdx], m_nAnsiCodePage) ;  
  286.       nTotalByte += CHttpToolA::StringLen (aszMimeTypes[nFileIdx]) ;  
  287.       nTotalByte += cbValue ;  
  288.       nValuesTotalByte += cbValue ;  
  289.       nTotalByte += 2 ;  
  290.       nFileIdx++ ;  
  291.   
  292.       // Saves the state of the first parameter  
  293.       if ( iter == m_mapParam.Begin () ) {  
  294.        szFirstParamName = iter->first ;  
  295.        cbFirstParamValue = cbValue.Value () ;  
  296.        bFirstParamIsFile = TRUE ;  
  297.        szFirstParamFileName = (iter->second).szValue ;  
  298.       }  
  299.      }  
  300.     }  
  301.   
  302.     // The last boundary  
  303.     // = strlen ("--") + strlen (Boundary) + strlen ("--\r\n")   
  304.     nTotalByte += (cchBoundary + 6) ;  
  305.    } catch (::SafeIntException & e) {  
  306.     HttpTool::ThrowException (e) ;  
  307.    }  
  308.   
  309.   } else {  
  310.    // The total upload size  
  311.    //  = (strlen ("\r\n") + strlen ("--") + strlen (Boundary) + strlen ("--\r\n")  
  312.    nTotalByte = cchBoundary + 8 ;  
  313.    nValuesTotalByte = 0 ;  
  314.   }  
  315.   
  316.   ::SafeInt<DWORD> dwTotalByte ;  
  317.   try {  
  318.    dwTotalByte = nTotalByte ;  
  319.   } catch (::SafeIntException & e) {  
  320.    HttpTool::ThrowException (e) ;  
  321.   }  
  322.   
  323.   // Get WinInet handles  
  324.   if ( hInternet == NULL ) {  
  325.    hInternet = OpenInternet () ;  
  326.    bBorrowedInternet = FALSE ;  
  327.   }  
  328.   
  329.   if ( hConnection == NULL ) {  
  330.    hConnection = OpenConnection (hInternet, szUrl, szUsrName, szUsrPwd) ;  
  331.    bBorrowedConnection = FALSE ;  
  332.   }  
  333.   
  334.   hRequest = OpenRequest (hConnection, HttpTool::szPost, szUrl, dwFlags, szReferer) ;  
  335.   AddRequestHeader (hRequest) ;   // Adds user's custom header  
  336.   
  337.   // Adds the Content-Type header  
  338.   HttpTool::AddHeader (hRequest, HttpTool::szContentType, _GetUploadContType (), m_nAnsiCodePage) ;  
  339.   
  340.   // Make a connection to the server  
  341.   HttpTool::SendRequestEx (hRequest, dwTotalByte.Value ()) ;  
  342.   
  343.   // Activates the Post Context  
  344.   m_objPostStat._MakeActive (nTotalByte.Value (), nValuesTotalByte.Value (), m_mapParam.Count (), nPostedFileCount.Value ()) ;  
  345.   m_bBorrowedInternet = bBorrowedInternet ;  
  346.   m_hInternet = hInternet ;  
  347.   m_bBorrowedConnection = bBorrowedConnection ;  
  348.   m_hConnection = hConnection ;  
  349.   m_hRequest = hRequest ;  
  350.   m_ahPostedFiles = ahFileHandles ;  
  351.   ahFileHandles = NULL ;  
  352.   m_aszMimeTypes = aszMimeTypes ;  
  353.   aszMimeTypes = NULL ;  
  354.   m_bIsPost = FALSE ;  
  355.   
  356.   // Saves the initial Post context  
  357.   if ( !m_mapParam.Empty () ) {  
  358.    m_objInitialStat = m_objPostStat ;  
  359.    // It always does not throw an overflow exception.  
  360.    // So it's safe. (doesn't need to restore the internal states)  
  361.    m_objInitialStat._StartNewEntry (szFirstParamName, cbFirstParamValue  
  362.     , bFirstParamIsFile, szFirstParamFileName) ;  
  363.   }  
  364.   
  365.  } catch (Exception &) {  
  366.   HttpTool::CloseRequest (hRequest) ;  
  367.   if ( !bBorrowedConnection ) HttpTool::CloseRequest (hConnection) ;  
  368.   if ( !bBorrowedInternet ) HttpTool::CloseRequest (hInternet) ;  
  369.   
  370.   for (DWORD i = 0; i < nPostedFileCount; i++) {  
  371.    if ( ahFileHandles ) {  
  372.     if ( ahFileHandles[i] != INVALID_HANDLE_VALUE ) {  
  373.      ::CloseHandle (ahFileHandles[i]) ;  
  374.      ahFileHandles[i] = INVALID_HANDLE_VALUE ;  
  375.     }  
  376.    }  
  377.   
  378.    if ( aszMimeTypes )  
  379.     SAFEFREE ( (aszMimeTypes[i]) ) ;  
  380.   }  
  381.   SAFEFREE (ahFileHandles) ;  
  382.   SAFEFREE (aszMimeTypes) ;  
  383.   throw ;  
  384.  }  
  385. }  
  386.   
  387.    
  388.   
  389. CHttpClientT<HttpTool, HttpEncoder>::_ProceedUploadContext (DWORD nDesired)  
  390. throw (Exception &)  
  391. {  
  392.  // If the Post context is not started  
  393.  if ( !m_objPostStat.IsActive () )  
  394.   HttpTool::ThrowException (HTTPCLIENT_ERR_POST_NOT_STARTED) ;  
  395.   
  396.  HTTPCLIENT_ASSERT (m_hInternet != NULL, "CHttpClientT::_ProceedUploadContext: m_hInternet can not be NULL.") ;  
  397.  HTTPCLIENT_ASSERT (m_hConnection != NULL, "CHttpClientT::_ProceedUploadContext: m_hConnection can not be NULL.") ;  
  398.  HTTPCLIENT_ASSERT (m_hRequest != NULL, "CHttpClientT::_ProceedUploadContext: m_hRequest can not be NULL.") ;  
  399.  HTTPCLIENT_ASSERT (nDesired != 0, "CHttpClientT::_ProceedUploadContext: nDesired can not be zero.") ;  
  400.   
  401.  try {  
  402.   // If all parameters are posted  
  403.   // releases the Post context  
  404.   if ( m_objPostStat._IsComplete () ) {  
  405.    HttpTool::EndRequest (m_hRequest) ;  
  406.    return _ReleasePostResponse () ;  
  407.   }  
  408.   
  409.   LPCSTR  szBoundary = _GetUploadBoundaryA () ;  
  410.   
  411.   // If there is no parameter to upload  
  412.   if ( m_objPostStat.TotalCount () == 0 ) {  
  413.    // Writes the last boundary  
  414.    _WritePost ("\r\n--") ;  
  415.    _WritePost (szBoundary) ;  
  416.    _WritePost ("--\r\n") ;  
  417.    return NULL ;  
  418.   }  
  419.   
  420.   // If the current parameter is completed  
  421.   if ( m_objPostStat.CurrParamIsComplete () ) {  
  422.   
  423.    // If all parameters are sent  
  424.    if ( m_objPostStat.TotalCount () == m_objPostStat.PostedCount () ) {  
  425.     // Writes the last boundary  
  426.     _WritePost ("--") ;  
  427.     _WritePost (szBoundary) ;  
  428.     _WritePost ("--\r\n") ;  
  429.     return NULL ;  
  430.    }  
  431.   
  432.    DWORD    nNextIdx = m_objPostStat.PostedCount () ;  
  433.    DWORD    nNextFileIdx = m_objPostStat.PostedFileCount () ;  
  434.    PCSZ    szEntryFile = NULL ;  
  435.    ::SafeInt<size_t> nEntryValueTotalByte = 0 ;  
  436.   
  437.    ConstMapIter iter = m_mapParam.Begin () ;  
  438.    for (size_t i = 0; i < nNextIdx; i++, ++iter) ;  
  439.   
  440.    if ( (iter->second).dwFlag & ParamFile ) {  
  441.     // If the parameter is a file parameter  
  442.   
  443.     szEntryFile = (iter->second).szValue ;  
  444.     if ( m_ahPostedFiles[nNextFileIdx] != INVALID_HANDLE_VALUE )  
  445.      nEntryValueTotalByte = HttpTool::GetFileSize (m_ahPostedFiles[nNextFileIdx], szEntryFile) ;  
  446.   
  447.     // Writes the boundary and headers  
  448.     _WritePost ("--") ;  
  449.     _WritePost (szBoundary) ;  
  450.     _WritePost ("\r\n") ;  
  451.     _WritePost ("Content-Disposition: form-data; name=\"") ;  
  452.     _WritePost (m_bUseUtf8, iter->first) ;  // Writes form name  
  453.     _WritePost ("\"; filename=\"") ;  
  454.     _WritePost (m_bUseUtf8, szEntryFile) ;  // Writes file path  
  455.     _WritePost ("\"\r\nContent-Type: ") ;  
  456.     _WritePost (m_aszMimeTypes[nNextFileIdx]) ;  
  457.     _WritePost ("\r\n\r\n") ;  
  458.   
  459.    } else {  
  460.     // If the parameter is not a file parameter  
  461.   
  462.     if ( (iter->second).szValue && (iter->second).szValue[0] != '\0' ) {  
  463.      LPCSTR  szPostedValue ;  
  464.      BOOL  bNeedToFree ;  
  465.   
  466.      if ( m_bUseUtf8 ) {  
  467.       szPostedValue = _Utf8Encode ((iter->second).szValue) ;  
  468.       bNeedToFree = TRUE ;  
  469.      } 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics