x


HTTP Response Headers?

I see how to set headers for GET and POST, but how do I get the headers on the response? There's data there that I need to read.

more ▼

asked Jul 21 '10 at 11:19 PM

grey gravatar image

grey
34 3 3 8

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

UniWeb provides complete support for HTTP. It should support everything you need.

more ▼

answered Jan 31 '11 at 06:51 AM

Simon Wittber gravatar image

Simon Wittber
323 5 6 14

(comments are locked)
10|3000 characters needed characters left

We added support for responseheaders to the WWW class in Unity3.

more ▼

answered Aug 01 '10 at 10:01 PM

Lucas Meijer 1 gravatar image

Lucas Meijer 1 ♦♦
8k 19 43 85

Yeah just found it thanks to C# intellisense. The responseHeaders shouldn't be a HashTable because eg. "Set-Cookie:" can be included multiple times in one response header. The HashTable can only contain one "Set-Cookie:". Would be nice to have a fix for this, anytime ;)

Jan 28 '11 at 03:09 AM Bunny83

Whoa, not in the docs (as of 4//29/11)?

Apr 29 '11 at 08:06 PM DaveA

How does this work? The documentation has no information on this.

Jun 28 '11 at 06:37 AM oskilian

It's just a Hashtable. Just query the header you want to read:

// C#
string cookie = www.responseHeaders["Set-Cookie"];

// JS
var cookie = www.responseHeaders["Set-Cookie"];
Jul 04 '11 at 01:52 PM Bunny83

Why can't ResponseHeaders be read before the requested file is completely downloaded? It would be quite nice if I could show players how many MB are left to go in their AssetBundle download while they watch a bar slide across their screens. (Also see here: http://answers.unity3d.com/questions/196661/extra-www-download-statistics.html?viewedQuestions=196657&viewedQuestions=196344 )

Dec 22 '11 at 06:34 PM Aubrey Falconer
(comments are locked)
10|3000 characters needed characters left

You can't with the default WWW implementation. You'd have to go through the .NET web client class most likely:

http://msdn.microsoft.com/en-us/library/system.net.webclient(VS.80).aspx

more ▼

answered Jul 22 '10 at 12:13 AM

Mike 3 gravatar image

Mike 3
30.7k 10 67 255

That is... not so good. Thanks for the response. I have no idea how to do that, so if you happen to have additional insight there, that would be helpful.

Jul 22 '10 at 02:25 AM grey

There are plenty of tutorials around, e.g. http://dotnetperls.com/webclient

Jul 22 '10 at 09:30 AM Mike 3

This answer is obsolete

Jul 04 '11 at 07:17 PM DaveA
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x547
x76
x36
x27
x10

asked: Jul 21 '10 at 11:19 PM

Seen: 4972 times

Last Updated: Feb 08 '12 at 03:06 AM