Login  
Search All Forums
Dart Home | PowerTCP Mail for ActiveX | Custom Development Reply | PowerTCP Mail for ActiveX Topics | Forums   
AuthorForum: PowerTCP Mail for ActiveX
Topic: http request content-type won't set properly
mhp

From: new york, NY USA
Posts: 47
Member Since: 04/24/02
posted August 22, 2002 6:33 PM

Do you notice anything wrong with this code?

long lIndex = 1;
_bstr_t bstrMessageCT = m->Header->Find(msgContentType, _bstr_t(""), &lIndex);
web->Request->Header->Add(httpContentType, bstrMessageCT, VARIANT_TRUE);

lIndex = 1;
bstrResponse = web->Request->Header->Find(httpContentType, _bstr_t(""), &lIndex);

// bstrResponse is always "", but I just set it?!?

web->GetRequest()->GetBody()->Write(bstrMessage, bstrMessage.length());
web->Post();

bstrResponse = web->GetResponse()->GetBody()->ReadString(0); //destroys stream once read


After setting the content-type header on the http request object, if I look for it, it comes back empty?!?
Any ideas why setting the content-type doesn't stick?
mhp

From: new york, NY USA
Posts: 47
Member Since: 04/24/02
posted August 22, 2002 6:34 PM

PS. In the debugger, when I step through this, I can see that bstrMessageCT is getting set properly to "text/plain;charset=UTF-8"
mhp

From: new york, NY USA
Posts: 47
Member Since: 04/24/02
posted August 23, 2002 12:40 PM

Also, I just updated my Dart DLL's and it still is not working as expected.
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted August 23, 2002 2:04 PM

Hi,
The Content-Type header is added prior to the send (if it was not added manually). It looks, therefore, like you are finding an empty string, and then setting the Content-Type header to an empty string.
Even if the header was present, what would be the purpose of getting its value, and then setting it to the same value?
-ken
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted August 23, 2002 2:06 PM

Hi,
Also, please do not post questions about Web Enterprise under the Mail Forum (there is a Web Enterprise Forum).
Thanks,
-ken
mhp

From: new york, NY USA
Posts: 47
Member Since: 04/24/02
posted August 23, 2002 2:11 PM

I'm actually getting the Content-Type from a message (the m variable below) and that's also the reason why I posted it here in the Mail forum.

Note that I'm not getting a blank Content-Type from the message, I'm getting the correct value. "text/plain;charset=UTF-8"

Then I attempt to place that string (the one I just got from the message) into an http request header and it doesn't "stick". ie. right after I set it, if I look the content-type is not set to "text/plain;charset=UTF-8". It is set to the blank string.
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted August 23, 2002 2:13 PM

Hi,
Disregard those two previous messages. I think I see what you are doing now.
You have a Message object m that you are getting the header from, correct?
Try using httpNull and "Content-Type: " as the first two parameters. Does that work?
Thanks,
-ken
mhp

From: new york, NY USA
Posts: 47
Member Since: 04/24/02
posted August 23, 2002 2:18 PM

Ken,

I tried doing that in the
web->Request->Header->Find(httpNull, _bstr_t("Content-Type:"), &lIndex);

And it still comes up as the empty string...
mhp

From: new york, NY USA
Posts: 47
Member Since: 04/24/02
posted August 23, 2002 2:30 PM

After some more testing I figured it out..

Looks like the 3rd parameter to the Find function (index to start looking after) is just as the docs say "Indicates the index to start the search after" so its gotta be 0 not 1 if you want it to find the 1st element..

sorry for the trouble.
Reply | PowerTCP Mail for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX