Skip to content

Commit

Permalink
url - path+query component.
Browse files Browse the repository at this point in the history
  • Loading branch information
ksherlock committed Apr 20, 2012
1 parent 9aca19b commit afe71eb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ OBJS = gopher.o url.o connection.o readline2.o scheme.o ftype.o setftype.o
gopher: $(OBJS)
$(CC) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@

utest: utest.o url.o
$(CC) $(LDFLAGS) utest.o url.o -o $@
utest: utest.o url.o scheme.o
$(CC) $(LDFLAGS) utest.o url.o scheme.o -o $@

dtest: dtest.o dictionary.o
$(CC) $(LDFLAGS) dtest.o dictionary.o -o $@
Expand Down
8 changes: 3 additions & 5 deletions url.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
#include <stdlib.h>
#include <ctype.h>



#include "url.h"


enum {
kScheme,
kUser,
Expand Down Expand Up @@ -145,7 +144,7 @@ int ParseURL(const char *url, int length, struct URLComponents *components)

components->scheme = range;

parseScheme(url, i, components);
parse_scheme(url, i, components);

++i; // skip the ':'
}
Expand Down Expand Up @@ -415,20 +414,19 @@ int ParseURL(const char *url, int length, struct URLComponents *components)
components->portNumber = p;
}

#if 0
// path and query.
// path;params?query
range = components->path;
if (range.length)
{
if (components->params.length)
range.length += components->params.length + 1;

if (components->query.length)
range.length += components->query.length + 1;

components->pathAndQuery = range;
}
#endif

return 1;

Expand Down
3 changes: 3 additions & 0 deletions utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ void test(const char *url)

URLComponentGetC(url, &data, URLComponentFragment, buffer);
printf(" fragment: %s\n", buffer);

URLComponentGetC(url, &data, URLComponentPathAndQuery, buffer);
printf(" path+query: %s\n", buffer);

free(buffer);

Expand Down

0 comments on commit afe71eb

Please sign in to comment.