Index: trunk/ntripserver/ntripserver.c
===================================================================
--- trunk/ntripserver/ntripserver.c	(revision 9642)
+++ trunk/ntripserver/ntripserver.c	(revision 9643)
@@ -672,97 +672,97 @@
 
         /* input from NTRIP caster */
-        int init = 0;
-        /* set socket buffer size */
-        setsockopt(gps_socket, SOL_SOCKET, SO_SNDBUF, (const char*) &size, sizeof(const char*));
-        /* input from Ntrip caster*/
-        nBufferBytes=snprintf(szSendBuffer, sizeof(szSendBuffer) - 40,/* leave some space for login */
-        "GET %s/%s HTTP/1.1\r\n"
-        "Host: %s\r\n"
-        "%s"
-        "User-Agent: %s/%s\r\n"
-        //"%s%s%s"        // nmea
-        "Connection: close%s",
-        get_extension,
-        stream_name ? stream_name : "",
-        casterinhost,
-        inputmode == NTRIP1_IN ? "" : "Ntrip-Version: Ntrip/2.0\r\n",
-        AGENTSTRING, revisionstr,
-        //args.nmea ? "Ntrip-GGA: " : "", args.nmea ? args.nmea : "", args.nmea ? "\r\n" : "", // TODO: add argument
-        (*stream_user || *stream_password) ? "\r\nAuthorization: Basic " : "");
-        /* second check for old glibc */
-        if (nBufferBytes > (int) sizeof(szSendBuffer) - 40 || nBufferBytes < 0) {
-          fprintf(stderr, "ERROR: Source caster request too long\n");
-          input_init = 0;
-          reconnect_sec_max = 0;
-          break;
-        }
-        nBufferBytes += encode(szSendBuffer + nBufferBytes, sizeof(szSendBuffer) - nBufferBytes - 4,
-                               stream_user, stream_password);
-        if (nBufferBytes > (int) sizeof(szSendBuffer) - 4) {
-          fprintf(stderr, "ERROR: Source caster user ID and/or password too long\n");
-          input_init = 0;
-          reconnect_sec_max = 0;
-          break;
-        }
-        szSendBuffer[nBufferBytes++] = '\r';
-        szSendBuffer[nBufferBytes++] = '\n';
-        szSendBuffer[nBufferBytes++] = '\r';
-        szSendBuffer[nBufferBytes++] = '\n';
-#ifndef NDEBUG
-        fprintf(stdout, "%s\n", szSendBuffer);
-#endif
-        if ((send(gps_socket, szSendBuffer, (size_t) nBufferBytes, 0)) != nBufferBytes) {
-          fprintf(stderr, "WARNING: could not send Source caster request\n");
-          input_init = 0;
-          break;
-        }
-        nBufferBytes = 0;
-        /* check Source caster's response */
-        while (!init && nBufferBytes < (int) sizeof(szSendBuffer) &&
-               (nBufferBytes += recv(gps_socket, szSendBuffer,  sizeof(szSendBuffer) - nBufferBytes, 0)) > 0) {
-          if( nBufferBytes > 17 && !strstr(szSendBuffer, "ICY 200 OK")  &&  /* case 'proxy & ntrip 1.0 caster' */
-            (!strncmp(szSendBuffer, "HTTP/1.1 200 OK\r\n", 17) ||
-             !strncmp(szSendBuffer, "HTTP/1.0 200 OK\r\n", 17)) ) {
-            const char *datacheck   = "Content-Type: gnss/data\r\n";
-            const char *chunkycheck = "Transfer-Encoding: chunked\r\n";
-            int l = strlen(datacheck)-1;
-            int j=0;
-            for(i = 0; j != l && i < nBufferBytes-l; ++i)  {
-              for(j = 0; j < l && szSendBuffer[i+j] == datacheck[j]; ++j)
-                ;
+        if (stream_name) {
+          int init = 0;
+          /* set socket buffer size */
+          setsockopt(gps_socket, SOL_SOCKET, SO_SNDBUF, (const char*) &size, sizeof(const char*));
+          /* input from Ntrip caster*/
+          nBufferBytes=snprintf(szSendBuffer, sizeof(szSendBuffer) - 40,/* leave some space for login */
+          "GET %s/%s HTTP/1.1\r\n"
+          "Host: %s\r\n"
+          "%s"
+          "User-Agent: %s/%s\r\n"
+          //"%s%s%s"        // nmea
+          "Connection: close%s",
+          get_extension,
+          stream_name ? stream_name : "",
+          casterinhost,
+          inputmode == NTRIP1_IN ? "" : "Ntrip-Version: Ntrip/2.0\r\n",
+          AGENTSTRING, revisionstr,
+          //args.nmea ? "Ntrip-GGA: " : "", args.nmea ? args.nmea : "", args.nmea ? "\r\n" : "", // TODO: add argument
+          (*stream_user || *stream_password) ? "\r\nAuthorization: Basic " : "");
+          /* second check for old glibc */
+          if (nBufferBytes > (int) sizeof(szSendBuffer) - 40 || nBufferBytes < 0) {
+            fprintf(stderr, "ERROR: Source caster request too long\n");
+            input_init = 0;
+            reconnect_sec_max = 0;
+            break;
+          }
+          nBufferBytes += encode(szSendBuffer + nBufferBytes, sizeof(szSendBuffer) - nBufferBytes - 4,
+                                 stream_user, stream_password);
+          if (nBufferBytes > (int) sizeof(szSendBuffer) - 4) {
+            fprintf(stderr, "ERROR: Source caster user ID and/or password too long\n");
+            input_init = 0;
+            reconnect_sec_max = 0;
+            break;
+          }
+          szSendBuffer[nBufferBytes++] = '\r';
+          szSendBuffer[nBufferBytes++] = '\n';
+          szSendBuffer[nBufferBytes++] = '\r';
+          szSendBuffer[nBufferBytes++] = '\n';
+  #ifndef NDEBUG
+          fprintf(stdout, "%s\n", szSendBuffer);
+  #endif
+          if ((send(gps_socket, szSendBuffer, (size_t) nBufferBytes, 0)) != nBufferBytes) {
+            fprintf(stderr, "WARNING: could not send Source caster request\n");
+            input_init = 0;
+            break;
+          }
+          nBufferBytes = 0;
+          /* check Source caster's response */
+          while (!init && nBufferBytes < (int) sizeof(szSendBuffer) &&
+                 (nBufferBytes += recv(gps_socket, szSendBuffer,  sizeof(szSendBuffer) - nBufferBytes, 0)) > 0) {
+            if( nBufferBytes > 17 && !strstr(szSendBuffer, "ICY 200 OK")  &&  /* case 'proxy & ntrip 1.0 caster' */
+              (!strncmp(szSendBuffer, "HTTP/1.1 200 OK\r\n", 17) ||
+               !strncmp(szSendBuffer, "HTTP/1.0 200 OK\r\n", 17)) ) {
+              const char *datacheck   = "Content-Type: gnss/data\r\n";
+              const char *chunkycheck = "Transfer-Encoding: chunked\r\n";
+              int l = strlen(datacheck)-1;
+              int j=0;
+              for(i = 0; j != l && i < nBufferBytes-l; ++i)  {
+                for(j = 0; j < l && szSendBuffer[i+j] == datacheck[j]; ++j)
+                  ;
+              }
+              if(i == nBufferBytes-l) {
+                fprintf(stderr, "No 'Content-Type: gnss/data' found\n");
+                input_init = 0;
+              }
+              l = strlen(chunkycheck)-1;
+              j=0;
+              for(i = 0; j != l && i < nBufferBytes-l; ++i) {
+                for(j = 0; j < l && szSendBuffer[i+j] == chunkycheck[j]; ++j)
+                  ;
+              }
+              if(i < nBufferBytes-l)
+                chunkymode = 1;
+              init = 1;
             }
-            if(i == nBufferBytes-l) {
-              fprintf(stderr, "No 'Content-Type: gnss/data' found\n");
-              input_init = 0;
+            else if (strstr(szSendBuffer, "\r\n")) {
+              if (!strstr(szSendBuffer, "ICY 200 OK")) {
+                int k;
+                fprintf(stderr, "ERROR: could not get requested data from Source caster: ");
+                for (k = 0; k < nBufferBytes && szSendBuffer[k] != '\n' && szSendBuffer[k] != '\r'; ++k) {
+                  fprintf(stderr, "%c", isprint(szSendBuffer[k]) ? szSendBuffer[k] : '.');
+                }
+                fprintf(stderr, "\n");
+                if (!strstr(szSendBuffer, "SOURCETABLE 200 OK")) {
+                  reconnect_sec_max = 0;
+                }
+                input_init = 0;
+                break;
+              }
+              init = 1;
             }
-            l = strlen(chunkycheck)-1;
-            j=0;
-            for(i = 0; j != l && i < nBufferBytes-l; ++i) {
-              for(j = 0; j < l && szSendBuffer[i+j] == chunkycheck[j]; ++j)
-                ;
-            }
-            if(i < nBufferBytes-l)
-              chunkymode = 1;
-            init = 1;
-          }
-          else if (strstr(szSendBuffer, "\r\n")) {
-            if (!strstr(szSendBuffer, "ICY 200 OK")) {
-              int k;
-              fprintf(stderr, "ERROR: could not get requested data from Source caster: ");
-              for (k = 0; k < nBufferBytes && szSendBuffer[k] != '\n' && szSendBuffer[k] != '\r'; ++k) {
-                fprintf(stderr, "%c", isprint(szSendBuffer[k]) ? szSendBuffer[k] : '.');
-              }
-              fprintf(stderr, "\n");
-              if (!strstr(szSendBuffer, "SOURCETABLE 200 OK")) {
-                reconnect_sec_max = 0;
-              }
-              input_init = 0;
-              break;
-            }
-            init = 1;
-          }
-
-        }
-         /* end input from NTRIP caster */
+          }
+        }
 
         if (initfile && inputmode != SISNET) {
