Coder Social home page Coder Social logo

libyuarel's People

Contributors

jacketizer avatar rlaveaux avatar zgoda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libyuarel's Issues

libyuarel does not parse IPv6 URL properly.

Hi,
This is not really a problem for my case, but I'm reporting it just FYI.

http://[2001:4860:0:2001::68]/foo/bar?a=123
Struct values:
        scheme:         http
        host:           [2001
        port:           574336293
        path:           foo/bar
        query:          a=123
        fragment:       (null)
Could not split path!

Bug in yuarel_parse_query() function

Hello, I found an error when 1 struct yuarel_param is passed to the yuarel_parse_query() function.
They are not working properly.

		char* query = "a=b&c=d";
		yuarel_param params;
		yuarel_parse_query(query, '&', &params, 1);

		// HERE
		// params.key == "a"
		// params.val ==  "b&c=d"

user without password does not parse

Hi, thanks for sharing your code! I'm dumping a one-off parser I wrote myself in another project for yours.

One issue I found is it seems the code that parses credentials requires both user and password.
E.g. http://u:[email protected] works, but http://[email protected] does not.

Does this look like the right fix?

diff --git a/yuarel.c b/yuarel.c
index a5f313fb7..072bd76ad 100644
--- a/yuarel.c
+++ b/yuarel.c
@@ -180,12 +180,11 @@ yuarel_parse(struct yuarel *url, char *u)
                        *u = '\0';
 
                        u = strchr(url->username, ':');
-                       if (NULL == u) {
-                               return -1;
+                       if (NULL != u) {
+                               url->password = u + 1;
+                               *u = '\0';
                        }
 
-                       url->password = u + 1;
-                       *u = '\0';
                }
 
                /* Missing hostname? */

Original string is changed

Maybe the Read.me could be updated with the notion that the original string will be modified during the parsing proces?
I noticed my original string after parsing containing only "http" after parsing was done. I still need my original string after parsing, so I pulled a copy using malloc().
I assume you do not want a malloc() call in your lib? So you deliberately do not make a local copy, am I right?

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.