Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/http headers should be case-insensitive #13

Closed
DartBot opened this issue Jun 5, 2015 · 8 comments
Closed

pkg/http headers should be case-insensitive #13

DartBot opened this issue Jun 5, 2015 · 8 comments
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@DartBot
Copy link

DartBot commented Jun 5, 2015

Originally opened as dart-lang/sdk#17062

This issue was originally filed by [email protected]


When using the code snippet below, the content-type header is overloaded by "text/plain".

  import 'package:http/http.dart' as Http;
  Http.post(url, body: postData, headers: { "Content-Type": "text/xml" })

As we can't set _contentType from Request class, could you add 'content-type' in basic client requests also ? (see 'request.dart' source code)

  set body(String value) {
    bodyBytes = encoding.encode(value);
    var contentType = _contentType;
    if (contentType == null) {
      contentType = new ContentType("text", "plain", charset: encoding.name);
    } else if (contentType.charset == null) {
      contentType = new ContentType(contentType.primaryType,
                                    contentType.subType,
                                    charset: encoding.name,
                                    parameters: contentType.parameters);
    }
    _contentType = contentType;
  }

Environement
Dart VM version: 1.1.3 (Thu Feb 06 00:05:52 2014) on "windows_ia32"
http package: http-0.9.2+3

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

This comment was originally written by [email protected]


With the following code snippet, the header 'content-type' is correctly passed.

  import 'package:http/http.dart' as Http;
  Http.post(url, body: postData, headers: { "content-type": "text/xml" })

Request class shouldn't be case sensitive for HTML headers.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/17034?v=3" align="left" width="48" height="48"hspace="10"> Comment by kevmoo


cc @nex3.
Added Pkg-Http, Area-Pkg, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3


Changed the title to: "pkg/http headers should be case-insensitive".

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3


Issue #15 has been merged into this issue.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3


dart-lang/sdk@e47cf13 makes the request headers case-insensitive. We'll need to make the response headers case-insensitive before we can release this, though.

@DartBot DartBot added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Jun 5, 2015
@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/1924313?v=3" align="left" width="48" height="48"hspace="10"> Comment by jtmcdole


This breaks multi-part mime boundaries, which are allowed to be in any case they want to be. See:

http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html

     Content-Type: multipart/mixed;
          boundary=gc0p4Jq0M2Yt08jU534c0p

which means the boundary markers are:
--gc0p4Jq0M2Yt08jU534c0p
foo bar baz

--gc0p4Jq0M2Yt08jU534c0p

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="48" height="48"hspace="10"> Comment by nex3


Only the header names are case-insensitive, not the values.

@donny-dont
Copy link

This is resolved on master. Can close this now or with a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants