summaryrefslogtreecommitdiff
path: root/uri.h
diff options
context:
space:
mode:
authorepoch <epoch@hacking.allowed.org>2019-04-20 06:43:23 -0500
committerepoch <epoch@hacking.allowed.org>2019-04-20 06:43:23 -0500
commit6a78fa292800adba07094bd5e06b0bb8a4fb8305 (patch)
treed945366b7690fc7743ba730820c98bc0a3b802d2 /uri.h
parentd76a5edf9bc16f5fd610dab5c69e6359cd8e1381 (diff)
downloaduritools-6a78fa292800adba07094bd5e06b0bb8a4fb8305.tar.gz
uritools-6a78fa292800adba07094bd5e06b0bb8a4fb8305.zip
put _XOPEN_SOURCE only in the file it is actually needed. fixed parse bug where uris without a scheme were not defaulting provided line to an authority section
Diffstat (limited to 'uri.h')
-rw-r--r--uri.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/uri.h b/uri.h
index 97ce3c2..aa12a8c 100644
--- a/uri.h
+++ b/uri.h
@@ -1,7 +1,7 @@
#ifndef uri_H
#define uri_H
-#define _XOPEN_SOURCE 500 //for strdup
+//#define _XOPEN_SOURCE 500 //for strdup
#include <string.h>
#include <netdb.h>
#include <stdio.h>
@@ -211,8 +211,10 @@ int urifromline(struct uri *u,char *line) {
//if there wasn't a /, it points at a null byte. so "empty"
u->username=line+1;
} else {
- //we have all we need.
- return 1;
+ //we're an authority section without a // I guess.
+ //or we're a path
+ if(u->scheme) u->path=line;
+ else u->username=line;//if we have a scheme we're not a //-less authority
}
if(u->username) {//this contains all of the authority.