Skip to content

Add an option to disable or change URI encoding in HTTP package #10475

Closed
@DartBot

Description

@DartBot

This issue was originally filed by kaisellgren@gmail.com


Currently as it stands, the HTTP package uses encodeUriComponent() from dart:uri to encode all fields.

This is not good when writing something like OAuth 1 lib for Twitter which happens to be what I/we are doing right now.

Instead, I have a fully RFC 3986 compliant percentage encoder, which Twitter OAuth API likes. The problem is that there is no way to disable or switch the encoding that is used.

Can we either add an option to disable it or to provide a callback for encoding?

Activity

sgjesse

sgjesse commented on May 7, 2013

@sgjesse
Contributor

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

nex3

nex3 commented on May 7, 2013

@nex3
Member

What's the practical difference between your encoder and encodeUriComponent?

DartBot

DartBot commented on May 7, 2013

@DartBot
Author

This comment was originally written by kaisellgren@gmail.com


This is exactly what I am doing: https://dev.twitter.com/docs/auth/percent-encoding-parameters

nex3

nex3 commented on May 7, 2013

@nex3
Member

Perhaps the better solution is to follow RFC 3986 in the default encodeUriComponent implementation. Soren, what do you think?

I don't think this is something we want to make configurable in the http package. URL-escaping is only performed when using the [Request.bodyFields] attribute, which is just a wrapper over the underlying [Request.body] field. It would be pretty easy to write a [Request] subclass that uses whatever encoding mechanism you want for [bodyFields], or to write a [Client] subclass that re-encodes requests before sending them.


cc @sgjesse.

sgjesse

sgjesse commented on May 14, 2013

@sgjesse
Contributor

This is also related to the discussion in issue #7464.

There is also the subtle difference in using URL encoding for FORM (both post and get) using the content type application/x-www-form-urlencoded. HTML 4.01 section 17.13.4 (http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1) says that space characters should be replaced by `+'.

Of cause the encoding of form post with application/x-www-form-urlencoded is not directly related to RFC 3938 except that the RFC 1738 (the RFC updated by RFC 3938) encoding is used after the space to `+' replacement has taken place.

sethladd

sethladd commented on Jul 18, 2014

@sethladd
Contributor

Doesn't sound like the http package will add this option. Please reopen if otherwise.


Removed Type-Defect, Priority-Medium labels.
Added Type-Enhancement, Priority-Low, Pkg-Http, NotPlanned labels.

added
P3A lower priority bug or feature request
area-pkgUsed for miscellaneous pkg/ packages not associated with specific area- teams.
closed-not-plannedClosed as we don't intend to take action on the reported issue
on Jul 18, 2014
DartBot

DartBot commented on Jun 5, 2015

@DartBot
Author

This issue has been moved to dart-lang/http#11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-pkgUsed for miscellaneous pkg/ packages not associated with specific area- teams.closed-not-plannedClosed as we don't intend to take action on the reported issuetype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @nex3@sethladd@kevmoo@sgjesse@DartBot

        Issue actions

          Add an option to disable or change URI encoding in HTTP package · Issue #10475 · dart-lang/sdk