请教HTTP/1.1 200 OK, Success Content-length: 0的原因

nzc123 2010-02-08 10:01:01
发送彩信的时候,返回了这样的信息,不知道是哪里出的问题。
HTTP/1.1 200 OK, Success
Content-length: 0



用的函数是这样的:
InternetOpen代理之后,InternetConnect,HttpOpenRequest,HttpSendRequest。
...全文
2551 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
nzc123 2010-02-21
  • 打赏
  • 举报
回复
组包代码:
//X-Mms-Message-Type(0x8c): m-send-req(0x80)
int iRealLen;
DWORD dLength;
CString strGlobalGUID = get_strGUID();
CString szXmlFileName = ExtractFileName(Attach);
//附件数据
char* pAttachData = FileGetContents(Attach,&dLength);
if(!pAttachData)
{
return 0;
}
int flength = strlen(pAttachData);
BYTE* pCurPos = (BYTE*)m_pBuffContent;
*pCurPos = 0x8c; pCurPos++;
*pCurPos = 0x80; pCurPos++;

//ID
*pCurPos = 0x98; pCurPos++;
char* pID =w2m(strGlobalGUID.GetBuffer(0));
// char* pID = (char*)strGlobalGUID.GetBuffer(strGlobalGUID.);
memcpy((char*)pCurPos,pID,strlen(pID));
pCurPos += strlen(pID);
*pCurPos = 0x00; pCurPos++;
free(pID);
pID = NULL;
//X-Mms-MMS-Version(0x8d):v1.0(0x90)
*pCurPos = 0x8d; pCurPos++;
*pCurPos = 0x90; pCurPos++;

//from
*pCurPos = 0x89; pCurPos++;
*pCurPos = 0x01; pCurPos++;
*pCurPos = 0x81; pCurPos++;

//To(0x97)
TCHAR szToCombin[64];
_stprintf( szToCombin, _T("%s%s%s"), _T("+86"), PhoneNum,_T("/TYPE=PLMN") );
*pCurPos = 0x97; pCurPos++;
char* pTo = w2m(szToCombin);//new char[2*50];
int ipTo = strlen(pTo);
//WCharToMByte(szToCombin,pTo,2*50);
//String_WCharToMByte( szToCombin, &pTo );
memcpy( (char*)pCurPos, pTo,strlen(pTo) );
pCurPos += strlen(pTo);
*pCurPos = 0x00; pCurPos++;

//subject
*pCurPos = 0x96; pCurPos++;
char* pSubject =w2m(Subject.GetBuffer(0)); //new char[Subject.GetLength()*2];
// WCharToMByte(Subject.GetBuffer(0),pSubject,Subject.GetLength()*2);
//String_WCharToMByte( Subject, &pSubject);
//pSubject = "MmsTest";
memcpy( (char*)pCurPos, pSubject,strlen(pSubject));
pCurPos += strlen(pSubject);
*pCurPos = 0x00; pCurPos++;
free(pSubject);
pSubject = NULL;

//Content-Type: application/vnd.wap.multipart.mixed
*pCurPos = 0x84; pCurPos++;
*pCurPos = 0xa3; pCurPos++;

//multipart,count
*pCurPos = 0x01; pCurPos++;

//headerslen
*pCurPos = 0x0f; pCurPos++;
int iDataTextLen;
//String_WCharToMByte( szXmlData, &pAttachData );

//DataLen, 附件数据长度
iDataTextLen = dLength + 1;
int iByteLen = 0;
BYTE* pDataLen = new BYTE[8];
encodeUintvar(iDataTextLen,(char*)pDataLen,&iByteLen);// encodeUintvar( iDataTextLen, iByteLen );
memcpy( (char*)pCurPos, (char*)pDataLen, iByteLen );
pCurPos += iByteLen;
//*pCurPos = (unsigned char)iDataTextLen; pCurPos++;

//headlen
*pCurPos = 5 + _tcslen(szXmlFileName); pCurPos++;
//uft-8
*pCurPos = 0x83; pCurPos++;
*pCurPos = 0x85; pCurPos++;

//attach file name
char* pAttachFile = w2m(szXmlFileName.GetBuffer(0));
//String_WCharToMByte( szXmlFileName, &pAttachFile );
//pAttachFile = "phone.xml";
memcpy( (char*)pCurPos, pAttachFile,strlen(pAttachFile));
pCurPos += strlen(pAttachFile);
*pCurPos = 0x00; pCurPos++;

//Charset utf-8
*pCurPos = 0x81; pCurPos++;
*pCurPos = 0xea; pCurPos++;

