Home > Software engineering >  HttpSendRequest error code 12150
HttpSendRequest error code 12150

Time:10-23

I Get/post some sites use WinInet way, there is no problem, and some have a problem, this is my head structure of agreement, I this is according to others' e language code translation, with the somebody else e code completely no problem, but I am wrong translation, call HttpSendRequest returns FALSE, a wrong is 12150, baidu, a lot of information, tried various methods, has been not solve, ask the great spirit guide, I am a UNICODE program
//cstrings strSubjoinProtocolHeader; 
If (strSubjoinProtocolHeader. Find (L "Accept")==1)
StrSubjoinProtocolHeader=strSubjoinProtocolHeader + L "Accept: text/HTML and application/XHTML + XML, */* \ r \ n";
If (strSubjoinProtocolHeader. Find "Accept - Encoding:" (L)==1)
StrSubjoinProtocolHeader=strSubjoinProtocolHeader + L "Accept - Encoding: GBK, GB2312 \ r \ n";
If (strSubjoinProtocolHeader. Find the "Referer:" (L)==1)
StrSubjoinProtocolHeader=strSubjoinProtocolHeader + L "Referer:" + strUrl + L "\ r \ n";
If (strSubjoinProtocolHeader. Find "Accept - Language:" (L)==1)
StrSubjoinProtocolHeader=strSubjoinProtocolHeader + L "Accept - Language: useful - cn \ r \ n";
If (strSubjoinProtocolHeader. Find "content-type:" (L)==1)
StrSubjoinProtocolHeader=strSubjoinProtocolHeader + L "content-type: application/x - WWW - form - urlencoded \ r \ n";
If (strSubjoinProtocolHeader. Find "cache-control:" (L)==1)
StrSubjoinProtocolHeader=strSubjoinProtocolHeader + L "cache-control: no - Cache \ r \ n";
If (strSubmitCookies. IsEmpty ()==FALSE)
StrSubjoinProtocolHeader="Cookie:" + strSubmitCookies strSubjoinProtocolHeader + L + L "\ r \ n";
Cstrings strTempVisitType=strVisitType;
StrTempVisitType. MakeLower ();
If (strTempVisitType==L "get")
BFlag=HttpSendRequest (hHttpRequest, strSubjoinProtocolHeader, strSubjoinProtocolHeader GetLength (), NULL, 0).
Int nError=GetLastError ();
If (bFlag==FALSE)

CodePudding user response:

12150 ERROR_HTTP_HEADER_NOT_FOUND
The requested header could not be located.

CodePudding user response:

Directly send your bag to go to catch the HTTP header information, see whether it is right

CodePudding user response:

pay attention to the Note on the MSDN


Note The HttpSendRequestA function represents headers as ISO-8859-1 characters not ANSI characters. The HttpSendRequestW function represents headers as ISO-8859-1 characters converted to UTF-16LE characters. As a result, it is never safe to use the HttpSendRequestW function when the headers to be added can contain non-ASCII characters. Instead, an application can use the MultiByteToWideChar and WideCharToMultiByte functions with a Codepage parameter set to 28591 to map between ANSI characters and UTF-16LE characters.
  • Related