diff --git a/quilt/query.c b/quilt/query.c index bc92390..afe5057 100644 --- a/quilt/query.c +++ b/quilt/query.c @@ -44,13 +44,13 @@ spindle_query_request(struct query_struct *dest, QUILTREQ *request, const char * const char *t; t = quilt_request_getparam(request, "q"); - if(t) + if(t && t[0]) { dest->explicit = 1; quilt_canon_set_param(request->canonical, "q", t); } t = quilt_request_getparam(request, "class"); - if(t) + if(t && t[0]) { dest->explicit = 1; quilt_canon_set_param(request->canonical, "class", t); @@ -73,7 +73,7 @@ spindle_query_request(struct query_struct *dest, QUILTREQ *request, const char * dest->text = quilt_request_getparam(request, "q"); dest->lang = quilt_request_getparam(request, "lang"); dest->media = quilt_request_getparam(request, "media"); - if(dest->text || dest->lang || dest->media) + if((dest->text && dest->text[0]) || (dest->lang && dest->lang[0]) || (dest->media && dest->media[0])) { dest->explicit = 1; } @@ -92,7 +92,7 @@ spindle_query_request(struct query_struct *dest, QUILTREQ *request, const char * } dest->type = quilt_request_getparam(request, "type"); - if(dest->type) + if(dest->type && dest->type[0]) { dest->explicit = 1; } @@ -101,7 +101,7 @@ spindle_query_request(struct query_struct *dest, QUILTREQ *request, const char * quilt_canon_set_param(request->canonical, "type", dest->type); } t = quilt_request_getparam(request, "mode"); - if(t) + if(t && t[0]) { if(!strcmp(t, "autocomplete")) { @@ -117,7 +117,7 @@ spindle_query_request(struct query_struct *dest, QUILTREQ *request, const char * } } t = quilt_request_getparam(request, "score"); - if(t) + if(t && t[0]) { dest->score = atoi(t); quilt_canon_set_param(request->canonical, "score", t); diff --git a/quilt/request.c b/quilt/request.c index fa9cbfd..017e578 100644 --- a/quilt/request.c +++ b/quilt/request.c @@ -166,14 +166,16 @@ spindle_add_concrete(QUILTREQ *request) static int spindle_request_is_query_(QUILTREQ *request) { + const char *t; + if(!request->home) { return 0; } - if(quilt_request_getparam(request, "q") || - quilt_request_getparam(request, "media") || - quilt_request_getparam(request, "for") || - quilt_request_getparam(request, "type")) + if(((t = quilt_request_getparam(request, "q")) && t[0]) || + ((t = quilt_request_getparam(request, "media")) && t[0]) || + ((t = quilt_request_getparam(request, "for")) && t[0]) || + ((t = quilt_request_getparam(request, "type")) && t[0])) { request->index = 1; request->home = 0; @@ -269,11 +271,18 @@ spindle_request_is_partition_(QUILTREQ *request, char **qclass) static const char * spindle_request_is_lookup_(QUILTREQ *request) { + const char *t; + if(!request->home) { return NULL; } - return quilt_request_getparam(request, "uri"); + t = quilt_request_getparam(request, "uri"); + if(t && t[0]) + { + return t; + } + return NULL; } static struct spindle_dynamic_endpoint *