[xiph-commits] r6916 -

illiminable at dactyl.lonelymoon.com illiminable
Mon Jun 28 22:58:31 PDT 2004


trunk/oggdsf/src/lib/core/directshow/dsfOggDemux
Message-ID: <20040629055831.22DE79AAAB at dactyl.lonelymoon.com>

Author: illiminable
Date: Mon Jun 28 22:58:31 2004
New Revision: 6916

Modified:
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp
trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h
Log:
* Fixed the http code so that non-standard ports work.

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp	2004-06-29 05:03:44 UTC (rev 6915)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp	2004-06-29 05:58:30 UTC (rev 6916)
@@ -171,12 +171,17 @@

LPSERVENT locServiceData; //lpServEnt
SOCKADDR_IN locServiceSocketAddr; //saServer
-
-	locServiceData = getservbyname("http", "tcp");
-	if (locServiceData == NULL) {
-		locServiceSocketAddr.sin_port = htons(80);
+
+	if (mPort == 0) {
+		locServiceData = getservbyname("http", "tcp");
+		if (locServiceData == NULL) {
+			locServiceSocketAddr.sin_port = htons(80);
+		} else {
+			locServiceSocketAddr.sin_port = locServiceData->s_port;
+		}
} else {
-		locServiceSocketAddr.sin_port = locServiceData->s_port;
+		//Explicit port
+		locServiceSocketAddr.sin_port = htons(mPort);
}


@@ -253,6 +258,7 @@
string locProtocol;
string locServerName;
string locPath;
+	string locPort;
string locTemp;
size_t locPos2;
size_t locPos = inURL.find(':');
@@ -271,8 +277,17 @@
if (locPos == string::npos) {
return false;
} else {
-				locServerName = locTemp.substr(0, locPos);
-				locPath = locTemp.substr(locPos);
+				locPos2 = locTemp.find(':');
+				if (locPos2 == string::npos) {
+					locServerName = locTemp.substr(0, locPos);
+					locPath = locTemp.substr(locPos);
+				} else if (locPos2 < locPos) {
+					//Explicit port specification
+					locPort = locTemp.substr(locPos2 + 1, locPos - locPos2 - 1);
+					locServerName = locTemp.substr(0, locPos2);
+					locPath = locTemp.substr(locPos);
+				}
+
}
}

@@ -280,7 +295,12 @@

mServerName = locServerName;
mFileName = locPath;
-	debugLog<<"Proto : "<<locProtocol<<endl<<"Server : "<<locServerName<<endl<<"Path : "<<mFileName<<endl;
+	if (locPort != "") {
+		mPort = atoi(locPort.c_str());
+	} else {
+		mPort = 0;
+	}
+	debugLog<<"Proto : "<<locProtocol<<endl<<"Server : "<<locServerName<<endl<<" Path : "<<mFileName<<" Port : "<<mPort<<endl;
return true;

}

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h	2004-06-29 05:03:44 UTC (rev 6915)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h	2004-06-29 05:58:30 UTC (rev 6916)
@@ -73,6 +73,7 @@
void DataProcessLoop();
string mServerName;
string mFileName;
+	unsigned short mPort;
string mLastResponse;
SOCKET mSocket;
stringstream mStreamBuffer;



More information about the commits mailing list