Giter Site home page Giter Site logo

Comments (3)

davecheney avatar davecheney commented on July 21, 2024

Hi Gary,

I've been thinking about this a bit. I don't like url.Parse, it is too lenient. My plan is to write a http specific url parser, but it will be strict, and will have to take one position on URI encoding.

Here is what I am thinking

http.Get(string) will always feed the uri string to this parser so it may not be possible to handle that sample url correctly at that level. I don't know, I have't written it, however

client.Do will take a uri, not a string (the current impl takes a path string and []string query, this is a hack)

if client.Get takes a string, or a uri is not certain at this point

from http.

garyburd avatar garyburd commented on July 21, 2024

This is easy to get correct: Do not unescape the path when parsing the URL. Do not escape the path and query string when writing the path to the network.

If you plan to use the net/url URL type, then the parser should assign the raw path and query string to the URL Opaque field. Write the result of the URL RequestURI() method to the network. If the Opaque field is set, then RequestURI() returns the Opaque field as is. If an application constructed a URL by setting the Path and RawQuery fields instead of the Opaque field, then RequestURI() escapes the path and joins it with the query.

from http.

davecheney avatar davecheney commented on July 21, 2024

Ok, that doesn't sound too hard. Could you give a list of URI's and I'll turn them into test cases.

On 07/08/2013, at 13:22, Gary Burd [email protected] wrote:

This is easy to get correct: Do not unescape the path when parsing the URL. Do not escape the path and query string when writing the path to the network.

If you plan to use the net/url URL type, then the parser should assign the raw path and query string to the URL Opaque field. Write the result of the URL RequestURI() method to the network. If the Opaque field is set, then RequestURI() returns the Opaque field as is. If an application constructed a URL by setting the Path and RawQuery fields instead of the Opaque field, then RequestURI() will escapes the path and joins it with the query.


Reply to this email directly or view it on GitHub.

from http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.