libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] MHD_OPTION_URI_LOG_CALLBACK function is passed empty URI


From: Nader Zeid
Subject: [libmicrohttpd] MHD_OPTION_URI_LOG_CALLBACK function is passed empty URI string:
Date: Tue, 27 May 2014 21:20:48 -0400

I can't think of any reason why this won't work. I have the following function:



void * MicroHttpdServer::log(void * cls, const char * uri) {
  Request *request(new Request());
  printf("\nURI: %s\n", uri);
  return request;
}



Given as the value of the MHD_OPTION_URI_LOG_CALLBACK option:



MHD_Daemon *daemon;
daemon = MHD_start_daemon(
  MHD_USE_SELECT_INTERNALLY | MHD_USE_IPv6,
  MicroHttpdServer::port,
  NULL, // &MicroHttpdServer::authorize
  NULL,
  &MicroHttpdServer::handle,
  NULL,
  MHD_OPTION_THREAD_POOL_SIZE,
  MicroHttpdServer::amount,
  MHD_OPTION_URI_LOG_CALLBACK,
  &MicroHttpdServer::log,
  MHD_OPTION_END
);



With the exception of "uri" being empty in "MicroHttpdServer::log", the program compiles and the server runs properly in every conceivable way.

Below is the command I'm using to test this particular function:



address@hidden WebTools]$ curl -v localhost:8000/foo?bar=baz
* About to connect() to localhost port 8000 (#0)
*   Trying ::1... connected
* Connected to localhost (::1) port 8000 (#0)
> GET /foo?bar=baz HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: localhost:8000
> Accept: */*
< HTTP/1.1 200 OK
< Connection: Keep-Alive
< Content-Length: 41
< Date: Wed, 28 May 2014 01:16:44 GMT
* Connection #0 to host localhost left intact
* Closing connection #0
<html><body>Hello, browser!</body></html>



And below is the output from the server (running it straight from the command line):



address@hidden WebTools]$ ./WebToolsTest

URI: 

::1 | /foo | GET | HTTP/1.1 | 0



I'm stumped. The only thing left to do after this email is to debug the libmicrohttpd source code, but I'm hoping I missed something.

Regards,

Nader

reply via email to

[Prev in Thread] Current Thread [Next in Thread]