bare-url 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-url",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "URL parser for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [
Binary file
Binary file
Binary file
Binary file
@@ -763,8 +763,10 @@ url__parse (url_t *url, const utf8_string_view_t input, const url_t *base) {
763
763
  }
764
764
 
765
765
  if (c == 0x2f) {
766
- err = utf8_string_append_literal(&url->href, (utf8_t *) "//", 2);
767
- if (err < 0) goto err;
766
+ if (url->type != url_type_opaque) {
767
+ err = utf8_string_append_literal(&url->href, (utf8_t *) "//", 2);
768
+ if (err < 0) goto err;
769
+ }
768
770
 
769
771
  url->components.username_end = url->href.len;
770
772
 
@@ -1107,11 +1109,11 @@ url__parse (url_t *url, const utf8_string_view_t input, const url_t *base) {
1107
1109
 
1108
1110
  // https://url.spec.whatwg.org/#file-state
1109
1111
  case url_state_file:
1112
+ url->components.host_start = url->href.len;
1113
+
1110
1114
  if (c == 0x2f || c == 0x5c) {
1111
1115
  state = url_state_file_slash;
1112
1116
  } else if (base != NULL && base->type == url_type_file) {
1113
- url->components.host_start = url->href.len;
1114
-
1115
1117
  err = utf8_string_append_view(&url->href, url_get_host(base));
1116
1118
  if (err < 0) goto err;
1117
1119
 
@@ -1158,6 +1160,9 @@ url__parse (url_t *url, const utf8_string_view_t input, const url_t *base) {
1158
1160
  }
1159
1161
  }
1160
1162
  } else {
1163
+ url->components.host_end = url->href.len;
1164
+ url->components.path_start = url->href.len;
1165
+
1161
1166
  state = url_state_path;
1162
1167
  pointer--;
1163
1168
  }
@@ -1169,8 +1174,6 @@ url__parse (url_t *url, const utf8_string_view_t input, const url_t *base) {
1169
1174
  state = url_state_file_host;
1170
1175
  } else {
1171
1176
  if (base != NULL && base->type == url_type_file) {
1172
- url->components.host_start = url->href.len;
1173
-
1174
1177
  err = utf8_string_append_view(&url->href, url_get_host(base));
1175
1178
  if (err < 0) goto err;
1176
1179
 
@@ -1189,6 +1192,7 @@ url__parse (url_t *url, const utf8_string_view_t input, const url_t *base) {
1189
1192
  }
1190
1193
  }
1191
1194
  } else {
1195
+ url->components.host_end = url->href.len;
1192
1196
  url->components.path_start = url->href.len;
1193
1197
  }
1194
1198