Using urlencode.

This commit is contained in:
Jose Marcial Vieira Bisneto 2017-09-25 15:31:03 -03:00
parent 6fc2614fe7
commit 8e56826b8d
No known key found for this signature in database
GPG key ID: 103E935E7E6E831E

View file

@ -16,6 +16,7 @@
#include "libp2p/net/p2pnet.h"
#include "libp2p/os/memstream.h"
#include "libp2p/utils/logger.h"
#include "libp2p/utils/urlencode.h"
#include "ipfs/core/api.h"
#include "ipfs/importer/exporter.h"
#include "ipfs/core/http_request.h"
@ -351,9 +352,8 @@ struct HttpRequest* api_build_http_request(struct s_request* req) {
request->sub_command = segs; // sub_command can contain another level as filters/add
}
if (req->query) {
segs = malloc (strlen(req->buf + req->query) + 1);
segs = libp2p_utils_url_decode(req->buf + req->query);
if (segs) {
strcpy(segs, req->buf + req->query);
while (segs) {
char *value, *name = segs;
segs = strchr(segs, '&');