Skip to content

Commit 7f0df40

Browse files
unknownunknown
authored andcommitted
Fixing the build
Signed-off-by: unknown <[email protected]>
1 parent 570643d commit 7f0df40

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Release/include/cpprest/uri_builder.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,24 @@ namespace web { namespace http
151151
return *this;
152152
}
153153

154+
/// <summary>
155+
/// Set the port component of the URI.
156+
/// </summary>
157+
/// <param name="port">Port as a string.</param>
158+
/// <returns>A reference to this <c>uri_builder</c> to support chaining.</returns>
159+
/// <remarks>When string can't be converted to an integer the port is left unchanged.</remarks>
160+
uri_builder & set_port(const utility::string_t &port)
161+
{
162+
utility::istringstream_t portStream(port);
163+
portStream >> m_uri.m_port;
164+
if(portStream.fail() || portStream.bad())
165+
{
166+
throw std::invalid_argument("invalid port argument, must be non empty string containing integer value");
167+
}
168+
169+
return *this;
170+
}
171+
154172
/// <summary>
155173
/// Set the path component of the URI.
156174
/// </summary>

0 commit comments

Comments
 (0)