mirror of
https://github.com/ksherlock/gopher.git
synced 2024-12-21 21:29:19 +00:00
url - path+query component.
This commit is contained in:
parent
9aca19b10f
commit
afe71ebe02
@ -4,8 +4,8 @@ OBJS = gopher.o url.o connection.o readline2.o scheme.o ftype.o setftype.o
|
|||||||
gopher: $(OBJS)
|
gopher: $(OBJS)
|
||||||
$(CC) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@
|
$(CC) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@
|
||||||
|
|
||||||
utest: utest.o url.o
|
utest: utest.o url.o scheme.o
|
||||||
$(CC) $(LDFLAGS) utest.o url.o -o $@
|
$(CC) $(LDFLAGS) utest.o url.o scheme.o -o $@
|
||||||
|
|
||||||
dtest: dtest.o dictionary.o
|
dtest: dtest.o dictionary.o
|
||||||
$(CC) $(LDFLAGS) dtest.o dictionary.o -o $@
|
$(CC) $(LDFLAGS) dtest.o dictionary.o -o $@
|
||||||
|
8
url.c
8
url.c
@ -4,10 +4,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kScheme,
|
kScheme,
|
||||||
kUser,
|
kUser,
|
||||||
@ -145,7 +144,7 @@ int ParseURL(const char *url, int length, struct URLComponents *components)
|
|||||||
|
|
||||||
components->scheme = range;
|
components->scheme = range;
|
||||||
|
|
||||||
parseScheme(url, i, components);
|
parse_scheme(url, i, components);
|
||||||
|
|
||||||
++i; // skip the ':'
|
++i; // skip the ':'
|
||||||
}
|
}
|
||||||
@ -415,7 +414,6 @@ int ParseURL(const char *url, int length, struct URLComponents *components)
|
|||||||
components->portNumber = p;
|
components->portNumber = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// path and query.
|
// path and query.
|
||||||
// path;params?query
|
// path;params?query
|
||||||
range = components->path;
|
range = components->path;
|
||||||
@ -423,12 +421,12 @@ int ParseURL(const char *url, int length, struct URLComponents *components)
|
|||||||
{
|
{
|
||||||
if (components->params.length)
|
if (components->params.length)
|
||||||
range.length += components->params.length + 1;
|
range.length += components->params.length + 1;
|
||||||
|
|
||||||
if (components->query.length)
|
if (components->query.length)
|
||||||
range.length += components->query.length + 1;
|
range.length += components->query.length + 1;
|
||||||
|
|
||||||
components->pathAndQuery = range;
|
components->pathAndQuery = range;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
3
utest.c
3
utest.c
@ -46,6 +46,9 @@ void test(const char *url)
|
|||||||
|
|
||||||
URLComponentGetC(url, &data, URLComponentFragment, buffer);
|
URLComponentGetC(url, &data, URLComponentFragment, buffer);
|
||||||
printf(" fragment: %s\n", buffer);
|
printf(" fragment: %s\n", buffer);
|
||||||
|
|
||||||
|
URLComponentGetC(url, &data, URLComponentPathAndQuery, buffer);
|
||||||
|
printf(" path+query: %s\n", buffer);
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user