Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-imgsrv
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-imgsrv
Commits
33d97101
Commit
33d97101
authored
Jun 26, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enabled CORS for images
parent
bcb068e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
imgsrv.c
src/imgsrv.c
+8
-0
No files found.
src/imgsrv.c
View file @
33d97101
...
@@ -555,6 +555,7 @@ int metaXML(struct file_set *fset, int mode)
...
@@ -555,6 +555,7 @@ int metaXML(struct file_set *fset, int mode)
}
else
if
(
mode
==
0
)
{
// open the XML output (length is undefined - multiple frames meta data might be output)
}
else
if
(
mode
==
0
)
{
// open the XML output (length is undefined - multiple frames meta data might be output)
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Access-Control-Allow-Origin: *
\r\n
"
);
printf
(
"Content-Type: text/xml
\r\n
"
);
printf
(
"Content-Type: text/xml
\r\n
"
);
printf
(
"Pragma: no-cache
\r\n
"
);
printf
(
"Pragma: no-cache
\r\n
"
);
printf
(
"
\r\n
"
);
printf
(
"
\r\n
"
);
...
@@ -831,6 +832,7 @@ int framePointersXML(struct file_set *fset)
...
@@ -831,6 +832,7 @@ int framePointersXML(struct file_set *fset)
cp_compressor_state
);
cp_compressor_state
);
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Access-Control-Allow-Origin: *
\r\n
"
);
printf
(
"Content-Length: %d
\r\n
"
,
strlen
(
s
));
printf
(
"Content-Length: %d
\r\n
"
,
strlen
(
s
));
printf
(
"Content-Type: text/xml
\r\n
"
);
printf
(
"Content-Type: text/xml
\r\n
"
);
printf
(
"Pragma: no-cache
\r\n
"
);
printf
(
"Pragma: no-cache
\r\n
"
);
...
@@ -852,6 +854,7 @@ int out1x1gif(void)
...
@@ -852,6 +854,7 @@ int out1x1gif(void)
{
{
char
s
[]
=
"HTTP/1.0 200 OK
\r\n
"
\
char
s
[]
=
"HTTP/1.0 200 OK
\r\n
"
\
"Server: Elphel Imgsrv
\r\n
"
\
"Server: Elphel Imgsrv
\r\n
"
\
"Access-Control-Allow-Origin: *
\r\n
"
\
"Content-Length: 35
\r\n
"
\
"Content-Length: 35
\r\n
"
\
"Content-Type: image/gif
\r\n
"
\
"Content-Type: image/gif
\r\n
"
\
"
\r\n
"
\
"
\r\n
"
\
...
@@ -879,6 +882,7 @@ void errorMsgXML(char * msg)
...
@@ -879,6 +882,7 @@ void errorMsgXML(char * msg)
D
(
fprintf
(
stderr
,
">%s< [%d bytes]"
,
s
,
strlen
(
s
)));
D
(
fprintf
(
stderr
,
">%s< [%d bytes]"
,
s
,
strlen
(
s
)));
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Access-Control-Allow-Origin: *
\r\n
"
);
printf
(
"Content-Length: %d
\r\n
"
,
strlen
(
s
));
printf
(
"Content-Length: %d
\r\n
"
,
strlen
(
s
));
printf
(
"Content-Type: text/xml
\r\n
"
);
printf
(
"Content-Type: text/xml
\r\n
"
);
printf
(
"Pragma: no-cache
\r\n
"
);
printf
(
"Pragma: no-cache
\r\n
"
);
...
@@ -1211,6 +1215,7 @@ void listener_loop(struct file_set *fset)
...
@@ -1211,6 +1215,7 @@ void listener_loop(struct file_set *fset)
if
(
!
cp
||
(
strlen
(
cp
)
==
0
))
{
// no url commands - probably the server url was manually entered
if
(
!
cp
||
(
strlen
(
cp
)
==
0
))
{
// no url commands - probably the server url was manually entered
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Access-Control-Allow-Origin: *
\r\n
"
);
printf
(
"Content-Length: %d
\r\n
"
,
strlen
(
url_args
));
printf
(
"Content-Length: %d
\r\n
"
,
strlen
(
url_args
));
printf
(
"Content-Type: text/plain
\r\n
"
);
printf
(
"Content-Type: text/plain
\r\n
"
);
printf
(
"
\r\n
"
);
printf
(
"
\r\n
"
);
...
@@ -1223,6 +1228,7 @@ void listener_loop(struct file_set *fset)
...
@@ -1223,6 +1228,7 @@ void listener_loop(struct file_set *fset)
if
(
strncmp
(
cp
,
"wframe"
,
6
)
==
0
)
waitFrameSync
(
fset
);
if
(
strncmp
(
cp
,
"wframe"
,
6
)
==
0
)
waitFrameSync
(
fset
);
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Access-Control-Allow-Origin: *
\r\n
"
);
printf
(
"Content-Length: 11
\r\n
"
);
printf
(
"Content-Length: 11
\r\n
"
);
printf
(
"Content-Type: text/plain
\r\n
"
);
printf
(
"Content-Type: text/plain
\r\n
"
);
printf
(
"
\r\n
"
);
printf
(
"
\r\n
"
);
...
@@ -1278,6 +1284,7 @@ void listener_loop(struct file_set *fset)
...
@@ -1278,6 +1284,7 @@ void listener_loop(struct file_set *fset)
}
else
{
}
else
{
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Access-Control-Allow-Origin: *
\r\n
"
);
printf
(
"Expires: 0
\r\n
"
);
printf
(
"Expires: 0
\r\n
"
);
printf
(
"Pragma: no-cache
\r\n
"
);
printf
(
"Pragma: no-cache
\r\n
"
);
buf_images
=
((
strcmp
(
cp1
,
"img"
)
==
0
)
||
(
strcmp
(
cp1
,
"simg"
)
==
0
))
?
0
:
1
;
buf_images
=
((
strcmp
(
cp1
,
"img"
)
==
0
)
||
(
strcmp
(
cp1
,
"simg"
)
==
0
))
?
0
:
1
;
...
@@ -1308,6 +1315,7 @@ void listener_loop(struct file_set *fset)
...
@@ -1308,6 +1315,7 @@ void listener_loop(struct file_set *fset)
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"HTTP/1.0 200 OK
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Server: Elphel Imgsrv
\r\n
"
);
printf
(
"Access-Control-Allow-Origin: *
\r\n
"
);
printf
(
"Expires: 0
\r\n
"
);
printf
(
"Expires: 0
\r\n
"
);
printf
(
"Pragma: no-cache
\r\n
"
);
printf
(
"Pragma: no-cache
\r\n
"
);
printf
(
"Content-Type: multipart/x-mixed-replace;boundary=ElphelMultipartJPEGBoundary
\r\n
"
);
printf
(
"Content-Type: multipart/x-mixed-replace;boundary=ElphelMultipartJPEGBoundary
\r\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment