摘要认证及实现HTTP digest authentication - 简书
HTTP Basic和Digest认证介绍与计算 - 诸子流 - 博客园
不要不知道上面说的URI是什么意思啊
图解HTTP 第 8 章 确认访问用户身份的认证 - 简书8.1 何为认证 为了弄清究竟是谁在访问服务器,就得让对方的客户端自报家门。 可是,就算正在访问服务器的对方声称自己是ueno,身份是否属实这 点却也无从谈起。为确认 uen...https://www.jianshu.com/p/c78f9e19801a
这个图里面也明确有写URI 可以看出就是GET后面那部分 当然除开HTTP/1.1
Http auth认证的两种方式Basic方式和 Digest认证_Virgil_K2017的博客-CSDN博客
怪不得这里还要输入URL
在线生成Digest Auth、http基础认证密码生成、 Digest authentication在线生成、Digest Auth在线hash生成--查错网
HTTP Basic和Digest认证介绍与计算 - 诸子流 - 博客园
后来再地铁上看了下这个感觉还是挺简单的,最终就是计算出response HA1 HA2都是为了计算出response准备的。
http digest - 简书
这有专门进行MD5加密的网站
md5加密,sha1加密--md5在线解密
有找到MD5的C库
C版本MD5库_md5库,cmd5-C代码类资源-CSDN下载
所以最后回复的报文形式是什么样的
注意是计算MD5哈希值
http digest - 简书
怪不得MD5的C库的readme是说用这个函数
C版本MD5库_md5库,cmd5-C代码类资源-CSDN下载
所以这里写着哈希?
实际服务器返回的有这些
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="576250586",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
这里说必须包含这几个,返回的时候,实际可以看到顺序似乎没有那么严格
图解HTTP 第 8 章 确认访问用户身份的认证 - 简书
这个列了这些
http digest - 简书
这个有这几个
https://www.jianshu.com/p/c78f9e19801a
HTTP认证之摘要认证——Digest(一) - xiaoxiaotank - 博客园
cnonce是什么
客户端也要生成随机数么,是否可以不写或者乱写。
HTTP Basic和Digest认证介绍与计算 - 诸子流 - 博客园
http digest鉴权 - ostin - 博客园
服务器允许在一小段时间内使用同一个随机数。
HTTP认证之摘要认证——Digest(一) - xiaoxiaotank - 博客园
计算response的时候要用到nc和cnonce cnonce全程是clientnonce就是客户端的随机数。
那这样就好理解了,这两个数传给服务端是有意义的,服务端要用这个来计算,也就是这个response的结果包含了服务器端和客户端的数才能算出来。那既然是客户端的数,那自己随便写也没什么太大影响了?
摘要认证及实现HTTP digest authentication - 简书
这么看的话发回给服务器的确实要有或者说必须有下面这几个数字 除开response,其他的都是用来计算response的,一个都不能少。
假设就是这个吧
Authorization:Digest realm="some realm", (服务端给了)
username="xxxx",(服务端给了)
nonce="xxxx",(服务端给了)
uri="/xxx",(已知)
algorithm=MD5,(已知)
response="xxxx",(需要自己计算,也主要是计算这个)
qop=auth,(服务端给了)
nc=000001,(自己随便写?一般看到就是000001)
cnonce="xxxx"(自己随便写?)
URI我可以确定就是GET后面那串 除开HTTP/1.1
拍自《图解HTTP》 P173
这里也可以看出来
我目前的计算方法应该就是 还有这里面的method写什么?
method似乎指 GET 那怪不得A2写成method:URI 那不就是GET:....了么,这样感觉都可以不用死记了。(我后面手算了一个例子,也证明这个method就是GET,至少在用GET的时候是GET)
http协议之digest(摘要)认证_jszj的专栏-CSDN博客_digest
http digest - 简书
这里要选GET的意义可能也在这里
在线生成Digest Auth、http基础认证密码生成、 Digest authentication在线生成、Digest Auth在线hash生成--查错网
这个给出了从响应报文里面提取相应信息的函数!!!!!!!!!!!!!
数组名或者字符串名应该就是地址了,把字符串名直接放进去应该就可以了。
http digest认证过程分析及例子(这个给出了提取函数)_TYINY的博客-CSDN博客https://blog.csdn.net/sinat_16643223/article/details/120246611
//函数功能:生成随机字符串
//函数参数:生成随机字符串的长度
//返回值:成功返回随机字符串
char *createRandomNum(int N)
{
int flag;
int k=0,j=0;
char *random_str = (char*)malloc(N+1);
random_str[0] = '\0';
//1970到现在的时间sec作为种子
unsigned int seed = (unsigned)time(NULL);
srand(seed);
for(j=0;j
//函数功能:获取子串
//函数参数:source目标字符串;start_str开始字符串;end_chr结束字符
//返回值:成功返回该子串,失败返回NULL
char* GetTargetStr(const char*source,char*start_str,char end_chr)
{
char *p_start = NULL;
char *p_end = NULL;
p_start = strstr(source,start_str);
p_start += strlen(start_str);
p_end = strchr(p_start,end_chr);
char *ret = NULL;
if(p_end != NULL)
{
ret = (char*)malloc(p_end - p_start +1);
ret[p_end - p_start] = '\0';
memcpy(ret,p_start,p_end - p_start);
}
return ret;
}
//函数功能:获取WWW_Authenticate认证信息
//函数参数:self通信句柄;HttpRsp服务器响应数据包;HttpRspSize数据包的尺寸;head_len头长度;user登陆用户名;pwd用户密码
//返回值:成功返回OK,失败
//备注:该函数中nc的值,这里客户端不保存服务器发送的nonce,所以每次都是00000001
char *GetClientWWW_Authenticate(const char*response,long responseSize,int head_len\
,const char*user,const char*pwd)
{
char *realm = GetTargetStr(response,"realm=\"",'\"');
char *nonce = GetTargetStr(response,"nonce=\"",'\"');
char *algorithm = GetTargetStr(response,"algorithm=",',');
char *qop = GetTargetStr(response,"qop=\"",'\"');
assert(realm && nonce && algorithm && qop);
//FIXME
char *nc = "00000001";
char *cnonce = createRandomNum(32);//需要生成随机字符串
char A1[100] = {0};
sprintf(A1,"%s:%s:%s",user,realm,pwd);
char *md5_A1 = MD5_sign((unsigned char*)A1,strlen(A1));
char A2[80] = {0};
sprintf(A2,"GET:/Auth");
char *md5_A2 = MD5_sign((unsigned char*)A2,strlen(A2));
char contact[512] = {0};
sprintf(contact,"%s:%s:%s:%s:%s:%s",md5_A1,nonce,nc,cnonce,qop,md5_A2);
FREE_MALLOC(md5_A1);
FREE_MALLOC(md5_A2);
char *rsp = MD5_sign((unsigned char*)contact,strlen(contact));
char WWW_Authenticate[256] = {0};
char*format = "Digest username=\"%s\",realm=\"%s\",qop=\"%s\",algorithm=\"%s\",uri=\"/Auth\",nonce=\"%s\",nc=%s,cnonce=\"%s\",response=\"%s\"";
sprintf(WWW_Authenticate,format,user,realm,qop,algorithm,nonce,nc,cnonce,rsp);
FREE_MALLOC(realm);
FREE_MALLOC(qop);
FREE_MALLOC(algorithm);
FREE_MALLOC(nonce);
FREE_MALLOC(cnonce);
FREE_MALLOC(rsp);
return strdup(WWW_Authenticate);
}
该文最后服务器没有返回Authorization头域,这个也可以的,只是不够规范。
http digest认证过程分析及例子_希哈科技的博客-CSDN博客
现在再看这个就明晰了,这些要填的都是必不可少的,最后说生成哈希,确实是生成哈希,我们可以先拿这个算
在线生成Digest Auth、http基础认证密码生成、 Digest authentication在线生成、Digest Auth在线hash生成--查错网
突然发现我昨天用windows自带浏览器edge
看到的带有Authorization的报文信息正是一个完整的算好response的!!!!!!!
这是不是再次验证了这点,就是缺这个Digest验证了!!!!
从这个报文信息也可以看出
realm的值确实就是 Login to FH0427PAZ00039
我们可以参照这个标准格式来写。
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host: 192.168.42.108
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Authorization: Digest username="admin", realm="Login to FH0427PAZ00039", nonce="1298797490", uri="/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20", response="9a6ad1c876734b41a6f785a7389ade62", opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0", qop=auth, nc=00000002, cnonce="522e610057899296"
Connection: keep-alive
Cookie: VSLangCookie30=SimpChinese; username=admin; showIVSRule=false; VSWebClientSessionID=64481279; VSVideoWHMode=Adaptive%20Window
Upgrade-Insecure-Requests: 1
我用这个网站根据上面信息生成的response和上面一样!!
在线生成Digest Auth、http基础认证密码生成、 Digest authentication在线生成、Digest Auth在线hash生成--查错网
我想再自己手动计算一遍
HA1=MD5(admin:Login to FH0427PAZ00039:123456)=383c012bcbbe9ffec12341d6ca429a54
HA2=MD5(GET:/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20)=3c87b2218a4e2a849be6739cc61b36c9
response=MD5(383c012bcbbe9ffec12341d6ca429a54:1298797490:00000002:522e610057899296:auth:3c87b2218a4e2a849be6739cc61b36c9)=9a6ad1c876734b41a6f785a7389ade62
我最后算的结果和这个一样,说明我理解的没错 method那个就是填GET
下面这似乎可以看出MD5不区分大小写
MD5在线加密/解密/破解—MD5在线https://www.sojson.com/encrypt_md5.html
现在知道这里说的md5_middle什么意思了,16位 MD5和32位 MD5区别是取的是8~24位。
md5加密,sha1加密--md5在线解密
再发给服务器的时候按照这个格式发吧,就重新计算后替换掉Authorization那一行就可以了
用这个网站快速计算,而且自动给你生成Authorization的格式,应该直接复制粘贴进去就好。在线生成Digest Auth、http基础认证密码生成、 Digest authentication在线生成、Digest Auth在线hash生成--查错网
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host: 192.168.42.108
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Authorization: Digest username="admin", realm="Login to FH0427PAZ00039", nonce="1298797490", uri="/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20", response="9a6ad1c876734b41a6f785a7389ade62", opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0", qop=auth, nc=00000002, cnonce="522e610057899296"
Connection: keep-alive
Cookie: VSLangCookie30=SimpChinese; username=admin; showIVSRule=false; VSWebClientSessionID=64481279; VSVideoWHMode=Adaptive%20Window
Upgrade-Insecure-Requests: 1
现在还有一个问题,空格占不占字节数?
先给吊舱发这个,也是昨天发的
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host: 192.168.42.108
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 Edg/93.0.961.38
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6
Authorization:Basic YWRtaW46MTIzNDU2
Cookie: VSLangCookie30=SimpChinese; username=admin; showIVSRule=false
得到的回应
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="1555448628",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
第二次给吊舱发,替换掉AUthorization
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host: 192.168.42.108
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Authorization: Digest username="admin",
realm="Login to FH0427PAZ00039",
nonce="1555448628",
uri="/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20",
algorithm="MD5",
qop=auth,
nc=00000001,
cnonce="522e610057899297",
response="bb9ebe40094abc43844c8a0d501d746f",
opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: keep-alive
Cookie: VSLangCookie30=SimpChinese; username=admin; showIVSRule=false; VSWebClientSessionID=64481279; VSVideoWHMode=Adaptive%20Window
Upgrade-Insecure-Requests: 1
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host: 192.168.42.108
Authorization: Digest username="admin",
realm="Login to FH0427PAZ00039",
nonce="13123270",
uri="/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20",
algorithm="MD5",
qop=auth,
nc=00000004,
cnonce="522e610057899296",
response="4f2ed20b576761e7204b080ba08096b6",
opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: keep-alive
https://blog.csdn.net/sinat_16643223/article/details/120246611
现在 再看这里说的认证就看得懂了!!!!!!!!!!!!!!!
我觉得应该是有别人现成的代码的,用的这么多没道理没有啊
这个代码细看了下计算方法和我的是一样的,应该可以用
httpauth: #http协议之digest(摘要)认证 用于RTSP、SIP中的注册/呼叫认证##digest的算法: A1 = username:realm:password A2 = mthod:uriHA1 = MD5(A1) 如果 qop 值为“auth”或未指定,那么 HA2 为 HA2 = MD5(A2)=MD5(method:uri) 如果 qop 值为“auth-int”,那么 HA2 为 HA2 = MD5(A2)=MD5(method:uri:MD5(entityBody))如果 qop 值为“auth”或“auth-int”,那么如下计算 response: response = MD5(HA1:nonce:nc:cnonce:qop:HA2)如果 qop 未指定,那么如下计算 response: response = MD5(HA1:nonce:HA2)##功能实现 ###MD5 void md5(const uint8_t initial_msg, size_t initial_len, uint8_t digest); ###digest认证 int
编译出现未定义的应用说明没有找到这个函数体的实现,一般是make的时候没有链接。虽然只是个warning,但是不能忽视。
我把栈空间改到50M还是说有段错误
按照下面两篇博文来改的
Linux下运行C++程序出现"段错误(核心已转储)"的原因 - 白日焰火 - 博客园
linux查看修改线程默认栈空间大小(ulimit -s)_七点钟123的博客-CSDN博客
出现段错误不用怕,一行一行注释掉,看到底哪行引起的段错误,我就是这样找到出现段错误的地方并且不用那个函数了。
我把数值调整程一样可以验证我代码里MD5的计算没有错。 和下面这个结果是完全一样的,最后response的值
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host: 192.168.42.108
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Authorization: Digest username="admin", realm="Login to FH0427PAZ00039", nonce="1298797490", uri="/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20", response="9a6ad1c876734b41a6f785a7389ade62", opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0", qop=auth, nc=00000002, cnonce="522e610057899296"
Connection: keep-alive
Cookie: VSLangCookie30=SimpChinese; username=admin; showIVSRule=false; VSWebClientSessionID=64481279; VSVideoWHMode=Adaptive%20Window
Upgrade-Insecure-Requests: 1
MD5最后就是得到32个十六进制数
摘要认证及实现HTTP digest authentication_大大的CDream-CSDN博客
一直没明白它这是怎么弄的
这有个也是云台,也是网页,也是digest认证。
curl第六课 Http Digest Auth认证应用_weixin_33810302的博客-CSDN博客
这么搜一下还真是有一些。
这个realm也是 login to 、、、
https://www.baidu.com/link?url=hIFufPxhq0Q8RqUb7HHqXEYgzqyaD0nsg1nRQs3pvj22DDRiLibS1vQj1noMy5H8FJUM8r2VtiPCQ5lwuH5EhoXz1hnNfFHAtelAs7FhA8nWdMLpb53MJFhi_CL3JeC6&wd=&eqid=b59cbac90031a5ac00000002613e0eec
感觉海康威视的云台用起来感觉也差不多,是不是云台吊舱这类基本都是这种配置方法。digest可能也是标配。
海康威视摄像头HTTP接口能力调研材料.doc
以摘要认证(Digest Authentication)方式伪登录某摄像头_乱七八糟の中转站-CSDN博客
网络摄像头rtsp协议登录认证 - 走看看
认证的nonce确实有超时一说,至少海康摄像头这样,我估计其他可能也差不多
海康确实在这方面可以找到比较官方而且详细的资料
细看下海康还是符合digest协议的,那么视辉的应该也是符合的。
虽然它有的发的和那个HTTP文档的很像
关于海康摄像头的摘要认证_y673533511的博客-CSDN博客
这个人 还提供了源码,真的是非常良心了,明天可以自己试试,他用了这个我今天也找到的httpauth
他它似乎有更现成的代码,明天跑跑看。
hivisoion_projcet/digest/src at master · kyhkl/hivisoion_projcet · GitHub
它的代码是有从收到的响应报文里面提取nonce这个的。
digest/src/httpauth.c · 马熙/hivisoion_projcet - Gitee
digest/src/tcp_client.c · 马熙/hivisoion_projcet - Gitee.com
其实多个c文件的gcc也好写。
我目前 HTTP报文助手发送 HTTP代码一发送 海康威视更改代码发送,都不行,第二次法国去服务器返回来的都是没有认证成功。前两个MD5我都严格计算过,感觉有必要问一下他们的认证方式
细看这个cnonce也给的,那可以自己算
HA1=MD5(admin:VS\u 00408CA5EA04:admin)=44ada65f3a5976994a663120fe07b033
HA2=MD5(GET:/cgi-bin/magicBox.cgi?action=getLanguageCaps)=006035d2cf23aa4c834e43bb0861ad19
response=MD5(HA1:000562fdY631973ef04f77a3ede7c1832ff48720ef95ad:00000001:0a4f113b:auth:HA2)
response=MD5(44ada65f3a5976994a663120fe07b033:000562fdY631973ef04f77a3ede7c1832ff48720ef95ad:00000001:0a4f113b:auth:006035d2cf23aa4c834e43bb0861ad19)=3db2c0f0481392e9ebe8b3e80da61b69
算出的response居然不一样,难道密码不同?
这个网站计算出的和我算出的一样,那个opaque应该是没用上的
我把URI里额一个问号改了下英文的问号response就不一样了,这种细节也注意下。
这里看到可以选择RTSP的认证方式
默认选的Digest,我选择改为无试试。
现在知道为什么叫login to 这个名字了。
ONVIF这个似乎也之前见过啊,默认认证开启。
摄像机ONVIF登录校验开启的好与坏_易家电子-(www.ejdz.cn)
Onvif鉴权实现方式 - 静之深 - 博客园
我现在把上面两个认证都关掉看看(还是需要登录,就是改帧率的那个链接)
手动输入用户名密码登录这样报文里面可以看到authorization了
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host: 192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Authorization: Digest username="admin", realm="Login to FH0427PAZ00039", nonce="296446132", uri="/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20", response="c1b7de2fc55f709a5683626259b86398", opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0", qop=auth, nc=00000002, cnonce="d1143f7c8b561254"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 Edg/93.0.961.44
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6
Cookie: VSLangCookie30=SimpChinese; username=admin; showIVSRule=false
我用这个网站算了下,生成的response是一样的
在线生成Digest Auth、http基础认证密码生成、 Digest authentication在线生成、Digest Auth在线hash生成--查错网
我还在这里添加了一个IP白名单,原本什么都没有,这个IP是我自己电脑上设定的固定的本地IP
白名单看了下是这个意思,以为可以免登陆,实际不是的,那就算了,我又删掉了。等没有设置这个。
stale是表示nonce是否过期
关于海康摄像头的摘要认证 - it610.com
注意有时候提取的随机数不对
第一次看到回复OK.
maxi@maxi:~/linux_udp_tcp_maxi_test/HTTP/hivisoion_projcet/digest/src$ ./app 192.168.42.108 80
连接服务器成功
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="1035369453",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
the servers return 401
连接服务器成功
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Authorization: Digest username="admin", realm="Login to FH0427PAZ00039", nonce="1035369453", uri="/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20", response="e3a30694ef547d6ad3e2a30af0de6dc6", qop=auth, nc=00000001, cnonce="1035369457899296"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 200 OK
Content-type: text/plain;charset=utf-8
CONNECTION: close
CONTENT-LENGTH: 43
Error
ErrorID=0, Detail=Invalid Authority!
buflen is 141
rs is 1
HTTP/1.1 200 OK
Content-type: text/plain;charset=utf-8
CONNECTION: close
CONTENT-LENGTH: 43
Error
ErrorID=0, Detail=Invalid Authority!
buflen is 0
段错误 (核心已转储)
maxi@maxi:~/linux_udp_tcp_maxi_test/HTTP/hivisoion_projcet/digest/src$
我刚刚又发了一次,也是回复OK
maxi@maxi:~/linux_udp_tcp_maxi_test/HTTP/hivisoion_projcet/digest/src$ ./app 192.168.42.108 80
连接服务器成功
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="1238078794",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
the servers return 401
连接服务器成功
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Authorization: Digest username="admin", realm="Login to FH0427PAZ00039", nonce="1238078794", uri="/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20", response="7207e5a707b3ba74562410ba753801e5", qop=auth, nc=00000001, cnonce="1238078757899296"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 200 OK
Content-type: text/plain;charset=utf-8
CONNECTION: close
CONTENT-LENGTH: 43
Error
ErrorID=0, Detail=Invalid Authority!
buflen is 141
rs is 1
HTTP/1.1 200 OK
Content-type: text/plain;charset=utf-8
CONNECTION: close
CONTENT-LENGTH: 43
Error
ErrorID=0, Detail=Invalid Authority!
buflen is 0
段错误 (核心已转储)
maxi@maxi:~/linux_udp_tcp_maxi_test/HTTP/hivisoion_projcet/digest/src$
这是服务器第二次回复的报文的内容
HTTP/1.1 200 OK
Content-type: text/plain;charset=utf-8
CONNECTION: close
CONTENT-LENGTH: 43
Error
ErrorID=0, Detail=Invalid Authority!
现在的情况是我登陆成功了但是似乎没有权限改,这个HTTP相机协议.pdf里面有讲
Error
ErrorID=0, Detail=Invalid Authority!
buflen is 141
digest认证失败一般是因为nonce的数值提取得有问题,细看就会发现这点。这个代码目前有时候提取正确,有时候提取不正确。如果提取正确的话,是可以digest认证成功,返回OK。有时候提取出来的服务器随机数总是多出个3
maxi@maxi:~/linux_udp_tcp_maxi_test/HTTP/hivisoion_projcet/digest/src$ ./app 192.168.42.108 80
连接服务器成功
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="638200235",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
the servers return 401
连接服务器成功
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Authorization: Digest username="admin", realm="Login to FH0427PAZ00039", nonce="6382002353", uri="/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20", response="0552d2540cec5a2f4c36da79cd05ab39", qop=auth, nc=00000001, cnonce="6382002357899296"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="332800269",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
buflen is 204
rs is 1
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="332800269",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
buflen is 0
段错误 (核心已转储)
maxi@maxi:~/linux_udp_tcp_maxi_test/HTTP/hivisoion_projcet/digest/src$
maxi@maxi:~/linux_udp_tcp_maxi_test/HTTP/hivisoion_projcet/digest/src$ ./app 192.168.42.108 80
连接服务器成功
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="415140041",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
the servers return 401
连接服务器成功
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Authorization: Digest username="admin", realm="Login to FH0427PAZ00039", nonce="4151400413", uri="/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20", response="4b2dc5a9319be2c87fbd87e681318966", qop=auth, nc=00000001, cnonce="4151400457899296"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="516759653",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
buflen is 204
rs is 1
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="516759653",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
buflen is 0
段错误 (核心已转储)
我可能今天早上改好后没有多试几次?没有细看是否提取正确?
能够digest认证成功的代码是这里最新提交的,也是上午提交的。改为符合视辉吊舱的的代码。
就是这个版本的
我新建一个用户好像也不行。
我用我新建的maxi这个用户登陆也是改不了。
用admin admin登陆也是的,所以是不是我用户名密码的问题?还是什么?、
看了下似乎是用户名密码错误,这样可以通过digest认证但是改不了东西?
确实我用错误的密码,也是可以显示HTTP OK, 后面显示用户没有权限。所以这种情况是个什么意思呢,digest是认证成功了还是没有成功?
我实际自己算了下,算出的response不一样,需要找下问题。
看了下它的HA1 HA2都没有算错,最后的response算错了,找找为什么
我打印了下计算response MD5前的那个字符串,确实发现问题了。
应该写qop 写auth的地方出问题了,可能是提取qop提取不对,那就不提取嘛,本身就是auth
改了之后现在字符串是看着正常了
现在算是吻合了 ,现在MD5的计算没有问题了,response也没有问题了。
但是还是出现invalid Authority!
我现在换成用户maxi 密码123456后改成功了!!!!
我是先在浏览器上这么操作,发现现在maxi可以改了,之前还不行的
我再再代码里改称maxi,注意有个地方可能漏改,这里的也需要改成maxi
+= sprintf(&buf[pos], "Authorization: Digest username=\"maxi\", realm=\"Login to FH0427PAZ00039\", nonce=\"%s\", uri=\"/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20\", response=\"%s\", qop=auth, nc=00000001, cnonce=\"%s\"\r\n",auth->nonce,auth->response,auth->cnonce);
这是历史系的时刻
maxi@maxi:~/linux_udp_tcp_maxi_test/HTTP/hivisoion_projcet/digest/src$ make
gcc httpauth.c tcp_client.c -o app
maxi@maxi:~/linux_udp_tcp_maxi_test/HTTP/hivisoion_projcet/digest/src$ ./app 192.168.42.108 80
连接服务器成功
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="1535872314",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
the servers return 401
连接服务器成功
HA1 = 3c0b178fab08c1089296a0f93c447190
HA2 = 3c87b2218a4e2a849be6739cc61b36c9
response未计算DM5前: 3c0b178fab08c1089296a0f93c447190:1535872314:00000001:1535872357899296:auth:3c87b2218a4e2a849be6739cc61b36c9
response = aa140f49a2e9e2cad8ce38e63a73aec1
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Authorization: Digest username="maxi", realm="Login to FH0427PAZ00039", nonce="1535872314", uri="/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=20", response="aa140f49a2e9e2cad8ce38e63a73aec1", qop=auth, nc=00000001, cnonce="1535872357899296"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 200 OK
Content-type: text/plain;charset=utf-8
CONNECTION: close
CONTENT-LENGTH: 3
OK
buflen is 100
rs is 1
HTTP/1.1 200 OK
Content-type: text/plain;charset=utf-8
CONNECTION: close
CONTENT-LENGTH: 3
OK
buflen is 0
段错误 (核心已转储)
maxi@maxi:~/linux_udp_tcp_maxi_test/HTTP/hivisoion_projcet/digest/src$
我是先严格检测了这个代码MD5的计算,确保MD5的计算是正确的,再把用户改为非admin用户。这回就OK了。当然还有提取服务器的随机数有时候不对这个也需要解决一下。
今天是最开始发现,这个海康威视这版代码,有时候能让服务器反馈HTTP OK,虽然后面是inavlid aut...但总比一直返回401好些啊
目前能成功修改帧率的代码我上传到gitee了
https://gitee.com/maxibooksiyi/linux_udp_tcp_maxi_test/commit/89f70c3a60c22c13babe375d260802bcd9e89d09
昨天的代码不行我估计是那个基础的HTTP代码可能两次HTTP通信不是连着的?或者用户不能是admin?我改成maxi试试,昨天的代码我也是严格确认MD5的计算是正确的。
刚刚把昨天用的代码版本(HTTP/例程一)用户名改称maxi了,试了下,还是不行,帧率没有改成。
2021。9。17
要是重新出现没有修改权限(吊舱层面的,不是http digest认证),尝试很多次还是这样,原版不动的代码。可以试一下重启下吊舱。可能就好了,今天下午出现了这么一次。
2021.9.19
还是来解决一下这个提取nonce出问题的事情
接收到的需要更改的帧率是:21
连接服务器成功
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=21 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="865646852",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
the servers return 401
从响应报文提取出的nonce:8656468523
连接服务器成功
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=21 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Authorization: Digest username="maxi", realm="Login to FH0427PAZ00039", nonce="8656468523", uri="/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=21", response="6804ad7c56b34e94b12c64443f39084f", qop=auth, nc=00000001, cnonce="8656468557899296"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="446085594",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
buflen is 204
rs is 0
结束了
把begin和end打印出来
begin和end都没有问题,为什么最后会多出一个83 是不是因为最后没有价格字符串的结束标志?就是原本auth->nonce这个字符串长度是64,里面很可能是有值的,就像打印字符串,后面没有结束标志它可能把后面的一些也连着打出来了。这个或许是关键?
所以我觉得这个赋值完了之后可以加个字符串提取函数。把多的截断。
或者后面再赋值个字符串结束的字符。是的,我在结尾赋值'\0',现在试了几次能做到百分之百更改成功了。
接收到的需要更改的帧率是:21
连接服务器成功
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=21 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="39774219",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
the servers return 401
从响应报文提取出的nonce:3977421983
从响应报文提取出的begin:"39774219",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
从响应报文提取出的end:",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
连接服务器成功
GET /cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=21 HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Authorization: Digest username="maxi", realm="Login to FH0427PAZ00039", nonce="3977421983", uri="/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.FPS=21", response="51a618cc031aeb392dd7e2546235b826", qop=auth, nc=00000001, cnonce="3977421957899296"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="647481151",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
buflen is 204
rs is 0
结束了
字符串最后一个字符 是 \0 似乎。
字符串是一系列连续的字符的组合,要想在内存中定位一个字符串,除了要知道它的开头,还要知道它的结尾。找到字符串的开头很容易,知道它的名字(字符数组名或者字符串名)就可以;然而,如何找到字符串的结尾呢?C语言的解决方案有点奇妙,或者说有点奇葩。
在C语言中,字符串总是以'\0'
作为结尾,所以'\0'
也被称为字符串结束标志,或者字符串结束符。
'\0'
是 ASCII 码表中的第 0 个字符,英文称为 NUL,中文称为“空字符”。该字符既不能显示,也没有控制功能,输出该字符不会有任何效果,它在C语言中唯一的作用就是作为字符串结束标志。
C语言在处理字符串时,会从前往后逐个扫描字符,一旦遇到'\0'
就认为到达了字符串的末尾,就结束处理。'\0'
至关重要,没有'\0'
就意味着永远也到达不了字符串的结尾。
由" "
包围的字符串会自动在末尾添加'\0'
。例如,"abc123"
从表面看起来只包含了 6 个字符,其实不然,C语言会在最后隐式地添加一个'\0'
,这个过程是在后台默默地进行的,所以我们感受不到。
下图演示了"C program"
在内存中的存储情形:
需要注意的是,逐个字符地给数组赋值并不会自动添加'\0'
,例如:
数组 str 的长度为 3,而不是 4,因为最后没有'\0'
。
当用字符数组存储字符串时,要特别注意'\0'
,要为'\0'
留个位置;这意味着,字符数组的长度至少要比字符串的长度大 1。请看下面的例子:
"abc123"
看起来只包含了 6 个字符,我们却将 str 的长度定义为 7,就是为了能够容纳最后的'\0'
。如果将 str 的长度定义为 6,它就无法容纳'\0'
了。
当字符串长度大于数组长度时,有些较老或者不严格的编译器并不会报错,甚至连警告都没有,这就为以后的错误埋下了伏笔,读者自己要多多注意。
有些时候,程序的逻辑要求我们必须逐个字符地为数组赋值,这个时候就很容易遗忘字符串结束标志'\0'
。下面的代码中,我们将 26 个大写英文字符存入字符数组,并以字符串的形式输出:
在 VS2015 下的运行结果:
ABCDEFGHIJKLMNOPQRSTUVWXYZ口口口口i口口0 ?
口
表示无法显示的特殊字符。
现在可以做到每次百分之百digest认证成功了,因为保证了nonce提取的正确,其实那个提取函数prase_response没有问题,仔细分析了下它的逻辑,还有我用printf打印出begin end,发现提取的位置没有问题,但是打印出的nonce就是有时候比真在的nonce多出一两个字符,我又看到这个代码定义的nonce的字符串长度是64,那么我想到是不是之前出现过的类似情况,字符串最末为没有字符串结束字符,导致把后面的也接着打印出来了,我开始想加个字符串截断函数,后来还是选择就在字符串应该结束的位置后面一位赋值'\0',知道是赋值这个也是看了:C语言字符数组和字符串_C语言中文网 ,也就是在之前代码的基础上加了这句 auth->nonce[end-begin-1]={'\0'}; 然后编译再运行,果然就每次都更改成功了,没有再出现因为nonce提取错误导致有时候digest认证不成功的情况,现在也明白为什么总是提取出的nonce比真在的nonce多出个3或者83等等的原因了,其实提取得正确,就是缺少字符串结束字符,没有这个结束字符,你正确的字符串在使用的时候就可能被别人误读,多取,导致出现这种情况。
2021.9.27
我们浏览网页通常不加端口号是什么原因? - 知乎
偏偏抓图这里要写一个端口号,我觉得就是改端口号就够了,digest认证里面并不涉及到端口号啊。
2021.9.28
图片报文也传回来了只是最后出现段错误。
更改分辨率两次HTTP请求操作结束
=======================================================================
连接服务器成功
GET /cgi-bin/snapshot.cgi? HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="2071764994",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
the servers return 401
从响应报文提取出的nonce:2071764994
从响应报文提取出的begin:"2071764994",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
从响应报文提取出的end:",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
连接服务器成功
GET /cgi-bin/snapshot.cgi? HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Authorization: Digest username="maxi", realm="Login to FH0427PAZ00039", nonce="2071764994", uri="/cgi-bin/snapshot.cgi?", response="8eaa83187917c80f195bddb57b0c6b78", qop=auth, nc=00000001, cnonce="2071764957899296"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 94888
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 5792
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 4344
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2128
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 5792
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 5792
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 5792
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 5792
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 4344
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 2591
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 199388
����buflen is 0
[gimbal_vsheen_http-2] process has died [pid 10223, exit code -11, cmd /home/maxi/catkin_ws2/devel/lib/gimbal_control/gimbal_vsheen_http __name:=gimbal_vsheen_http __log:=/home/maxi/catkin_ws2/log/ffe214b6-2003-11ec-be86-84a93e05fc60/gimbal_vsheen_http-2.log].
log file: /home/maxi/catkin_ws2/log/ffe214b6-2003-11ec-be86-84a93e05fc60/gimbal_vsheen_http-2*.log
digest认证应该成功了,就是这个图片报文的处理。
这里有满时就停止录像
SD卡上是有截图的保存的,我刚才发送URL是成功了的
10 对应十点,25 32 53对应分钟应该就是我刚才弄的三次,第一次是通过浏览器,第二次第三次是通过代码发送的url。
初步实现把传回的图片保存到本地。
记录一次完整的图片接收报文
=======================================================================
连接服务器成功
GET /cgi-bin/snapshot.cgi? HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Digest realm="Login to FH0427PAZ00039",qop="auth",nonce="283823519",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
the servers return 401
从响应报文提取出的nonce:283823519
从响应报文提取出的begin:"283823519",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
从响应报文提取出的end:",opaque="ecd96bfa32ed521cda6e9a8ed1701e6b3ef687d0"
Connection: close
CONTENT-LENGTH: 0
连接服务器成功
GET /cgi-bin/snapshot.cgi? HTTP/1.1
Host:192.168.42.108
Connection: keep-alive
Cache-Control: max-age=0
Authorization: Digest username="maxi", realm="Login to FH0427PAZ00039", nonce="283823519", uri="/cgi-bin/snapshot.cgi?", response="0277c9531d9092d97fde2ac2d46cc854", qop=auth, nc=00000001, cnonce="2838235157899296"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 94712
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 4344
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 856
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 2896
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 1448
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 3161
rs is 1
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-type: image/jpeg
CONNECTION: close
CONTENT-LENGTH: 198510
����buflen is 0
^C[gimbal_vsheen_http-2] killing on exit
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
maxi@maxi:~$
保存在SD卡上的抓图可以看到EXIF信息,但是http传回来的,然后自己上传到Git上的说没有EXIF信息。
可以用这个软件看
opanda iexif中文版下载-Exif信息查看器官方下载「图片工具」-华军软件园
用这个软件看EXIF信息也可以看到
Opanda PowerExif破解版(图像Exif信息编辑程序)V1.3 中文版软件下载 - 绿色先锋下载 - 绿色软件下载站
这个网页也可以看得到GPS信息。
EXIF信息查看器
确实传回的图片的EXIF里面就没有GPS信息。
9.28晚上十点
我看了下通过URL浏览器方式获取的传回的抓图也是没有EXIF信息的!!!!所以不是我获取的问题,是传回来的本身就没有!!!!!
也就是今天上午我最开始用浏览器获取到的抓图。