- 浏览: 2928954 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (2529)
- finance (1459)
- technology (218)
- life (343)
- play (150)
- technology-component (0)
- idea (6)
- house (74)
- health (75)
- work (32)
- joke (23)
- blog (1)
- amazing (13)
- important (22)
- study (13)
- Alternative (0)
- funny (8)
- stock_technology (12)
- business (16)
- car (21)
- decorate (4)
- basketball (2)
- English (16)
- banker (1)
- TheBest (1)
- sample (2)
- love (13)
- management (4)
最新评论
-
zhongmin2012:
BSM确实需要实践,标准ITIL服务流程支持,要做好,需要花费 ...
BSM实施之前做什么 -
shw340518:
提示楼主,有时间逻辑bug:是你妈二十那年写的 那会儿连你爹都 ...
80后辣妈给未来儿子的信~我的儿,你也给我记住了~~~ -
guoapeng:
有相关的文档吗?
it项目管理表格(包含146个DOC文档模板) -
solomon:
看到的都是 这种 CTRL+C 和 CTRL+V 的文章, ...
Designing a website with InfoGlue components -
wendal:
恩, 不错. 有参考价值
Designing a website with InfoGlue components
最近做的程序需要用到HTTP上传文件和表单提交的功能,在各大网站这方面的资料实在是少的可怜。找了好久,最后在国外的一家网站找到了相关的文档。做完工程后总结,开始的主要问题出在报头的格式上。现将报头的写法和相关的函数摘出来。程序的实现是用CHTTP类。
//报头格式,类似于这样--------------------------------------
cpp 代码
- LPCSTR szDefUsrAgent = "Ryeol HTTP Client Class" ;
- LPCSTR szGET = "GET" ;
- LPCSTR szPost = "POST" ;
- LPCSTR szHTTP = "HTTP://" ;
- LPCSTR szHTTPS = "HTTPS://" ;
- LPCSTR szSlash = "/" ;
- LPCSTR szCacheControl = "Cache-Control" ;
- LPCSTR szNoCache = "no-cache" ;
- LPCSTR szContentType = "Content-Type" ;
- LPCSTR szMultipartFormDataBoundary = "multipart/form-data; boundary=" ;
- LPCSTR szFormUrlEncoded = "application/x-www-form-urlencoded" ;
- LPCSTR szDefBoundary = "----FB3B405B7EAE495aB0C0295C54D4E096-" ; //这行分隔符很重要的,开始的程序就是没加这个,一直不行。
- LPCSTR szDefUploadContType = "multipart/form-data; boundary=" "----FB3B405B7EAE495aB0C0295C54D4E096-" ;
- LPCSTR szNULL = "NULL" ;
- LPCSTR szEmptyString = "" ;
- LPCSTR szColonSlashSlash = "://" ;
- 下面是提出来的一段函数代码:
- void CHttpToolA::AddHeader (HINTERNET hRequest, LPCSTR szName, LPCSTR szValue, UINT /* CodePage */)
- throw (Exception &)
- {
- HTTPTOOL_ASSERT (hRequest != NULL, "CHttpToolA::AddHeader: hRequest can not be NULL.") ;
- HTTPTOOL_ASSERT (szName != NULL, "CHttpToolA::AddHeader: szName can not be NULL.") ;
- ::SafeInt<size_t> cbHeader ;
- ::SafeInt<DWORD> cchHeader ;
- try {
- cbHeader = ::strlen (szName) ;
- cbHeader += szValue ? ::strlen (szValue) : 0 ;
- cbHeader += (4 + 1) ; // for ": ", "\r\n", '\0'
- cchHeader = cbHeader - 1 ;
- } catch (::SafeIntException & e) {
- ThrowException (e) ;
- }
- PSTR szHeader = (PSTR) ::malloc (sizeof (CHAR) * (cbHeader.Value ())) ;
- if ( szHeader == NULL )
- ThrowException (HTTPCLIENT_ERR_OUT_OF_MEMORY) ;
- ::strcpy (szHeader, szName) ;
- ::strcat (szHeader, ": ") ;
- ::strcat (szHeader, szValue ? szValue : "") ;
- ::strcat (szHeader, "\r\n") ;
- // Adds a header
- if ( !::HttpAddRequestHeadersA (
- hRequest
- , szHeader // headers to append to the request.
- , cchHeader.Value () // header length
- , HTTP_ADDREQ_FLAG_ADD // flags
- )
- ) {
- SAFEFREE (szHeader) ;
- ThrowException (HTTPCLIENT_ERR_HTTPADDREQUESTHEADERS_FAILED, ::GetLastError ()) ;
- }
- SAFEFREE (szHeader) ;
- }
- void CHttpToolA::SendRequest (HINTERNET hRequest, LPCSTR szPosted, UINT /* CodePage */)
- throw (Exception &)
- {
- HTTPTOOL_ASSERT (hRequest != NULL, "CHttpToolA::SendRequest: hRequest can not be NULL.") ;
- ::SafeInt<DWORD> cchPosted ;
- try {
- cchPosted = szPosted ? ::strlen (szPosted) : 0 ;
- } catch (::SafeIntException & e) {
- ThrowException (e) ;
- }
- if ( !::HttpSendRequestA (
- hRequest
- , NULL // Additional header
- , 0 // The length of the additional header
- , (void *) szPosted // A posted data
- , cchPosted.Value () // The length of the posted data
- ) )
- ThrowException (HTTPCLIENT_ERR_HTTPSENDREQUEST_FAILED, ::GetLastError ()) ;
- }
- void CHttpToolA::SendRequestEx (HINTERNET hRequest, DWORD dwPostedSize)
- throw (Exception &)
- {
- HTTPTOOL_ASSERT (hRequest != NULL, "CHttpToolA::SendRequestEx: hRequest can not be NULL.") ;
- INTERNET_BUFFERSA BufferIn;
- BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS ); // Must be set or error will occur
- BufferIn.Next = NULL;
- BufferIn.lpcszHeader = NULL;
- BufferIn.dwHeadersLength = 0;
- BufferIn.dwHeadersTotal = 0;
- BufferIn.lpvBuffer = NULL;
- BufferIn.dwBufferLength = 0;
- BufferIn.dwBufferTotal = dwPostedSize; // This is the only member used other than dwStructSize
- BufferIn.dwOffsetLow = 0;
- BufferIn.dwOffsetHigh = 0;
- if ( !::HttpSendRequestExA (
- hRequest
- , &BufferIn
- , NULL
- , 0
- , 0
- ) )
- ThrowException (HTTPCLIENT_ERR_HTTPSENDREQUESTEX_FAILED, ::GetLastError ()) ;
- }
- // The returned string must be freed by using the ::free () function.
- LPSTR CHttpToolA::CreateUploadBoundary (void)
- throw ()
- {
- GUID guid ;
- if ( FAILED ( ::CoCreateGuid (&guid)) )
- return NULL ;
- PSTR szBoundary = (PSTR) ::malloc (sizeof (CHAR) * 44) ;
- if ( szBoundary == NULL )
- return NULL ;
- ::sprintf (szBoundary, "----LYOUL-%.08x%.04x%.04x%.02x%.02x%.02x%.02x%.02x%.02x%.02x%.02x-"
- , guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1]
- , guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
- return szBoundary ;
- }
- void CHttpClientT<HttpTool, HttpEncoder>::_StartUploadContext (HINTERNET hInternet, HINTERNET hConnection, PCSZ szUrl
- , DWORD dwFlags, PCSZ szReferer, PCSZ szUsrName, PCSZ szUsrPwd)
- throw (Exception &)
- {
- // Closes any existing Post Context
- _EndPostContext () ;
- BOOL bBorrowedInternet = TRUE ;
- BOOL bBorrowedConnection = TRUE ;
- HINTERNET hRequest = NULL ;
- HANDLE * ahFileHandles = NULL ;
- LPSTR * aszMimeTypes = NULL ;
- ::SafeInt<DWORD> nPostedFileCount = 0 ;
- try {
- // Calculates the nubmer of bytes to upload
- ::SafeInt<size_t> nTotalByte = 0 ;
- ::SafeInt<size_t> nValuesTotalByte = 0 ;
- size_t cchBoundary = HttpTool::StringLen (_GetUploadBoundary ()) ;
- PCSZ szFirstParamName = NULL ;
- PCSZ szFirstParamFileName = NULL ;
- size_t cbFirstParamValue = 0 ;
- BOOL bFirstParamIsFile = FALSE ;
- if ( !m_mapParam.Empty () ) {
- try {
- ConstMapIter iter ;
- // Get the number of files
- for (iter = m_mapParam.Begin (); iter != m_mapParam.End (); ++iter) {
- if ( (iter->second).dwFlag & ParamFile )
- nPostedFileCount++ ;
- }
- if ( nPostedFileCount.Value () ) {
- // Allocates memory for handles and MimeTypes of the uploaded files
- ahFileHandles = (HANDLE *) ::calloc (nPostedFileCount.Value (), sizeof (HANDLE)) ;
- if ( ahFileHandles == NULL )
- HttpTool::ThrowException (HTTPCLIENT_ERR_OUT_OF_MEMORY) ;
- // Initializes the file handles
- for (DWORD i = 0; i < nPostedFileCount; i++)
- ahFileHandles[i] = INVALID_HANDLE_VALUE ;
- aszMimeTypes = (LPSTR *) ::calloc (nPostedFileCount.Value (), sizeof (LPSTR)) ;
- if ( aszMimeTypes == NULL )
- HttpTool::ThrowException (HTTPCLIENT_ERR_OUT_OF_MEMORY) ;
- }
- /*
- Calculates the total upload size
- <1> The number of bytes to upload If the parameter is not a file
- = strlen ("--") + strlen (Boundary) + strlen ("\r\n")
- + strlen ("Content-Disposition: form-data; name=\"\"\r\n\r\n")
- + strlen (The name of the parameter) + strlen (The value of the parameter) + strlen ("\r\n") ;
- <2> The number of bytes to upload If the parameter is a file
- = strlen ("--") + strlen (Boundary) + strlen ("\r\n")
- + strlen ("Content-Disposition: form-data; name=\"\"; filename=\"\"\r\n")
- + strlen (The name of the parameter) + strlen (The value of the parameter)
- + strlen ("Content-Type: \r\n\r\n") + strlen (The Mime Type of the file)
- + The length of the file + strlen ("\r\n")
- The last boundary
- = strlen ("--") + strlen (Boundary) + strlen ("--\r\n")
- The total upload size
- = ( <1> * The number of normal parameters)
- + ( <2> * The number of file parameters)
- + The last boundary
- */
- ::SafeInt<size_t> cbValue ;
- DWORD nFileIdx = 0 ;
- nTotalByte = 0 ;
- nValuesTotalByte = 0 ;
- for (iter = m_mapParam.Begin (); iter != m_mapParam.End (); ++iter) {
- if ( !((iter->second).dwFlag & ParamFile) ) {
- // If the parameter is not a file
- // = strlen ("--") + strlen (Boundary) + strlen ("\r\n")
- // + strlen ("Content-Disposition: form-data; name=\"\"\r\n\r\n")
- // + strlen (The name of the parameter) + strlen (The value of the parameter) + strlen ("\r\n") ;
- nTotalByte += (cchBoundary + 4) ;
- nTotalByte += 43 ;
- if ( m_bUseUtf8 ) {
- nTotalByte += _Utf8EncodeLen (iter->first) ;
- cbValue = _Utf8EncodeLen ((iter->second).szValue) ;
- } else {
- nTotalByte += _String2AnsiLen (iter->first) ;
- cbValue = _String2AnsiLen ((iter->second).szValue) ;
- }
- nTotalByte += cbValue ;
- nValuesTotalByte += cbValue ;
- nTotalByte += 2 ;
- // Saves the state of the first parameter
- if ( iter == m_mapParam.Begin () ) {
- szFirstParamName = iter->first ;
- cbFirstParamValue = cbValue.Value () ;
- bFirstParamIsFile = FALSE ;
- szFirstParamFileName = NULL ;
- }
- } else {
- // If the parameter is a file
- // = strlen ("--") + strlen (Boundary) + strlen ("\r\n")
- // + strlen ("Content-Disposition: form-data; name=\"\"; filename=\"\"\r\n")
- // + strlen (The name of the parameter) + strlen (The value of the parameter)
- // + strlen ("Content-Type: \r\n\r\n") + strlen (The Mime Type of the file)
- // + The length of the file + strlen ("\r\n")
- nTotalByte += (cchBoundary + 4) ;
- nTotalByte += 54 ;
- if ( m_bUseUtf8 ) {
- nTotalByte += _Utf8EncodeLen (iter->first) ;
- nTotalByte += _Utf8EncodeLen ((iter->second).szValue) ;
- } else {
- nTotalByte += _String2AnsiLen (iter->first) ;
- nTotalByte += _String2AnsiLen ((iter->second).szValue) ;
- }
- nTotalByte += 18 ;
- // Get the file size and MimeType
- cbValue = 0 ;
- if ( (iter->second).szValue ) {
- // Open the file
- ahFileHandles[nFileIdx] = HttpTool::OpenFile ((iter->second).szValue) ;
- // Get the file size
- if ( ahFileHandles[nFileIdx] != INVALID_HANDLE_VALUE )
- cbValue = HttpTool::GetFileSize (ahFileHandles[nFileIdx], (iter->second).szValue) ;
- }
- // Throws an exception
- if ( m_bStrictFileCheck && (ahFileHandles[nFileIdx] == INVALID_HANDLE_VALUE) )
- HttpTool::ThrowException (HTTPCLIENT_ERR_OPENFILE_FAILED, ::GetLastError (), (iter->second).szValue) ;
- // Get the MimeType of the file
- aszMimeTypes[nFileIdx] = HttpTool::GetMimeType (ahFileHandles[nFileIdx], m_nAnsiCodePage) ;
- nTotalByte += CHttpToolA::StringLen (aszMimeTypes[nFileIdx]) ;
- nTotalByte += cbValue ;
- nValuesTotalByte += cbValue ;
- nTotalByte += 2 ;
- nFileIdx++ ;
- // Saves the state of the first parameter
- if ( iter == m_mapParam.Begin () ) {
- szFirstParamName = iter->first ;
- cbFirstParamValue = cbValue.Value () ;
- bFirstParamIsFile = TRUE ;
- szFirstParamFileName = (iter->second).szValue ;
- }
- }
- }
- // The last boundary
- // = strlen ("--") + strlen (Boundary) + strlen ("--\r\n")
- nTotalByte += (cchBoundary + 6) ;
- } catch (::SafeIntException & e) {
- HttpTool::ThrowException (e) ;
- }
- } else {
- // The total upload size
- // = (strlen ("\r\n") + strlen ("--") + strlen (Boundary) + strlen ("--\r\n")
- nTotalByte = cchBoundary + 8 ;
- nValuesTotalByte = 0 ;
- }
- ::SafeInt<DWORD> dwTotalByte ;
- try {
- dwTotalByte = nTotalByte ;
- } catch (::SafeIntException & e) {
- HttpTool::ThrowException (e) ;
- }
- // Get WinInet handles
- if ( hInternet == NULL ) {
- hInternet = OpenInternet () ;
- bBorrowedInternet = FALSE ;
- }
- if ( hConnection == NULL ) {
- hConnection = OpenConnection (hInternet, szUrl, szUsrName, szUsrPwd) ;
- bBorrowedConnection = FALSE ;
- }
- hRequest = OpenRequest (hConnection, HttpTool::szPost, szUrl, dwFlags, szReferer) ;
- AddRequestHeader (hRequest) ; // Adds user's custom header
- // Adds the Content-Type header
- HttpTool::AddHeader (hRequest, HttpTool::szContentType, _GetUploadContType (), m_nAnsiCodePage) ;
- // Make a connection to the server
- HttpTool::SendRequestEx (hRequest, dwTotalByte.Value ()) ;
- // Activates the Post Context
- m_objPostStat._MakeActive (nTotalByte.Value (), nValuesTotalByte.Value (), m_mapParam.Count (), nPostedFileCount.Value ()) ;
- m_bBorrowedInternet = bBorrowedInternet ;
- m_hInternet = hInternet ;
- m_bBorrowedConnection = bBorrowedConnection ;
- m_hConnection = hConnection ;
- m_hRequest = hRequest ;
- m_ahPostedFiles = ahFileHandles ;
- ahFileHandles = NULL ;
- m_aszMimeTypes = aszMimeTypes ;
- aszMimeTypes = NULL ;
- m_bIsPost = FALSE ;
- // Saves the initial Post context
- if ( !m_mapParam.Empty () ) {
- m_objInitialStat = m_objPostStat ;
- // It always does not throw an overflow exception.
- // So it's safe. (doesn't need to restore the internal states)
- m_objInitialStat._StartNewEntry (szFirstParamName, cbFirstParamValue
- , bFirstParamIsFile, szFirstParamFileName) ;
- }
- } catch (Exception &) {
- HttpTool::CloseRequest (hRequest) ;
- if ( !bBorrowedConnection ) HttpTool::CloseRequest (hConnection) ;
- if ( !bBorrowedInternet ) HttpTool::CloseRequest (hInternet) ;
- for (DWORD i = 0; i < nPostedFileCount; i++) {
- if ( ahFileHandles ) {
- if ( ahFileHandles[i] != INVALID_HANDLE_VALUE ) {
- ::CloseHandle (ahFileHandles[i]) ;
- ahFileHandles[i] = INVALID_HANDLE_VALUE ;
- }
- }
- if ( aszMimeTypes )
- SAFEFREE ( (aszMimeTypes[i]) ) ;
- }
- SAFEFREE (ahFileHandles) ;
- SAFEFREE (aszMimeTypes) ;
- throw ;
- }
- }
- CHttpClientT<HttpTool, HttpEncoder>::_ProceedUploadContext (DWORD nDesired)
- throw (Exception &)
- {
- // If the Post context is not started
- if ( !m_objPostStat.IsActive () )
- HttpTool::ThrowException (HTTPCLIENT_ERR_POST_NOT_STARTED) ;
- HTTPCLIENT_ASSERT (m_hInternet != NULL, "CHttpClientT::_ProceedUploadContext: m_hInternet can not be NULL.") ;
- HTTPCLIENT_ASSERT (m_hConnection != NULL, "CHttpClientT::_ProceedUploadContext: m_hConnection can not be NULL.") ;
- HTTPCLIENT_ASSERT (m_hRequest != NULL, "CHttpClientT::_ProceedUploadContext: m_hRequest can not be NULL.") ;
- HTTPCLIENT_ASSERT (nDesired != 0, "CHttpClientT::_ProceedUploadContext: nDesired can not be zero.") ;
- try {
- // If all parameters are posted
- // releases the Post context
- if ( m_objPostStat._IsComplete () ) {
- HttpTool::EndRequest (m_hRequest) ;
- return _ReleasePostResponse () ;
- }
- LPCSTR szBoundary = _GetUploadBoundaryA () ;
- // If there is no parameter to upload
- if ( m_objPostStat.TotalCount () == 0 ) {
- // Writes the last boundary
- _WritePost ("\r\n--") ;
- _WritePost (szBoundary) ;
- _WritePost ("--\r\n") ;
- return NULL ;
- }
- // If the current parameter is completed
- if ( m_objPostStat.CurrParamIsComplete () ) {
- // If all parameters are sent
- if ( m_objPostStat.TotalCount () == m_objPostStat.PostedCount () ) {
- // Writes the last boundary
- _WritePost ("--") ;
- _WritePost (szBoundary) ;
- _WritePost ("--\r\n") ;
- return NULL ;
- }
- DWORD nNextIdx = m_objPostStat.PostedCount () ;
- DWORD nNextFileIdx = m_objPostStat.PostedFileCount () ;
- PCSZ szEntryFile = NULL ;
- ::SafeInt<size_t> nEntryValueTotalByte = 0 ;
- ConstMapIter iter = m_mapParam.Begin () ;
- for (size_t i = 0; i < nNextIdx; i++, ++iter) ;
- if ( (iter->second).dwFlag & ParamFile ) {
- // If the parameter is a file parameter
- szEntryFile = (iter->second).szValue ;
- if ( m_ahPostedFiles[nNextFileIdx] != INVALID_HANDLE_VALUE )
- nEntryValueTotalByte = HttpTool::GetFileSize (m_ahPostedFiles[nNextFileIdx], szEntryFile) ;
- // Writes the boundary and headers
- _WritePost ("--") ;
- _WritePost (szBoundary) ;
- _WritePost ("\r\n") ;
- _WritePost ("Content-Disposition: form-data; name=\"") ;
- _WritePost (m_bUseUtf8, iter->first) ; // Writes form name
- _WritePost ("\"; filename=\"") ;
- _WritePost (m_bUseUtf8, szEntryFile) ; // Writes file path
- _WritePost ("\"\r\nContent-Type: ") ;
- _WritePost (m_aszMimeTypes[nNextFileIdx]) ;
- _WritePost ("\r\n\r\n") ;
- } else {
- // If the parameter is not a file parameter
- if ( (iter->second).szValue && (iter->second).szValue[0] != '\0' ) {
- LPCSTR szPostedValue ;
- BOOL bNeedToFree ;
- if ( m_bUseUtf8 ) {
- szPostedValue = _Utf8Encode ((iter->second).szValue) ;
- bNeedToFree = TRUE ;
- }
发表评论
-
New Enterprise Security Solutions
2011-09-13 15:46 0<!-- [if !mso]> <styl ... -
ES Announces Enterprise Security Solutions
2011-09-13 15:40 0<!-- [if !mso]> <styl ... -
linux下如何将文件打包、压缩并分割成制定大小?
2010-09-15 18:52 3303将大文件或目录打包、 ... -
rhel4 yum安装, 使用
2010-09-07 16:37 0第一种方法: yum源来自chinalinuxpub.com ... -
Windows: 远程自动安装程序
2010-08-26 15:48 1069问题的提出 作为 ... -
Oracle体系结构
2010-08-07 09:53 992Oracle体系结构 Oracle Server包括Oracl ... -
ocp sesson 3
2010-07-31 14:39 0show parameter undo 只有 默认情况下服务 ... -
ocp session 2
2010-07-25 17:00 0/home/oracle/raInventory/orains ... -
ocp session 1
2010-07-24 13:02 0ocp first lesson D:\oracle_cou ... -
Python的xmlrpc调试
2010-07-19 23:55 2089Python的xmlrpc 调 试 ----------- ... -
mdadm使用详解及RAID 5简单分析
2010-07-11 16:19 1374http://blog.csdn.net/chinalinux ... -
Linux的lvm的基本配置步骤
2010-07-11 14:53 12751.增加硬件 增加的ide硬盘前缀为hd,scs ... -
OCP study material
2010-07-11 13:52 0\\192.168.1.105watch -n 1 'stat ... -
apache+python+mod_python+django 编译安装指南
2010-06-24 17:25 14611、本文将知道你在 linux 下使用源码包安装 ... -
在ubuntu下配置apache运行python脚本
2010-06-22 16:11 2258常用的简单命令 sudo apt ... -
Python 2.5 Quick Reference
2010-06-21 11:18 1450... -
shell 面试题汇集
2010-06-10 19:50 1036利用 top 取某个进程的 CPU 的脚本 : ... -
shell程序面试题
2010-06-10 19:48 28431.要求分析Apache访问日志,找出里面数量在前面100位的 ... -
EMC技术支持工程师笔试部分试题回忆
2010-06-07 15:16 1635要查看更多EMC公司笔经相关信息,请访问EMC公司校园招聘CL ... -
linux shell 条件语句
2010-06-03 23:29 1768...
相关推荐
2. **设置请求头**:在HTTP上传中,报头协议起着至关重要的作用。例如,我们需要设置`Content-Type`来告诉服务器我们发送的数据类型,可能是`multipart/form-data`或`application/x-www-form-urlencoded`。此外,还...
在优化网络性能方面,HTTP报头如`Accept-Encoding`允许客户端表明可以接受的压缩格式(如gzip),以减少传输数据量。`Range`报头可以请求获取资源的一部分,提高效率。`If-Modified-Since`和`If-None-Match`配合使用...
2. **请求报头**:客户端信息,如用户代理、接受的编码格式等。 3. **响应报头**:服务器信息,如服务器软件版本、内容长度等。 4. **实体报头**:与实体内容相关的元信息,如内容类型、内容编码等。 #### 利用...
- PUT:上传一个资源并以指定的URI作为标识。 - DELETE:请求服务器删除指定资源。 - **请求URI**:资源的标识符。 - **HTTP版本**:请求使用的HTTP协议版本。 **示例**: - GET方法:`GET /form....
图片应以jpg格式上传,并设置为居中对齐,以保持整体布局的平衡。 在Word中编辑简报时,应注意文字的对齐方式和字间距。通常,简报的文本应该设置为左对齐,以提高阅读的舒适度。若发现字体字间距过大,可以通过...
在文件下载场景中,HTTP协议定义了客户端(通常是浏览器)与服务器之间的通信规则,包括请求方法(如GET、POST)、状态码、报头等元素。 “HTTP文件下载模拟器”就是基于这一协议,模拟一个基本的HTTP服务器,它...
- **POST**:向指定资源提交数据进行处理请求(例如提交表单或者上传文件)。 - **PUT**:替换目标资源的内容。 - **DELETE**:删除指定资源。 - **HEAD**:获取资源的头部信息。 ##### 响应状态码 HTTP响应状态码...
- **POST**:向指定资源提交数据进行处理请求(例如提交表单或者上传文件)。数据被包含在请求正文中。 - **HEAD**:与GET方法一样,只是不返回消息主体部分。通常用于获取报头信息。 - **OPTIONS**:请求查询目标...