[Bug 678] New: apply decodeURIComponent() in http.setContent()

View: New views
7 Messages — Rating Filter:   Alert me  

[Bug 678] New: apply decodeURIComponent() in http.setContent()

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=678

           Summary: apply decodeURIComponent() in  http.setContent()
           Product: Helma
           Version: CVS trunk
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Web Support
        AssignedTo: helma-dev@...
        ReportedBy: interface@...




--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 678] Apply decodeURIComponent() in helma.Http.setContent() by default?

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=678


tobi <interface@...> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://dev.helma.org/trac/
                   |                            |helma/browser/apps/modules/
                   |                            |trunk/helma/Http.js#L533
            Summary|apply decodeURIComponent()  |Apply decodeURIComponent()
                   |in  http.setContent()       |in helma.Http.setContent()
                   |                            |by default?
           Severity|enhancement                 |minor




--- Comment #1 from tobi <interface@...>  2009-09-16 23:45:45 ---
Setting the content of a helma.Http POST request results in quite some awkward
results if the content is not encoded and contains at least one equal sign:

var c = "<?xml version=1.0?><foo>bar</foo>";
var http = new helma.Http();
http.setMethod("POST");
http.setContent(c);
http.getUrl("...");

At the request URL req.data looks like this:

{http_host=localhost, <?xml version=1.0?><foo>bar</foo>,
http_remotehost=127.0.0.1, http_browser=helma.Http}

(Quite hard to spot what’s going on in the first place...)

A call for encodeURIComponent() before applying setContent() will fix this
easily; however, the question is whether this should not happen by default in
line 533 of helma.Http.js?

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 678] Apply decodeURIComponent() in helma.Http.setContent() by default?

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=678


tobi <interface@...> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|https://dev.helma.org/trac/ |https://dev.helma.org/trac/
                   |helma/browser/apps/modules/ |helma/browser/apps/modules/
                   |trunk/helma/Http.js#L533    |trunk/helma/Http.js#L199




--- Comment #2 from tobi <interface@...>  2009-09-16 23:53:28 ---
Looking further at the source of helma.Http.js a better place for the
encodeURIComponent() call would be in line 199; actually, there are plenty of
calls for that very function already.

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 678] Apply decodeURIComponent() in helma.Http.setContent() by default?

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=678


Hannes Wallnoefer <hannes@...> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |hannes@...
         Resolution|                            |INVALID




--- Comment #3 from Hannes Wallnoefer <hannes@...>  2009-09-17 00:33:59 ---
If you want to receive your POST data as key-value pairs you either have to
pass the content as object[1] or as pre-encoded x-www-form-urlencoded
string[2].

[1] http.setContent({xml: "<?xml version=1.0?><foo>bar</foo>"});

[2]
http.setContent("xml=%3C%3Fxml%20version%3D1.0%3F%3E%3Cfoo%3Ebar%3C%2Ffoo%3E");

If you don't want it parsed as form data on the server side, you should set the
content-type to something other than the default
application/x-www-form-urlencoded.

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 678] Apply decodeURIComponent() in helma.Http.setContent() by default?

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=678


tobi <interface@...> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |VERIFIED




--- Comment #4 from tobi <interface@...>  2009-09-17 10:23:29 ---
My bad. Actually, since this is not about form data, I in fact did / had to set
a specific content type apart from application/x-www-form-urlencoded but had a
typo in http.setHeader("ContentType", ...) - always these nasty little hyphens!

Thanks for the clarification, Hannes.

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 678] Apply decodeURIComponent() in helma.Http.setContent() by default?

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=678





--- Comment #5 from Hannes Wallnoefer <hannes@...>  2009-09-17 10:29:05 ---
(Mit Bezug zu comment #4)
> My bad. Actually, since this is not about form data, I in fact did / had to set
> a specific content type apart from application/x-www-form-urlencoded but had a
> typo in http.setHeader("ContentType", ...) - always these nasty little hyphens!

I see. I guess a setContentType() method in the http client would be handy...

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev

[Bug 678] Apply decodeURIComponent() in helma.Http.setContent() by default?

by Bugzilla from bugzilla-daemon@helma.at :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

http://dev.helma.org/bugs/show_bug.cgi?id=678


tobi <interface@...> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|VERIFIED                    |CLOSED




--- Comment #6 from tobi <interface@...>  2009-09-23 09:19:08 ---
> I see. I guess a setContentType() method in the http client would be handy...

Well, why not?

More convenient would be right now to have a method for retrieving the content
of a request if the default content type is not matched.

I filed another bug for this issue (#682) and close this bug.

--
Configure bugmail: http://dev.helma.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev