]> prime8.dev >> repos - ttyd.git/commitdiff
Use custom Server header in http response
authorShuanglei Tao <tsl0922@gmail.com>
Thu, 6 Oct 2016 07:01:41 +0000 (15:01 +0800)
committerShuanglei Tao <tsl0922@gmail.com>
Thu, 6 Oct 2016 07:25:03 +0000 (15:25 +0800)
.travis.yml
src/server.c

index 189ef6d251bd405401f69a03374b73858d519cad..afcd0a196514be6b3c9068cfbb5caedbfcb386ee 100644 (file)
@@ -18,11 +18,11 @@ addons:
       - libssl-dev
 install:
   - echo $TRAVIS_OS_NAME
-  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; brew unlink cmake json-c; brew install cmake openssl json-c; fi
+  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install cmake openssl json-c; export CMAKE_OPTIONS="-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl"; fi
   - echo "Compiling libwebsockets-$LIBWEBSOCKETS_VERSION from source..."
-  - pushd /tmp; curl -sLo- https://github.com/warmcat/libwebsockets/archive/$LIBWEBSOCKETS_VERSION.tar.gz | tar xz; cd libwebsockets-*; cmake .; make && sudo make install; popd
+  - pushd /tmp; curl -sLo- https://github.com/warmcat/libwebsockets/archive/$LIBWEBSOCKETS_VERSION.tar.gz | tar xz; cd libwebsockets-*; cmake $CMAKE_OPTIONS .; make && sudo make install; popd
 script:
   - echo $TRAVIS_OS_NAME
   - cmake --version
   - mkdir build && cd build
-  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl .. && make; else cmake .. && make; fi
+  - cmake $CMAKE_OPTIONS .. && make
index faffd680d55791864df8c56a547000940e7b5595..7792cfa9a65bce94c46e1644bf8542dea0d0d1ba 100644 (file)
@@ -272,6 +272,12 @@ main(int argc, char **argv) {
 
     lws_set_log_level(debug_level, NULL);
 
+#if LWS_LIBRARY_VERSION_MAJOR == 2
+    char server_hdr[128] = "";
+    sprintf(server_hdr, "ttyd/%s (libwebsockets/%s)", TTYD_VERSION, LWS_LIBRARY_VERSION);
+    info.server_string = server_hdr;
+#endif
+
     if (strlen(iface) > 0)
         info.iface = iface;
     if (ssl) {