|
-
March 28th, 2006, 04:13 AM
#1
CHttpFile QueryInfoStatusCode 406 error
I have recently moved my websites from a linux machine to a windows .net v2 machine. I've been having various teething pains due to the differences and the latest affects the autoupgrade feature of a freeware program. The program checks this URL:
http://lava.lounge111.net/gong/gong!version.dat
Assuming its not in the internet cache (aka if I browse to it the code will work) the code gets a 406 HTTP_STATUS_NONE_ACCEPTABLE.
Interestingly, although this doesn't help the current installs looking at the above URL, if I change the software to look at this URL:
http://lava.lounge111.net/gong/gong!version.txt
it works perfectly. So there is some play between the extension txt vs. dat. Initially the server wouldn't serve up a dat file at all, it returned a 404. I contacted the ISP and, without explaining what they've done, I can now browse to it. But via the code no such luck, I get a 406.
Code:
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;
pServer = session.GetHttpConnection(strServerName, nPort);
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET,
strObject, NULL, 1, NULL, NULL, INTERNET_FLAG_EXISTING_CONNECT);
const TCHAR szHeaders[] =
_T("Accept: text/*\r\nUser-Agent: GONG_Update\r\n");
pFile->AddRequestHeaders(szHeaders);
pFile->SendRequest();
DWORD dwRet;
pFile->QueryInfoStatusCode(dwRet);
I was wondering if it was the headers. Does anyone have any ideas?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|