2010年5月17日

C cgi url 编码解码问题

摘要: 这几天在学习用C写CGI程序呢,第一个遇到的问题就是编码了。0~9 a~z A~Z这些字符是不会被编码的,但是比如一些特殊字符或是中文,post或get数据时,会对数据自动进行编码,比如汉字'中',如果页面采用的是gb2312编码,'中'字会被编码为'%D6%D0',忽略'%'标识,两个十六进制数,即0xD6,0xD0,六个字符。如果页面是utf-8编码,'中'字会被编码为'%D6%D0%AD',... 阅读全文

posted @ 2010-05-17 17:11 风乔 阅读(485) 评论(0) 推荐(0) 编辑

cgi 大文件下载

摘要: 客户端是纯HTML代码,点击链接后从服务器端下载文件。我现在服务器端是这么处理的:HTTP 1/1 200 OKContent-Length=500Content-Type=application/octet-stream Content-disposition:attachment;filename="1.zip"以上HTTP头之后接上我读出的文件流后客户端浏览器便能出现下载框了。现在的问题是... 阅读全文

posted @ 2010-05-17 17:02 风乔 阅读(421) 评论(0) 推荐(0) 编辑

CGI C 设置 读取 cookies

摘要: #include #include "cgic.h " #include #include test1.cgi int cgiMain() { char username[25]= "uuuu "; char pass[25] = "123 "; //printf( "Set-Cookie:username=%s;Set-Cookie:password=%... 阅读全文

posted @ 2010-05-17 17:01 风乔 阅读(544) 评论(0) 推荐(0) 编辑

c#网页抓取

摘要: 我先来了。首先mshtml很有用,对于html元素的解析很强大。比如:using mshtml;private string ConvertToAbsoluteUrls(string html, Uri relativeLocation, HtmlTag _htmlTag){IHTMLDocument2 doc = new HTMLDocumentClass();doc.write(new obj... 阅读全文

posted @ 2010-05-17 11:34 风乔 阅读(481) 评论(0) 推荐(0) 编辑

linux socket 编程

摘要: 1. socket() 2. bind() 3. connect() 4. listen() 5. accept() 6. send()和recv() 7. sendto()和recvfrom() ... 阅读全文

posted @ 2010-05-17 10:29 风乔 阅读(133) 评论(0) 推荐(0) 编辑

Linux下基于C实现的socket简单文件下载实例

摘要: 此实例是客户端向服务器端下载文件:服务器端代码实现:#include #include #include #include #include #include #include #include #include #include #define FD_SERVER_PORT 8088 /*set port*/#define FD_BUFFERSIZE 1024 /*set buffer size... 阅读全文

posted @ 2010-05-17 10:27 风乔 阅读(770) 评论(0) 推荐(0) 编辑

Linux下基于C实现的socket简单文件上传实例

摘要: 此实例是客户端向服务器端传送文件服务器端代码实现:#include #include #include #include #include #include #include #include #include #include #define FU_SERVER_PORT 8080 /*set port*/#define FU_BUFFERSIZE 1024 /*set buffer size*... 阅读全文

posted @ 2010-05-17 10:26 风乔 阅读(465) 评论(0) 推荐(0) 编辑

导航