IIS6 file download problem

IIS6 file download problem

Post by Larr » Mon, 26 Jul 2004 03:15:31


Hi,

I had a project which download files from our company server. It always
worked before until we switch to IIS 6 (win2003).
My program always get "<h1>Bad Request (Invalid Header Name)</h1>".

I checked MS site, and got article "828726": which says:
----------------------
"In Microsoft Internet Information Services (IIS) 6.0, when a request
contains a header name that includes a question mark (?) character or
another separator character, Http.sys rejects the request and sends the
following error message to the requestor:


Bad Request (Invalid Header Name)"
----------------------

here is my code, anyone can help me to take out the "separator character"?
or any other way to do that?
thanks a lot,
larry

---------
CHttpUpdater * p = (CHttpUpdater*)pTran;
CString szHeaders = _T("Accept: */*\r\nUser-Agent: InetHttp\r\n");


LPCTSTR pstrAcceptTypes ="*/*";
DWORD dwFlags = INTERNET_FLAG_EXISTING_CONNECT;// |
INTERNET_FLAG_NO_AUTO_REDIRECT;
TRY
{
if (p->IsHalt()) AfxThrowUserException();
p->m_pFile = p->m_pConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET,
p->m_sRemoteFileName, NULL, 1, &pstrAcceptTypes, NULL, dwFlags);

p->m_pFile->AddRequestHeaders(szHeaders);

. . .
}
 
 
 

IIS6 file download problem

Post by Ken Schaef » Mon, 26 Jul 2004 21:04:59

Please show us the actual HTTP headers you are using for the request. Bad
Request means that your request is somehow malformed. We need to see what
you are acutally outputting as the HTTP request.

Cheers
Ken



p->m_pConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET,

 
 
 

IIS6 file download problem

Post by Larr » Tue, 27 Jul 2004 03:09:38

thanks for your reply,

Sorry I left my project in my office. I will get it on Monday.

Would you please provide a sample good header with a piece of code? or where
I can find some good header samples?

thanks a lot,
larry






character"?
 
 
 

IIS6 file download problem

Post by Ken Schaef » Tue, 27 Jul 2004 08:18:38

They are in the relevant RFC (HTTP v1.1)

Chees
Ken




where


Bad
what


always
the
 
 
 

IIS6 file download problem

Post by Larr » Tue, 27 Jul 2004 11:52:02

hanks a lot,

I found a lot of information by searching that online.
I will study them to see if I can find out the problem in my code.

thanks again,
larry


"Ken Schaefer" < XXXX@XXXXX.COM > wrote in message
news:utk$ XXXX@XXXXX.COM ...
request
or