Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bb0acb5

Browse filesBrowse files
committed
Merge pull request andyburke#51 from jjay/master
Support for both version of WWWForm.headers
2 parents 034fbdd + b42fe16 commit bb0acb5
Copy full SHA for bb0acb5

File tree

Expand file treeCollapse file tree

2 files changed

+23
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+23
-6
lines changed
Open diff view settings
Collapse file

‎src/FormDataStream.cs‎

Copy file name to clipboardExpand all lines: src/FormDataStream.cs
+12-2Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
namespace HTTP {
66

77
public class FormPart {
8-
string fieldName;
9-
string mimeType;
108
byte[] header;
119
Stream contents;
1210
int position = 0;
@@ -51,6 +49,11 @@ public int Read(byte[] buffer, int offset, int size){
5149
position += bytesToWrite;
5250
return writed;
5351
}
52+
53+
public void Dispose(){
54+
header = null;
55+
contents.Close();
56+
}
5457
}
5558

5659
public class FormDataStream: Stream {
@@ -151,6 +154,13 @@ public void AddPart(FormPart part){
151154
}
152155
parts.Add(part);
153156
}
157+
158+
public override void Close(){
159+
foreach (var part in parts){
160+
part.Dispose();
161+
}
162+
base.Close();
163+
}
154164
}
155165

156166
}
Collapse file

‎src/Request.cs‎

Copy file name to clipboardExpand all lines: src/Request.cs
+11-4Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,17 @@ public Request( string method, string uri, WWWForm form )
8989
this.method = method;
9090
this.uri = new Uri (uri);
9191
this.byteStream = new MemoryStream(form.data);
92-
foreach ( KeyValuePair<string,string> pair in form.headers )
93-
{
94-
this.AddHeader(pair.Key,pair.Value);
95-
}
92+
#if UNITY_5
93+
foreach ( var entry in form.headers )
94+
{
95+
this.AddHeader( entry.Key, entry.Value );
96+
}
97+
#else
98+
foreach ( DictionaryEntry entry in form.headers )
99+
{
100+
this.AddHeader( (string)entry.Key, (string)entry.Value );
101+
}
102+
#endif
96103
}
97104

98105
public Request( string method, string uri, Hashtable data )

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.