Changeset 74071 in vbox for trunk/src/VBox/Runtime/tools
- Timestamp:
- Sep 4, 2018 3:32:56 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/tools/RTHttp.cpp
r73334 r74071 32 32 33 33 #include <iprt/assert.h> 34 #include <iprt/ctype.h> 34 35 #include <iprt/err.h> 35 36 #include <iprt/getopt.h> … … 68 69 { "--quiet", 'q', RTGETOPT_REQ_NOTHING }, 69 70 { "--verbose", 'v', RTGETOPT_REQ_NOTHING }, 71 { "--set-header", 's', RTGETOPT_REQ_STRING }, 70 72 }; 71 73 … … 111 113 RTPrintf("$Revision$\n"); 112 114 return RTEXITCODE_SUCCESS; 115 116 case 's': 117 { 118 char *pszColon = (char *)strchr(ValueUnion.psz, ':'); 119 if (!pszColon) 120 return RTMsgErrorExit(RTEXITCODE_FAILURE, "No colon in --set-header value: %s", ValueUnion.psz); 121 *pszColon = '\0'; /* evil */ 122 const char *pszValue = pszColon + 1; 123 if (RT_C_IS_BLANK(*pszValue)) 124 pszValue++; 125 int rc = RTHttpAddHeader(hHttp, ValueUnion.psz, pszValue, RTSTR_MAX, RTHTTPADDHDR_F_BACK); 126 *pszColon = ':'; 127 if (RT_FAILURE(rc)) 128 return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTHttpAddHeader failed: %Rrc (on %s)", rc, ValueUnion.psz); 129 break; 130 } 113 131 114 132 case VINF_GETOPT_NOT_OPTION:
Note:
See TracChangeset
for help on using the changeset viewer.