//attach file content
memcpy( (char*)pCurPos, pAttachData,dLength);
pCurPos += dLength;
*pCurPos = 0x00; pCurPos++;
pAttachData[1] = 0;
delete pAttachData;
pAttachData = NULL;
free(pTo);
pTo = NULL;
delete pDataLen;
pDataLen = NULL;
free(pAttachFile);
pAttachFile = NULL;
//彩信包实际长度
iRealLen = pCurPos - (BYTE*)m_pBuffContent;
return iRealLen;

用这个代码组成的包,发不出去。
nzc123 2010-02-20
  • 打赏
  • 举报
回复
我现在怀疑是PDU组包出错的问题,有谁能提供一个MMSC简单的C++代码组包? 谢谢。
nzc123 2010-02-20
  • 打赏
  • 举报
回复
引用 12 楼 hsyouxishe 的回复:
/HTTP /1.1\r\n  改成1.0 试试看

还是返回:HTTP/1.1 200 OK, Success
Content-length: 0
金笛子 2010-02-20
  • 打赏
  • 举报
回复
/HTTP /1.1\r\n 改成1.0 试试看
nzc123 2010-02-20
  • 打赏
  • 举报
回复
顶起,这个春节因为这个问题搞的很不爽啊。
sxcnfly 2010-02-08
  • 打赏
  • 举报
回复
肯定有数据的,send-conf包,你先检查一下你发送的请求,content type是否填对。
儿大不由爷 2010-02-08
  • 打赏
  • 举报
回复
能确认您的返回是一定有数据(content)返回的么?
儿大不由爷 2010-02-08
  • 打赏
  • 举报
回复
Content-length: 0
已经说明了没有返回数据了,只有头
nzc123 2010-02-08
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 microsky2813 的回复:]
你继续接受,或者请求下
[/Quote]
一直在接收啊InternetReadFile,但没接收到数据.就只有HEADER而已.
MicroSky2813 2010-02-08
  • 打赏
  • 举报
回复
你继续接受,或者请求下
nzc123 2010-02-08
  • 打赏
  • 举报
回复
UP,难道论坛这么多人都没遇到过这种情况吗?
nzc123 2010-02-08
  • 打赏
  • 举报
回复
引用 8 楼 sxcnfly 的回复:
Host: 10.0.0.172:80改为Host: 10.0.0.172,去除端口

去了也一样的,而且我看了别人的代码,80是默认的,去掉不去掉都一样.
http://topic.csdn.net/u/20090709/10/a99d7c25-4a3b-4cf4-af84-7be21c256fd4.html
sxcnfly 2010-02-08
  • 打赏
  • 举报
回复
Host: 10.0.0.172:80改为Host: 10.0.0.172,去除端口
nzc123 2010-02-08
  • 打赏
  • 举报
回复
引用 5 楼 sxcnfly 的回复:
肯定有数据的,send-conf包,你先检查一下你发送的请求,content type是否填对。

HTTP HEADER如下
CStringA headerBuffer = "POST http://" + MmscName + " /HTTP /1.1\r\n";
headerBuffer += "Accept: image/png, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*\r\n";
//网关地址, 目前移动联通都是 10.0.0.172:80
headerBuffer += "Host: 10.0.0.172:80\r\n";
headerBuffer += "X-Online-Host: " + MmscName + "\r\n";
headerBuffer += "Pragma: no-cache\r\n";
headerBuffer += "Cache-Control: no-cache\r\n";
headerBuffer += "Connection: Keep-Alive\r\n";
headerBuffer += "Accept-Encoding: deflate, gzip\r\n";
headerBuffer += "User-Agent: SAMSUNG-SGH-E908/NetFront 3.2/WAP2.0 Profile/MIDP-2.0 Configuration/CLDC-1.1\r\n";
headerBuffer += "Accept: application/vnd.wap.mms-message, image/vnd.wap.wbmp, image/png, image/jpeg, image/gif, text/x-iMelody, text/x-imelody, application/x-midi, audio/midi, audio/mid, audio/x-mid, image/bmp, audio/mp3, audio/x-midi, audio/amr, application/vnd.smaf, application/vnd.wap.mms-message x-wap-profile:http://wap.samsungmobile.com/uaprof/e908_10.xml\r\n";
//s_length 为彩信包的长度
headerBuffer += "Content-Length:" + strLength + "\r\n";
headerBuffer += "Content-Type:application/vnd.wap.mms-message\r\n\r\n";

后面跟上的是PDU包.
nzc123 2010-02-08
  • 打赏
  • 举报
回复
引用 4 楼 ultrapro 的回复:
能确认您的返回是一定有数据(content)返回的么?

应该是有的,发给MMSC的彩信包.

7,657

社区成员

发帖
与我相关
我的任务
社区描述
Windows Phone是微软发布的一款手机操作系统,它将微软旗下的Xbox LIVE游戏、Zune音乐与独特的视频体验整合至手机中。
社区管理员
  • Windows客户端开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